From 4eb62659f1e5d57a05f9e1175b69547f5ffee3b4 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 17 Sep 2009 11:07:23 +0200 Subject: [PATCH] =?UTF-8?q?Unify=20the=20=E2=80=9C--iallocator=E2=80=9D=20?= =?UTF-8?q?option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch also changes the gnt-debug's β--algorithmβ into IALLOCATOR_OPT, since it was the only non-standard use of this (due to historical reasons). Since it's just a debug option, backwards-compatibility is not critical here. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- lib/cli.py | 7 +++++++ scripts/gnt-backup | 5 +---- scripts/gnt-debug | 5 +---- scripts/gnt-instance | 13 ++----------- scripts/gnt-node | 8 +------- 5 files changed, 12 insertions(+), 26 deletions(-) diff --git a/lib/cli.py b/lib/cli.py index 949903f18..180aa2735 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 d1591329b..8985c8a7f 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 80ea6c188..d31d082f8 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 321bf207e..7aa4ad4d9 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 ed667ba6b..d68e1b8d0 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" -- GitLab