On 12/02/2014 03:32 PM, 'Klaus Aehlig' via ganeti-devel wrote:
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,


LGTM

--
Niklas Hambüchen
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores

Reply via email to