mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemu: Use domain condition for asyncAbort
To avoid polling for asyncAbort flag changes. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
e8f263e0d0
commit
d814c70b3b
@ -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"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user