diff --git a/lib/cli.py b/lib/cli.py index 949903f18cef54f959bdf8dc3d3ec74d0a68e23c..180aa2735be923cb46b13b67f714163158a92c0b 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -51,6 +51,7 @@ __all__ = [ "FIELDS_OPT", "FILESTORE_DIR_OPT", "FILESTORE_DRIVER_OPT", + "IALLOCATOR_OPT", "FORCE_OPT", "NOHDR_OPT", "NONICS_OPT", @@ -499,6 +500,12 @@ FILESTORE_DRIVER_OPT = cli_option("--file-driver", dest="file_driver", default="loop", metavar="<DRIVER>", choices=list(constants.FILE_DRIVER)) +IALLOCATOR_OPT = cli_option("-I", "--iallocator", metavar="<NAME>", + help="Select nodes for the instance automatically" + " using the <NAME> iallocator plugin", + default=None, type="string", + completion_suggest=OPT_COMPL_ONE_IALLOCATOR) + def _ParseArgs(argv, commands, aliases): """Parser for the command line arguments. diff --git a/scripts/gnt-backup b/scripts/gnt-backup index d1591329b29b275151ce7f111b3770cb5e7e88c7..8985c8a7f4b710fa487e568ed47105c8bebcf8a7 100755 --- a/scripts/gnt-backup +++ b/scripts/gnt-backup @@ -241,10 +241,7 @@ import_opts = [ cli_option("--no-ip-check", dest="ip_check", default=True, action="store_false", help="Don't check that the instance's IP" " is alive"), - cli_option("-I", "--iallocator", metavar="<NAME>", - help="Select nodes for the instance automatically using the" - " <NAME> iallocator plugin", default=None, type="string", - completion_suggest=OPT_COMPL_ONE_IALLOCATOR), + IALLOCATOR_OPT, FILESTORE_DIR_OPT, FILESTORE_DRIVER_OPT, cli_option("-H", "--hypervisor", dest="hypervisor", diff --git a/scripts/gnt-debug b/scripts/gnt-debug index 80ea6c18863e73e052f015b41dc5229cc08abbbe..d31d082f829f8872f9c8bd14030a80756ef531af 100755 --- a/scripts/gnt-debug +++ b/scripts/gnt-debug @@ -186,10 +186,7 @@ commands = { default="in", choices=["in", "out"], help="Show allocator input (in) or allocator" " results (out)"), - cli_option("--algorithm", dest="allocator", - default=None, - help="Allocator algorithm name", - completion_suggest=OPT_COMPL_ONE_IALLOCATOR), + IALLOCATOR_OPT, cli_option("-m", "--mode", default="relocate", choices=["relocate", "allocate"], help="Request mode, either allocate or" diff --git a/scripts/gnt-instance b/scripts/gnt-instance index 321bf207e68f059d95a02e397c5d90a4cfcf3d51..7aa4ad4d955566f97dcb4958d19042117ac292dd 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -1398,10 +1398,7 @@ add_opts = [ " is alive (only valid with --no-start)"), FILESTORE_DIR_OPT, FILESTORE_DRIVER_OPT, - cli_option("-I", "--iallocator", metavar="<NAME>", - help="Select nodes for the instance automatically using the" - " <NAME> iallocator plugin", default=None, type="string", - completion_suggest=OPT_COMPL_ONE_IALLOCATOR), + IALLOCATOR_OPT, cli_option("-H", "--hypervisor", dest="hypervisor", help="Hypervisor and hypervisor options, in the format" " hypervisor:option=value,option=value,...", default=None, @@ -1542,13 +1539,7 @@ commands = { help="Comma-separated list of disks" " indices to replace (e.g. 0,2) (optional," " defaults to all disks)"), - cli_option("-I", "--iallocator", metavar="<NAME>", - help="Select new secondary for the instance" - " automatically using the" - " <NAME> iallocator plugin (enables" - " secondary node replacement)", - default=None, type="string", - completion_suggest=OPT_COMPL_ONE_IALLOCATOR), + IALLOCATOR_OPT, SUBMIT_OPT, ], "[-s|-p|-n NODE|-I NAME] <instance>", diff --git a/scripts/gnt-node b/scripts/gnt-node index ed667ba6bd61bd058e77a8a43fe9b1af1a3856d5..d68e1b8d0be5f466d2e887a4c63c9d19e5f63a70 100755 --- a/scripts/gnt-node +++ b/scripts/gnt-node @@ -637,17 +637,11 @@ commands = { "[-s ip] [--readd] [--no-ssh-key-check] <node_name>", "Add a node to the cluster"), 'evacuate': (EvacuateNode, ARGS_ONE_NODE, - [DEBUG_OPT, FORCE_OPT, + [DEBUG_OPT, FORCE_OPT, IALLOCATOR_OPT, cli_option("-n", "--new-secondary", dest="dst_node", help="New secondary node", metavar="NODE", default=None, completion_suggest=OPT_COMPL_ONE_NODE), - cli_option("-I", "--iallocator", metavar="<NAME>", - help="Select new secondary for the instance" - " automatically using the" - " <NAME> iallocator plugin", - default=None, type="string", - completion_suggest=OPT_COMPL_ONE_IALLOCATOR), ], "[-f] {-I <iallocator> | -n <dst>} <node>", "Relocate the secondary instances from a node"