render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
43fe83
From d82d81f40afed3eb75a7e0b6ebf1e35186f5cf50 Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <d82d81f40afed3eb75a7e0b6ebf1e35186f5cf50.1379193141.git.jdenemar@redhat.com>
43fe83
From: Peter Krempa <pkrempa@redhat.com>
43fe83
Date: Thu, 12 Sep 2013 16:16:31 +0200
43fe83
Subject: [PATCH] qemu: Fix checking of guest ABI compatibility when reverting
43fe83
 snapshots
43fe83
43fe83
When reverting a live internal snapshot with a live guest the ABI
43fe83
compatiblity check was comparing a "migratable" definition with a normal
43fe83
one. This resulted in the check failing with:
43fe83
43fe83
revert requires force: Target device address type none does not match source pci
43fe83
43fe83
This patch generates a "migratable" definition from the actual one to
43fe83
check against the definition from the snapshot to avoid this problem.
43fe83
43fe83
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1006886
43fe83
(cherry picked from commit 53c39f5837a6eed543465a7a55690786d0655ad0)
43fe83
---
43fe83
 src/qemu/qemu_driver.c | 11 +++++++++--
43fe83
 1 file changed, 9 insertions(+), 2 deletions(-)
43fe83
43fe83
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
43fe83
index 995fe76..86a1d6d 100644
43fe83
--- a/src/qemu/qemu_driver.c
43fe83
+++ b/src/qemu/qemu_driver.c
43fe83
@@ -13266,6 +13266,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
43fe83
     qemuDomainObjPrivatePtr priv;
43fe83
     int rc;
43fe83
     virDomainDefPtr config = NULL;
43fe83
+    virDomainDefPtr migratableDef = NULL;
43fe83
     virQEMUDriverConfigPtr cfg = NULL;
43fe83
     virCapsPtr caps = NULL;
43fe83
 
43fe83
@@ -13380,8 +13381,13 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
43fe83
          * to have finer control.  */
43fe83
         if (virDomainObjIsActive(vm)) {
43fe83
             /* Transitions 5, 6, 8, 9 */
43fe83
-            /* Check for ABI compatibility.  */
43fe83
-            if (config && !virDomainDefCheckABIStability(vm->def, config)) {
43fe83
+            /* Check for ABI compatibility. We need to do this check against
43fe83
+             * the migratable XML or it will always fail otherwise */
43fe83
+            if (!(migratableDef = qemuDomainDefCopy(driver, vm->def,
43fe83
+                                                    VIR_DOMAIN_XML_MIGRATABLE)))
43fe83
+                goto cleanup;
43fe83
+
43fe83
+            if (config && !virDomainDefCheckABIStability(migratableDef, config)) {
43fe83
                 virErrorPtr err = virGetLastError();
43fe83
 
43fe83
                 if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) {
43fe83
@@ -13586,6 +13592,7 @@ cleanup:
43fe83
     }
43fe83
     if (vm)
43fe83
         virObjectUnlock(vm);
43fe83
+    virDomainDefFree(migratableDef);
43fe83
     virObjectUnref(caps);
43fe83
     virObjectUnref(cfg);
43fe83
 
43fe83
-- 
43fe83
1.8.3.2
43fe83