In GenericInstanceCreate, verify that the forthcoming and commit
Options are not used simultaneously, and then pass on the commit
flag.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 lib/cli.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/cli.py b/lib/cli.py
index 256c09f..8cd4210 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -1288,6 +1288,12 @@ def GenericInstanceCreate(mode, opts, args):
   """
   instance = args[0]
   forthcoming = opts.ensure_value("forthcoming", False)
+  commit = opts.ensure_value("commit", False)
+
+  if forthcoming and commit:
+    raise errors.OpPrereqError("Creating an instance only forthcoming and"
+                               " commiting it are mutally exclusive",
+                               errors.ECODE_INVAL)
 
   (pnode, snode) = SplitNodeOption(opts.node)
 
@@ -1410,6 +1416,7 @@ def GenericInstanceCreate(mode, opts, args):
 
   op = opcodes.OpInstanceCreate(
     forthcoming=forthcoming,
+    commit=commit,
     instance_name=instance,
     disks=disks,
     disk_template=opts.disk_template,
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to