From 460d22beb5510e43e7914ca4e491abb7897e8db5 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 14 Dec 2009 17:51:31 +0100 Subject: [PATCH] Command line/RAPI support for --no-name-check This patch adds --no-name-check to gnt-instance add and gnt-backup import. This is opposite to the opcode parameter (name_check) as it is similar to ip_check and start. It also adds it to RAPI and gnt-instance batch-create as a parameter in the input (JSON-formatted) file. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- lib/cli.py | 7 +++++++ lib/rapi/rlib2.py | 1 + scripts/gnt-backup | 1 + scripts/gnt-instance | 4 +++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/cli.py b/lib/cli.py index 752546b17..17d173e46 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -82,6 +82,7 @@ __all__ = [ "NODE_PLACEMENT_OPT", "NOHDR_OPT", "NOIPCHECK_OPT", + "NONAMECHECK_OPT", "NOLVM_STORAGE_OPT", "NOMODIFY_ETCHOSTS_OPT", "NOMODIFY_SSH_SETUP_OPT", @@ -597,6 +598,11 @@ NOIPCHECK_OPT = cli_option("--no-ip-check", dest="ip_check", default=True, help="Don't check that the instance's IP" " is alive") +NONAMECHECK_OPT = cli_option("--no-name-check", dest="name_check", + default=True, action="store_false", + help="Don't check that the instance's name" + " is resolvable") + NET_OPT = cli_option("--net", help="NIC parameters", default=[], dest="nics", action="append", type="identkeyval") @@ -1467,6 +1473,7 @@ def GenericInstanceCreate(mode, opts, args): nics=nics, pnode=pnode, snode=snode, ip_check=opts.ip_check, + name_check=opts.name_check, wait_for_sync=opts.wait_for_sync, file_storage_dir=opts.file_storage_dir, file_driver=opts.file_driver, diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py index 669bae4c4..48a52c68d 100644 --- a/lib/rapi/rlib2.py +++ b/lib/rapi/rlib2.py @@ -464,6 +464,7 @@ class R_2_instances(baserlib.R_Generic): nics=nics, start=fn('start', True), ip_check=fn('ip_check', True), + name_check=fn('name_check', True), wait_for_sync=True, hypervisor=fn('hypervisor', None), hvparams=hvparams, diff --git a/scripts/gnt-backup b/scripts/gnt-backup index a07335651..986b449c2 100755 --- a/scripts/gnt-backup +++ b/scripts/gnt-backup @@ -137,6 +137,7 @@ import_opts = [ SRC_DIR_OPT, SRC_NODE_OPT, NOIPCHECK_OPT, + NONAMECHECK_OPT, IALLOCATOR_OPT, FILESTORE_DIR_OPT, FILESTORE_DRIVER_OPT, diff --git a/scripts/gnt-instance b/scripts/gnt-instance index 44b84101b..d32b25407 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -318,7 +318,6 @@ def AddInstance(opts, args): """ return GenericInstanceCreate(constants.INSTANCE_CREATE, opts, args) - return 0 def BatchCreate(opts, args): @@ -357,6 +356,7 @@ def BatchCreate(opts, args): "nics": None, "start": True, "ip_check": True, + "name_check": True, "hypervisor": None, "hvparams": {}, "file_storage_dir": None, @@ -453,6 +453,7 @@ def BatchCreate(opts, args): nics=tmp_nics, start=specs['start'], ip_check=specs['ip_check'], + name_check=specs['name_check'], wait_for_sync=True, iallocator=specs['iallocator'], hypervisor=hypervisor, @@ -1280,6 +1281,7 @@ add_opts = [ NET_OPT, NODE_PLACEMENT_OPT, NOIPCHECK_OPT, + NONAMECHECK_OPT, NONICS_OPT, NOSTART_OPT, NWSYNC_OPT, -- GitLab