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.
---
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 949903f..180aa27 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 d159132..8985c8a 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 80ea6c1..d31d082 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 321bf20..7aa4ad4 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 ed667ba..d68e1b8 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"
--
1.6.3.3