From: Peter Krempa Date: Mon, 11 Feb 2013 13:06:08 +0000 (+0100) Subject: virsh-snapshot: Reject --no-metadata together with --print-xml X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=fe69656ea9e8d77aa68759f8c1fe85f710380149;p=libvirt.git virsh-snapshot: Reject --no-metadata together with --print-xml Manual for "virsh snapshot-create-as" states that --no-metadata and --print-xml are incompatible. Honor this detail in the code. --- diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index fe1cee9aec..d9659d48df 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -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"))