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