Commit 4b038a1e authored by Iustin Pop's avatar Iustin Pop
Browse files

Unify the “--disks” (disk indices) option


Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent e3876ccb
...@@ -48,8 +48,9 @@ __all__ = [ ...@@ -48,8 +48,9 @@ __all__ = [
"CONFIRM_OPT", "CONFIRM_OPT",
"DEBUG_OPT", "DEBUG_OPT",
"DEBUG_SIMERR_OPT", "DEBUG_SIMERR_OPT",
"DISK_TEMPLATE_OPT", "DISKIDX_OPT",
"DISK_OPT", "DISK_OPT",
"DISK_TEMPLATE_OPT",
"FIELDS_OPT", "FIELDS_OPT",
"FILESTORE_DIR_OPT", "FILESTORE_DIR_OPT",
"FILESTORE_DRIVER_OPT", "FILESTORE_DRIVER_OPT",
...@@ -548,6 +549,11 @@ NET_OPT = cli_option("--net", ...@@ -548,6 +549,11 @@ NET_OPT = cli_option("--net",
DISK_OPT = cli_option("--disk", help="Disk parameters", default=[], DISK_OPT = cli_option("--disk", help="Disk parameters", default=[],
dest="disks", action="append", type="identkeyval") dest="disks", action="append", type="identkeyval")
DISKIDX_OPT = cli_option("--disks", dest="disks", default=None,
help="Comma-separated list of disks"
" indices to act on (e.g. 0,2) (optional,"
" defaults to all disks)")
def _ParseArgs(argv, commands, aliases): def _ParseArgs(argv, commands, aliases):
"""Parser for the command line arguments. """Parser for the command line arguments.
......
...@@ -1512,10 +1512,7 @@ commands = { ...@@ -1512,10 +1512,7 @@ commands = {
default=False, action="store_true", default=False, action="store_true",
help=("Automatically replace faulty disks" help=("Automatically replace faulty disks"
" (only for the drbd template)")), " (only for the drbd template)")),
cli_option("--disks", dest="disks", default=None, DISKIDX_OPT,
help="Comma-separated list of disks"
" indices to replace (e.g. 0,2) (optional,"
" defaults to all disks)"),
IALLOCATOR_OPT, IALLOCATOR_OPT,
SUBMIT_OPT, SUBMIT_OPT,
], ],
...@@ -1570,12 +1567,7 @@ commands = { ...@@ -1570,12 +1567,7 @@ commands = {
"<instance>", "<instance>",
"Deactivate an instance's disks"), "Deactivate an instance's disks"),
'recreate-disks': (RecreateDisks, ARGS_ONE_INSTANCE, 'recreate-disks': (RecreateDisks, ARGS_ONE_INSTANCE,
[DEBUG_OPT, SUBMIT_OPT, [DEBUG_OPT, SUBMIT_OPT, DISKIDX_OPT],
cli_option("--disks", dest="disks", default=None,
help="Comma-separated list of disks"
" indices to replace (e.g. 0,2) (optional,"
" defaults to all disks)"),
],
"<instance>", "<instance>",
"Recreate an instance's disks"), "Recreate an instance's disks"),
'grow-disk': (GrowDisk, 'grow-disk': (GrowDisk,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment