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.
---
lib/cli.py | 7 +++++++
lib/rapi/rlib2.py | 1 +
scripts/gnt-backup | 1 +
scripts/gnt-instance | 4 +++-
4 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/lib/cli.py b/lib/cli.py
index 752546b..17d173e 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 669bae4..48a52c6 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 a073356..986b449 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 44b8410..d32b254 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,
--
1.6.5.4