]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: snapshot: Reject internal active snapshot without memory state
authorPeter Krempa <pkrempa@redhat.com>
Thu, 29 May 2014 08:52:57 +0000 (10:52 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 29 May 2014 15:00:11 +0000 (17:00 +0200)
A internal snapshot of a active VM with the memory snapshot disabled
explicitly would actually still take the memory snapshot. Reject it
explicitly.

Before:
 $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=no
 Domain snapshot 1401353155 created

After:
 $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=no
 error: Operation not supported: internal snapshot of a running VM must include the memory state

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1083345

src/qemu/qemu_driver.c

index 9becc0a1b404941e85b3b94d17ccb719882fc661..272687d3ba1e44620cef4ded53bd12c0d5e5ac8f 100644 (file)
@@ -13495,6 +13495,15 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
             align_match = false;
         } else {
             def->state = virDomainObjGetState(vm, NULL);
+
+            if (virDomainObjIsActive(vm) &&
+                def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE) {
+                virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                               _("internal snapshot of a running VM "
+                                 "must include the memory state"));
+                goto cleanup;
+            }
+
             def->memory = (def->state == VIR_DOMAIN_SHUTOFF ?
                            VIR_DOMAIN_SNAPSHOT_LOCATION_NONE :
                            VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL);