---
lib/cli.py | 5 +++++
scripts/gnt-backup | 5 +----
scripts/gnt-instance | 12 +-----------
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/lib/cli.py b/lib/cli.py
index f242a4a..7a53ffe 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -71,6 +71,7 @@ __all__ = [
"OS_OPT",
"OS_SIZE_OPT",
"SEP_OPT",
+ "SINGLE_NODE_OPT",
"SUBMIT_OPT",
"SYNC_OPT",
"TAG_SRC_OPT",
@@ -587,6 +588,10 @@ NODE_LIST_OPT = cli_option("-n", "--node", dest="nodes",
default=[],
" times, if not given defaults to all nodes)",
completion_suggest=OPT_COMPL_ONE_NODE)
+SINGLE_NODE_OPT = cli_option("-n", "--node", dest="node", help="Target node",
+ metavar="<node>",
+ completion_suggest=OPT_COMPL_ONE_NODE)
+
def _ParseArgs(argv, commands, aliases):
"""Parser for the command line arguments.
diff --git a/scripts/gnt-backup b/scripts/gnt-backup
index 5f5bff9..d9bda09 100755
--- a/scripts/gnt-backup
+++ b/scripts/gnt-backup
@@ -236,10 +236,7 @@ commands = {
[DEBUG_OPT, NODE_LIST_OPT],
"", "Lists instance exports available in the ganeti cluster"),
'export': (ExportInstance, ARGS_ONE_INSTANCE,
- [DEBUG_OPT, FORCE_OPT,
- cli_option("-n", "--node", dest="node", help="Target node",
- metavar="<node>",
- completion_suggest=OPT_COMPL_ONE_NODE),
+ [DEBUG_OPT, FORCE_OPT, SINGLE_NODE_OPT,
cli_option("","--noshutdown", dest="shutdown",
action="store_false", default=True,
help="Don't shutdown the instance (unsafe)"), ],
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index d0593e2..69c53bd 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -1328,11 +1328,6 @@ def SetInstanceParams(opts, args):
return 0
-# options used in more than one cmd
-node_opt = cli_option("-n", "--node", dest="node", help="Target node",
- metavar="<node>",
- completion_suggest=OPT_COMPL_ONE_NODE)
-
# multi-instance selection options
m_force_multi = cli_option("--force-multiple", dest="force_multi",
help="Do not ask for confirmation when more than"
@@ -1418,12 +1413,7 @@ commands = {
"Migrate instance to its secondary node"
" (only for instances of type drbd)"),
'move': (MoveInstance, ARGS_ONE_INSTANCE,
- [DEBUG_OPT, FORCE_OPT, SUBMIT_OPT,
- cli_option("-n", "--new-node", dest="target_node",
- help="Destinattion node", metavar="NODE",
- default=None,
- completion_suggest=OPT_COMPL_ONE_NODE),
- ],
+ [DEBUG_OPT, FORCE_OPT, SUBMIT_OPT, SINGLE_NODE_OPT],
"[-f] <instance>",
"Move instance to an arbitrary node"
" (only for instances of type file and lv)"),
--
1.6.3.3