]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: snapshot: Forbid internal snapshots with pflash firmware
authorPeter Krempa <pkrempa@redhat.com>
Wed, 1 Mar 2017 08:15:33 +0000 (09:15 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 24 Mar 2017 13:38:25 +0000 (14:38 +0100)
If the variable store (<nvram>) file is raw qemu can't do a snapshot of
it and thus the snapshot fails. QEMU rejects such snapshot by a message
which would not be properly interpreted as an error by libvirt.

Additionally allowing to use a qcow2 variable store backing file would
solve this issue but then it would become eligible to become target of
the memory dump.

Offline internal snapshot would be incomplete too with either storage
format since libvirt does not handle the pflash file in this case.

Forbid such snapshot so that we can avoid problems.

src/qemu/qemu_driver.c

index 67629520805a7faa6239ce8ed94ac51de0cdddfa..4aba981a85c77067e7de422de915703dbc6ce8de 100644 (file)
@@ -13873,6 +13873,22 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
         goto cleanup;
     }
 
+    /* internal snapshots + pflash based loader have the following problems:
+     * - if the variable store is raw, the snapshot fails
+     * - alowing a qcow2 image as the varstore would make it eligible to receive
+     *   the vmstate dump, which would make it huge
+     * - offline snapshot would not snapshot the varstore at all
+     *
+     * Avoid the issues by forbidding internal snapshot with pflash completely.
+     */
+    if (found_internal &&
+        vm->def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("internal snapshots of a VM with pflash based "
+                         "firmware are not supported"));
+        goto cleanup;
+    }
+
     /* Alter flags to let later users know what we learned.  */
     if (external && !active)
         *flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY;