[libvirt] [PATCH] virsh: Forbid usage of --memspec and --disk-only together

Peter Krempa pkrempa at redhat.com
Fri Jan 25 10:56:16 UTC 2013


virsh snapshot-create-as with --memspec and --disk only fails at the
qemu driver. Forbid the creation at virsh too and document it.
---
 tools/virsh-snapshot.c | 6 ++++++
 tools/virsh.pod        | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index e4745d6..86fd1fd 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -457,6 +457,12 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
         goto cleanup;
     }

+    if (memspec && (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)) {
+        vshError(ctl, "%s",
+                 _("Can't combine disk only snapshots with --memspec"));
+        goto cleanup;
+    }
+
     if (memspec && vshParseSnapshotMemspec(ctl, &buf, memspec) < 0)
         goto cleanup;

diff --git a/tools/virsh.pod b/tools/virsh.pod
index e2a2aec..c5cf16c 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -2746,7 +2746,8 @@ The I<--memspec> option can be used to control whether a checkpoint
 is internal or external.  The I<--memspec> flag is mandatory, followed
 by a B<memspec> of the form B<[file=]name[,snapshot=type]>, where
 type can be B<none>, B<internal>, or B<external>.  To include a literal
-comma in B<file=name>, escape it with a second comma.
+comma in B<file=name>, escape it with a second comma. I<--memspec> cannot
+be used together with I<--disk-only>.

 The I<--diskspec> option can be used to control how I<--disk-only> and
 external checkpoints create external files.  This option can occur
-- 
1.8.1.1




More information about the libvir-list mailing list