]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh-snapshot: Reject --no-metadata together with --print-xml
authorPeter Krempa <pkrempa@redhat.com>
Mon, 11 Feb 2013 13:06:08 +0000 (14:06 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 11 Feb 2013 13:50:20 +0000 (14:50 +0100)
Manual for "virsh snapshot-create-as" states that --no-metadata and
--print-xml are incompatible. Honor this detail in the code.

tools/virsh-snapshot.c

index fe1cee9aec6cf8627fba5daae846d9da91d198fe..d9659d48df3fe5a881068856a9c59b2c99e918e7 100644 (file)
@@ -412,8 +412,14 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
     unsigned int flags = 0;
     const vshCmdOpt *opt = NULL;
 
-    if (vshCommandOptBool(cmd, "no-metadata"))
+    if (vshCommandOptBool(cmd, "no-metadata")) {
+        if (vshCommandOptBool(cmd, "print-xml")) {
+            vshError(ctl, "%s",
+                     _("--print-xml is incompatible with --no-metadata"));
+            return false;
+        }
         flags |= VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA;
+    }
     if (vshCommandOptBool(cmd, "halt"))
         flags |= VIR_DOMAIN_SNAPSHOT_CREATE_HALT;
     if (vshCommandOptBool(cmd, "disk-only"))