To avoid polling for asyncAbort flag changes.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
ACKed in version 2
Version 3:
- no change
Version 2:
- rewritten using domain condition
src/qemu/qemu_domain.c | 5 +++--
src/qemu/qemu_domain.h | 2 +-
src/qemu/qemu_migration.c | 11 ++++-------
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 68b6a95..25fa8d3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -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);
}
/*
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 9003c9b..a3c5015 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -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,
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index e0de09e..d82a5ba 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2058,12 +2058,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),
@@ -2071,8 +2069,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
goto cleanup;
}
- if (virTimeMillisNow(&now) < 0 ||
- virDomainObjWaitUntil(vm, now + 500) < 0)
+ if (virDomainObjWait(vm) < 0)
goto cleanup;
}
@@ -4069,10 +4066,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"),
--
2.4.3