]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: snapshot: Forbid empty snapshots
authorPeter Krempa <pkrempa@redhat.com>
Tue, 20 May 2014 12:22:25 +0000 (14:22 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 20 May 2014 17:28:10 +0000 (19:28 +0200)
If neither disks nor memory are selected for snapshot we'd record
metadata in case of external snapshot and do a disk snapshot in case of
external disk snapshot. Forbid this as it doesn't make much sense.

src/qemu/qemu_driver.c

index 936e7bda3d2298c9b3d3971b9e778fa285e66b84..9dbfc0798f7582632e4bb556af8b3df150c2d728 100644 (file)
@@ -12703,6 +12703,13 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
         }
     }
 
+    if (!found_internal && !external &&
+        def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("nothing selected for snapshot"));
+        goto cleanup;
+    }
+
     /* internal snapshot requires a disk image to store the memory image to, and
      * also disks can't be excluded from an internal snapshot*/
     if ((def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL && !found_internal) ||