[libvirt] [PATCH 2/5] qemu: block commit: Don't overwrite error when rolling back disk labels

Peter Krempa posted 5 patches 8 years, 7 months ago
[libvirt] [PATCH 2/5] qemu: block commit: Don't overwrite error when rolling back disk labels
Posted by Peter Krempa 8 years, 7 months ago
Calls to qemuDomainDiskChainElementPrepare resets the original error,
thus we need to save it in the cleanup path of qemuDomainBlockCommit.
---
 src/qemu/qemu_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0cf4aaa95..4f62c1a7a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17270,10 +17270,16 @@ qemuDomainBlockCommit(virDomainPtr dom,

  endjob:
     if (ret < 0 && clean_access) {
+        virErrorPtr orig_err = virSaveLastError();
         /* Revert access to read-only, if possible.  */
         qemuDomainDiskChainElementPrepare(driver, vm, baseSource, true);
         if (top_parent && top_parent != disk->src)
             qemuDomainDiskChainElementPrepare(driver, vm, top_parent, true);
+
+        if (orig_err) {
+            virSetError(orig_err);
+            virFreeError(orig_err);
+        }
     }
     virStorageSourceFree(mirror);
     qemuDomainObjEndJob(driver, vm);
-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/5] qemu: block commit: Don't overwrite error when rolling back disk labels
Posted by Pavel Hrdina 8 years, 7 months ago
On Tue, Jun 20, 2017 at 12:56:53PM +0200, Peter Krempa wrote:
> Calls to qemuDomainDiskChainElementPrepare resets the original error,
> thus we need to save it in the cleanup path of qemuDomainBlockCommit.
> ---
>  src/qemu/qemu_driver.c | 6 ++++++
>  1 file changed, 6 insertions(+)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list