From f36d7d8136e0a91f72bc330ae4efd012eb6a0df1 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 17 Sep 2009 13:20:22 +0200 Subject: [PATCH] =?UTF-8?q?Unify=20the=20last=20=E2=80=9C--node=E2=80=9D?= =?UTF-8?q?=20(single=20node)=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/cli.py | 5 +++++ scripts/gnt-backup | 5 +---- scripts/gnt-instance | 14 ++------------ 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/lib/cli.py b/lib/cli.py index f242a4ac1..7a53ffef3 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 5f5bff993..d9bda0901 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 d0593e265..bb88cf200 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -971,7 +971,7 @@ def MoveInstance(opts, args): return 1 op = opcodes.OpMoveInstance(instance_name=instance_name, - target_node=opts.target_node) + target_node=opts.node) SubmitOrSend(op, opts, cl=cl) return 0 @@ -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)"), -- GitLab