render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
43fe83
From bfaf4b3a5bb4bc74d089d5230cdd1e83622f9239 Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <bfaf4b3a5bb4bc74d089d5230cdd1e83622f9239.1379597659.git.jdenemar@redhat.com>
43fe83
From: Peter Krempa <pkrempa@redhat.com>
43fe83
Date: Tue, 17 Sep 2013 10:19:32 +0200
43fe83
Subject: [PATCH] qemu: Fix checking of ABI stability when restoring external
43fe83
 checkpoints
43fe83
43fe83
External checkpoints have a bug in the implementation where they use the
43fe83
normal definition instead of the "migratable" one. This causes errors
43fe83
when the snapshot is being reverted using the workaround method via
43fe83
qemuDomainRestoreFlags() with a custom XML. This issue was introduced
43fe83
when commit 07966f6a8b5ccb5bb4c716b25deb8ba2e572cc67 changed the code to
43fe83
compare "migratable" XMLs from the user as we should have used
43fe83
migratable in the image too.
43fe83
43fe83
This patch adds a compatibility layer, so that fixing the snapshot code
43fe83
won't make existing snapshots fail to load.
43fe83
43fe83
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1008340
43fe83
(cherry picked from commit 59898a88ce8431bd3ea249b8789edc2ef9985827)
43fe83
---
43fe83
 src/qemu/qemu_driver.c | 23 ++++++++++++++++++++---
43fe83
 1 file changed, 20 insertions(+), 3 deletions(-)
43fe83
43fe83
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
43fe83
index 86a1d6d..9b9732d 100644
43fe83
--- a/src/qemu/qemu_driver.c
43fe83
+++ b/src/qemu/qemu_driver.c
43fe83
@@ -5312,14 +5312,31 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
43fe83
             goto error;
43fe83
 
43fe83
         newdef = qemuDomainDefCopy(driver, def2, VIR_DOMAIN_XML_MIGRATABLE);
43fe83
-        virDomainDefFree(def2);
43fe83
-        if (!newdef)
43fe83
+        if (!newdef) {
43fe83
+            virDomainDefFree(def2);
43fe83
             goto error;
43fe83
+        }
43fe83
 
43fe83
         if (!virDomainDefCheckABIStability(def, newdef)) {
43fe83
             virDomainDefFree(newdef);
43fe83
-            goto error;
43fe83
+            virResetLastError();
43fe83
+
43fe83
+            /* Due to a bug in older version of external snapshot creation
43fe83
+             * code, the XML saved in the save image was not a migratable
43fe83
+             * XML. To ensure backwards compatibility with the change of the
43fe83
+             * saved XML type, we need to check the ABI compatibility against
43fe83
+             * the user provided XML if the check against the migratable XML
43fe83
+             * fails. Snapshots created prior to v1.1.3 have this issue. */
43fe83
+            if (!virDomainDefCheckABIStability(def, def2)) {
43fe83
+                virDomainDefFree(def2);
43fe83
+                goto error;
43fe83
+            }
43fe83
+
43fe83
+            /* use the user provided XML */
43fe83
+            newdef = def2;
43fe83
+            def2 = NULL;
43fe83
         }
43fe83
+
43fe83
         virDomainDefFree(def);
43fe83
         def = newdef;
43fe83
     }
43fe83
-- 
43fe83
1.8.3.2
43fe83