]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: checkpoint: Enforce that 'bitmap' name must match checkpoint name
authorPeter Krempa <pkrempa@redhat.com>
Wed, 18 Sep 2019 12:48:57 +0000 (14:48 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 24 Oct 2019 17:35:34 +0000 (19:35 +0200)
Prevent insane configurations by enforcing that disk bitmap for a
checkpoint must match the name of the checkpoint.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_checkpoint.c

index 4a618f52367b8d6ecfd8acc2f3387c3cf1674ec8..3abbab1514e30e748192a70470b872812e4bc0d1 100644 (file)
@@ -270,6 +270,13 @@ qemuCheckpointPrepare(virQEMUDriverPtr driver,
         if (disk->type != VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP)
             continue;
 
+        if (STRNEQ(disk->bitmap, def->parent.name)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("bitmap for disk '%s' must match checkpoint name '%s'"),
+                           disk->name, def->parent.name);
+            goto cleanup;
+        }
+
         if (vm->def->disks[i]->src->format != VIR_STORAGE_FILE_QCOW2) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("checkpoint for disk %s unsupported "