]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainSaveImageUpdateDef: Don't overwrite errors from virDomainDefCheckABIStability
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 3 Mar 2017 09:45:31 +0000 (10:45 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 8 Mar 2017 09:09:15 +0000 (10:09 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1379200

When we are restoring a domain from a saved image, or just
updating its XML in the saved image - we have to make sure that
the ABI guests sees will not change. We have a function for that
which reports errors. But for some reason if this function fails,
we call it again with slightly different argument. Therefore it
might happen that we overwrite the original error and leave user
with less helpful one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_driver.c

index 639db74085024f2a7f36d8c8994340ccd0ee8067..2032fac71da621ed763fce1ea1ce4674ef2ec91b 100644 (file)
@@ -6107,7 +6107,7 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver,
         goto cleanup;
 
     if (!virDomainDefCheckABIStability(def, newdef_migr)) {
-        virResetLastError();
+        virErrorPtr err = virSaveLastError();
 
         /* Due to a bug in older version of external snapshot creation
          * code, the XML saved in the save image was not a migratable
@@ -6115,8 +6115,12 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver,
          * saved XML type, we need to check the ABI compatibility against
          * the user provided XML if the check against the migratable XML
          * fails. Snapshots created prior to v1.1.3 have this issue. */
-        if (!virDomainDefCheckABIStability(def, newdef))
+        if (!virDomainDefCheckABIStability(def, newdef)) {
+            virSetError(err);
+            virFreeError(err);
             goto cleanup;
+        }
+        virFreeError(err);
 
         /* use the user provided XML */
         ret = newdef;