[PATCH 3/3] qemu: Restore errors when rolling back disk image state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some operations done to rollback disk image labelling and locking might
overwrite (or clear) the actual error. Remember the original error when
tearing down disk access so that it's not obscured.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1461301
---
 src/qemu/qemu_hotplug.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 35d73f74e..7dd6e5fd9 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -94,6 +94,7 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver,
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
     int ret = -1;
     virStorageSourcePtr origsrc = NULL;
+    virErrorPtr orig_err = NULL;

     if (overridesrc) {
         origsrc = disk->src;
@@ -102,6 +103,7 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver,

     /* just tear down the disk access */
     if (teardown) {
+        virErrorPreserveLast(&orig_err);
         ret = 0;
         goto rollback_cgroup;
     }
@@ -145,6 +147,8 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver,
     if (origsrc)
         disk->src = origsrc;

+    virErrorRestore(&orig_err);
+
     virObjectUnref(cfg);

     return ret;
-- 
2.14.1

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux