From c885b7fe1de1961391a117c033b4012a02cc8fca Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 20 Jun 2017 12:18:34 +0200 Subject: [PATCH] qemu: block commit: Don't overwrite error when rolling back disk labels 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 0cf4aaa957..4f62c1a7a1 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);