]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Fix checking of guest ABI compatibility when reverting snapshots
authorPeter Krempa <pkrempa@redhat.com>
Thu, 12 Sep 2013 09:37:57 +0000 (11:37 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 12 Sep 2013 13:11:38 +0000 (15:11 +0200)
When reverting a live internal snapshot with a live guest the ABI
compatiblity check was comparing a "migratable" definition with a normal
one. This resulted in the check failing with:

revert requires force: Target device address type none does not match source pci

This patch generates a "migratable" definition from the actual one to
check against the definition from the snapshot to avoid this problem.

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

src/qemu/qemu_driver.c

index bbf2d23bb06f6ab82b850d2fa7049c3f916f12b2..ae1948f15a837e5bcdc398394487f16ce23ff40f 100644 (file)
@@ -13037,6 +13037,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
     qemuDomainObjPrivatePtr priv;
     int rc;
     virDomainDefPtr config = NULL;
+    virDomainDefPtr migratableDef = NULL;
     virQEMUDriverConfigPtr cfg = NULL;
     virCapsPtr caps = NULL;
 
@@ -13151,8 +13152,13 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
          * to have finer control.  */
         if (virDomainObjIsActive(vm)) {
             /* Transitions 5, 6, 8, 9 */
-            /* Check for ABI compatibility.  */
-            if (config && !virDomainDefCheckABIStability(vm->def, config)) {
+            /* Check for ABI compatibility. We need to do this check against
+             * the migratable XML or it will always fail otherwise */
+            if (!(migratableDef = qemuDomainDefCopy(driver, vm->def,
+                                                    VIR_DOMAIN_XML_MIGRATABLE)))
+                goto cleanup;
+
+            if (config && !virDomainDefCheckABIStability(migratableDef, config)) {
                 virErrorPtr err = virGetLastError();
 
                 if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) {
@@ -13357,6 +13363,7 @@ cleanup:
     }
     if (vm)
         virObjectUnlock(vm);
+    virDomainDefFree(migratableDef);
     virObjectUnref(caps);
     virObjectUnref(cfg);