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

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

On 01/25/2013 03:56 AM, Peter Krempa wrote:
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(-)
For testing purposes, allowing invalid combinations all the way down to qemu_driver.c is useful to make sure the driver behaves right. But I suppose it is okay to make this change in virsh, for a friendlier error message. It may be worth listing the before-and-after error messages in the commit message, to show how it helps. ACK -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Peter Krempa