diff --git a/lib/cli.py b/lib/cli.py index f242a4ac1434a3e607bd7a2ba231b507942955b8..7a53ffef3acf55660632546fdeeea3a6f9ab5d98 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 5f5bff9935ed1d63a72c85721f4cf10611dd24aa..d9bda0901e3837fdcb241d481b5f30e562c12472 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 d0593e265945990f626a8d5f76a74e620b17453b..bb88cf20086ef2e6016748c4efacdc5a526c45f1 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)"),