[libvirt] [PATCH] qemuDomainSaveImageUpdateDef: Don't overwrite errors from virDomainDefCheckABIStability

Michal Privoznik posted 1 patch 169 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/df68237991e3305a5877d25d2579fdca3dd2ff71.1488534941.git.mprivozn@redhat.com
src/qemu/qemu_driver.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

[libvirt] [PATCH] qemuDomainSaveImageUpdateDef: Don't overwrite errors from virDomainDefCheckABIStability

Posted by Michal Privoznik 169 weeks ago
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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 77d81755a..2bef0f200 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6109,7 +6109,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
@@ -6117,8 +6117,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;
-- 
2.11.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemuDomainSaveImageUpdateDef: Don't overwrite errors from virDomainDefCheckABIStability

Posted by John Ferlan 168 weeks ago

On 03/03/2017 04:55 AM, Michal Privoznik wrote:
> 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 | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 

ACK

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list