Blob Blame History Raw
From d82d81f40afed3eb75a7e0b6ebf1e35186f5cf50 Mon Sep 17 00:00:00 2001
Message-Id: <d82d81f40afed3eb75a7e0b6ebf1e35186f5cf50.1379193141.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 12 Sep 2013 16:16:31 +0200
Subject: [PATCH] qemu: Fix checking of guest ABI compatibility when reverting
 snapshots

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
(cherry picked from commit 53c39f5837a6eed543465a7a55690786d0655ad0)
---
 src/qemu/qemu_driver.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 995fe76..86a1d6d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13266,6 +13266,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
     qemuDomainObjPrivatePtr priv;
     int rc;
     virDomainDefPtr config = NULL;
+    virDomainDefPtr migratableDef = NULL;
     virQEMUDriverConfigPtr cfg = NULL;
     virCapsPtr caps = NULL;
 
@@ -13380,8 +13381,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)) {
@@ -13586,6 +13592,7 @@ cleanup:
     }
     if (vm)
         virObjectUnlock(vm);
+    virDomainDefFree(migratableDef);
     virObjectUnref(caps);
     virObjectUnref(cfg);
 
-- 
1.8.3.2