Commit id '
540c339a' to fix issues with reference counting and transient
domains moved the qemuDomainObjEndAsyncJob call prior to the attempt to
restart the guest CPU's resulting in an error:
error: Failed to save domain rhel70 to /tmp/pl/rhel70.save
error: internal error: unexpected async job 3
when (ret != 0) - eg, the error path from qemuDomainSaveMemory.
This patch will adjust the logic to call the EndAsyncJob only after
we've tried to restart the guest CPUs. It also needs to adjust the
test for qemuDomainRemoveInactive to add the ret == 0 condition.
Additionally, if we get to endjob: because of some error earlier, then
we need to save that error in the event the CPU restart logic fails.
We don't want to return the error from CPU restart failure, rather we
want to return the error from the failed save that caused us to fall
into the retry to start the CPU logic.
Signed-off-by: John Ferlan <jferlan@redhat.com>
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_SAVED);
endjob:
- 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);
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR);
}
+ virSetError(save_err);
+ virFreeError(save_err);
}
- } else if (!vm->persistent) {
- qemuDomainRemoveInactive(driver, vm);
}
+ qemuDomainObjEndAsyncJob(driver, vm);
+ if (ret == 0 && !vm->persistent)
+ qemuDomainRemoveInactive(driver, vm);
cleanup:
VIR_FREE(xml);