提交 d814c70b 编写于 作者: J Jiri Denemark

qemu: Use domain condition for asyncAbort

To avoid polling for asyncAbort flag changes.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 e8f263e0
......@@ -169,7 +169,7 @@ qemuDomainObjResetAsyncJob(qemuDomainObjPrivatePtr priv)
job->phase = 0;
job->mask = QEMU_JOB_DEFAULT_MASK;
job->dump_memory_only = false;
job->asyncAbort = false;
job->abortJob = false;
VIR_FREE(job->current);
}
......@@ -1652,7 +1652,8 @@ qemuDomainObjAbortAsyncJob(virDomainObjPtr obj)
qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
obj, obj->def->name);
priv->job.asyncAbort = true;
priv->job.abortJob = true;
virDomainObjBroadcast(obj);
}
/*
......
......@@ -135,7 +135,7 @@ struct qemuDomainJobObj {
bool dump_memory_only; /* use dump-guest-memory to do dump */
qemuDomainJobInfoPtr current; /* async job progress data */
qemuDomainJobInfoPtr completed; /* statistics data of a recently completed job */
bool asyncAbort; /* abort of async job requested */
bool abortJob; /* abort of the job requested */
};
typedef void (*qemuDomainCleanupCallback)(virQEMUDriverPtr driver,
......
......@@ -2084,12 +2084,10 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
}
while ((rv = qemuMigrationDriveMirrorReady(driver, vm)) != 1) {
unsigned long long now;
if (rv < 0)
goto cleanup;
if (priv->job.asyncAbort) {
if (priv->job.abortJob) {
priv->job.current->type = VIR_DOMAIN_JOB_CANCELLED;
virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"),
qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
......@@ -2097,8 +2095,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
goto cleanup;
}
if (virTimeMillisNow(&now) < 0 ||
virDomainObjWaitUntil(vm, now + 500) < 0)
if (virDomainObjWait(vm) < 0)
goto cleanup;
}
......@@ -4154,10 +4151,10 @@ qemuMigrationRun(virQEMUDriverPtr driver,
QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
goto cleanup;
if (priv->job.asyncAbort) {
if (priv->job.abortJob) {
/* explicitly do this *after* we entered the monitor,
* as this is a critical section so we are guaranteed
* priv->job.asyncAbort will not change */
* priv->job.abortJob will not change */
ignore_value(qemuDomainObjExitMonitor(driver, vm));
priv->job.current->type = VIR_DOMAIN_JOB_CANCELLED;
virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册