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

Unify the “--iallocator” option



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: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 0f87c43e
......@@ -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.
......
......@@ -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",
......
......@@ -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"
......
......@@ -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>",
......
......@@ -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"
......
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