qemuDomainObjPrivatePtr priv = obj->privateData;
if (asyncJob != QEMU_ASYNC_JOB_NONE) {
- if (qemuDomainObjBeginNestedJob(driver, obj, asyncJob) < 0)
- return -1;
+ int ret;
+ if ((ret = qemuDomainObjBeginNestedJob(driver, obj, asyncJob)) < 0)
+ return ret;
if (!virDomainObjIsActive(obj)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("domain is no longer running"));
* with the same asyncJob.
*
* Returns 0 if job was started, in which case this must be followed with
- * qemuDomainObjExitMonitor(); or -1 if the job could not be
- * started (probably because the vm exited in the meantime).
+ * qemuDomainObjExitMonitor(); -2 if waiting for the nested job times out;
+ * or -1 if the job could not be started (probably because the vm exited
+ * in the meantime).
*/
int
qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
ret = qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob);
if (ret < 0) {
- /* Guest already exited; nothing further to update. */
- return -1;
+ /* Guest already exited or waiting for the job timed out; nothing
+ * further to update. */
+ return ret;
}
ret = qemuMonitorGetMigrationStatus(priv->mon, &status);
/* Poll every 50ms for progress & to allow cancellation */
struct timespec ts = { .tv_sec = 0, .tv_nsec = 50 * 1000 * 1000ull };
- if (qemuMigrationUpdateJobStatus(driver, vm, job, asyncJob) < 0)
+ if (qemuMigrationUpdateJobStatus(driver, vm, job, asyncJob) == -1)
goto cleanup;
/* cancel migration if disk I/O error is emitted while migrating */