diff --git a/lib/cli.py b/lib/cli.py index 3f4d938d8ace6977c62901564c21a131f8d7cb68..c81bf54858b81300fcc9d36e88589b21b3d886a4 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -58,6 +58,7 @@ __all__ = [ "IALLOCATOR_OPT", "FORCE_OPT", "NOHDR_OPT", + "NOIPCHECK_OPT", "NONICS_OPT", "NWSYNC_OPT", "OS_OPT", @@ -533,6 +534,12 @@ HVLIST_OPT = cli_option("-H", "--hypervisor-parameters", dest="hvparams", " format hypervisor:option=value,option=value,...", default=[], action="append", type="identkeyval") +NOIPCHECK_OPT = cli_option("--no-ip-check", dest="ip_check", default=True, + action="store_false", + help="Don't check that the instance's IP" + " is alive") + + def _ParseArgs(argv, commands, aliases): """Parser for the command line arguments. diff --git a/scripts/gnt-backup b/scripts/gnt-backup index ba52b395968672be803b40f1a1bd31730a6fb855..a1bb6e64b69dfdd1950473dec0357383cc980c0d 100755 --- a/scripts/gnt-backup +++ b/scripts/gnt-backup @@ -236,9 +236,7 @@ import_opts = [ completion_suggest=OPT_COMPL_ONE_NODE), cli_option("--src-dir", dest="src_dir", help="Source directory", metavar="<dir>"), - cli_option("--no-ip-check", dest="ip_check", default=True, - action="store_false", help="Don't check that the instance's IP" - " is alive"), + NOIPCHECK_OPT, IALLOCATOR_OPT, FILESTORE_DIR_OPT, FILESTORE_DRIVER_OPT, diff --git a/scripts/gnt-instance b/scripts/gnt-instance index 3a52ae927dd88967dfa359aafa731250aa25d261..d3c38951591565b094f5db9d1242f09e899d7bfa 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -1387,9 +1387,7 @@ add_opts = [ cli_option("--no-start", dest="start", default=True, action="store_false", help="Don't start the instance after" " creation"), - cli_option("--no-ip-check", dest="ip_check", default=True, - action="store_false", help="Don't check that the instance's IP" - " is alive (only valid with --no-start)"), + NOIPCHECK_OPT, FILESTORE_DIR_OPT, FILESTORE_DRIVER_OPT, IALLOCATOR_OPT, @@ -1499,13 +1497,7 @@ commands = { "[-f] <instance>", "Shuts down the instance and removes it"), 'rename': (RenameInstance, [ArgInstance(min=1, max=1), ArgHost(min=1, max=1)], - [DEBUG_OPT, - cli_option("--no-ip-check", dest="ignore_ip", - help="Do not check that the IP of the new name" - " is alive", - default=False, action="store_true"), - SUBMIT_OPT, - ], + [DEBUG_OPT, NOIPCHECK_OPT, SUBMIT_OPT], "<instance> <new_name>", "Rename the instance"), 'replace-disks': (ReplaceDisks, ARGS_ONE_INSTANCE, [DEBUG_OPT,