[libvirt] [PATCH 1/7] qemu: Save/restore error in error path for qemuDomainSaveInternal

John Ferlan jferlan at redhat.com
Wed Jan 28 22:25:00 UTC 2015


If we get to endjob: because of some error earlier such as perhaps
failure from qemuDomainSaveMemory to open/create the save file and
the attempt to restart the CPU's fails, then we get the error from
that restart attempt displayed to the user rather than the error
from the failed attempt to create a save file.

Upstream commit id '540c339a' changed the flow of the code moving
the EndAsyncJob call and thus exposing the issue where an error in
restarting CPUs resulted in the following:

error: Failed to save domain rhel70 to /tmp/pl/rhel70.save
error: internal error: unexpected async job 3

where /tmp/pl is a NFS root squashed client where the failure to save
the file (EPERM or ENOTCONN) should result in a failure:

error: Failed to save domain rhel70 to /tmp/pl/rhel70.save
error: Error from child process creating '/tmp/pl/rhel70.save': Transport endpoint is not connected

or (REVISIT ORDER - that is if I move the virfile check for ENOTCONN
to sooner, then we'll never see ENOTCONN)

error: Failed to save domain rhel70 to /tmp/pl/rhel70.save
error: Error from child process creating '/tmp/pl/rhel70.save': Operation not permitted
Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/qemu/qemu_driver.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1d3bee6..190d472 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3211,6 +3211,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
     qemuDomainObjEndAsyncJob(driver, vm);
     if (ret != 0) {
         if (was_running && virDomainObjIsActive(vm)) {
+            virErrorPtr save_err = virSaveLastError();
             rc = qemuProcessStartCPUs(driver, vm, dom->conn,
                                       VIR_DOMAIN_RUNNING_SAVE_CANCELED,
                                       QEMU_ASYNC_JOB_SAVE);
@@ -3220,6 +3221,8 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
                                                           VIR_DOMAIN_EVENT_SUSPENDED,
                                                           VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR);
             }
+            virSetError(save_err);
+            virFreeError(save_err);
         }
     } else if (!vm->persistent) {
         qemuDomainRemoveInactive(driver, vm);
-- 
2.1.0




More information about the libvir-list mailing list