Commit 460d22be authored by Iustin Pop's avatar Iustin Pop
Browse files

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: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 5f23e043
......@@ -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,
......
......@@ -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,
......
......@@ -137,6 +137,7 @@ import_opts = [
SRC_DIR_OPT,
SRC_NODE_OPT,
NOIPCHECK_OPT,
NONAMECHECK_OPT,
IALLOCATOR_OPT,
FILESTORE_DIR_OPT,
FILESTORE_DRIVER_OPT,
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment