diff --git a/lib/cli.py b/lib/cli.py index 7d69b7024b855d7ad3a4c0c29244fddd5781bc51..dd8f375d82e8215ab384adc55e0a1cc72f2a7e8f 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -49,6 +49,7 @@ __all__ = [ "DEBUG_OPT", "DEBUG_SIMERR_OPT", "DISK_TEMPLATE_OPT", + "DISK_OPT", "FIELDS_OPT", "FILESTORE_DIR_OPT", "FILESTORE_DRIVER_OPT", @@ -544,6 +545,9 @@ NET_OPT = cli_option("--net", help="NIC parameters", default=[], dest="nics", action="append", type="identkeyval") +DISK_OPT = cli_option("--disk", help="Disk parameters", default=[], + dest="disks", action="append", type="identkeyval") + def _ParseArgs(argv, commands, aliases): """Parser for the command line arguments. diff --git a/scripts/gnt-backup b/scripts/gnt-backup index cdcddac843f7d8dafa7794e4be9afcdee9c9046c..242de2ede1c5e70964aecee5b3a1914f214c890e 100755 --- a/scripts/gnt-backup +++ b/scripts/gnt-backup @@ -217,10 +217,7 @@ import_opts = [ completion_suggest=OPT_COMPL_INST_ADD_NODES), BACKEND_OPT, DISK_TEMPLATE_OPT, - cli_option("--disk", help="Disk information", - default=[], dest="disks", - action="append", - type="identkeyval"), + DISK_OPT, cli_option("-s", "--os-size", dest="sd_size", help="Disk size for a" " single-disk configuration, when not using the --disk option," " in MiB unless a suffix is used", diff --git a/scripts/gnt-instance b/scripts/gnt-instance index b042f0f2594e8be92b3fa46f2f10512a23a014e1..cd1e651f4a521c04a65a231f2d03149a70536a10 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -1374,10 +1374,7 @@ add_opts = [ " single-disk configuration, when not using the --disk option," " in MiB unless a suffix is used", default=None, type="unit", metavar="<size>"), - cli_option("--disk", help="Disk information", - default=[], dest="disks", - action="append", - type="identkeyval"), + DISK_OPT, NET_OPT, NONICS_OPT, NWSYNC_OPT, @@ -1525,16 +1522,8 @@ commands = { "[-s|-p|-n NODE|-I NAME] <instance>", "Replaces all disks for the instance"), 'modify': (SetInstanceParams, ARGS_ONE_INSTANCE, - [DEBUG_OPT, FORCE_OPT, - HVOPTS_OPT, - BACKEND_OPT, - cli_option("--disk", help="Disk changes", - default=[], dest="disks", - action="append", - type="identkeyval"), - NET_OPT, - SUBMIT_OPT, - ], + [BACKEND_OPT, DEBUG_OPT, DISK_OPT, FORCE_OPT, HVOPTS_OPT, + NET_OPT, SUBMIT_OPT], "<instance>", "Alters the parameters of an instance"), 'shutdown': (ShutdownInstance, [ArgInstance(min=1)], [DEBUG_OPT, m_node_opt, m_pri_node_opt, m_sec_node_opt,