This is a special job for operations that need to modify domain state
during an active migration. The modification must not affect any state
that could conflict with the migration code. This is useful mainly for
event handlers that need to be processed during migration and which
could otherwise time out on acquiring a normal MODIFY job.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
Version 2:
- new patch
src/hypervisor/domain_job.c | 1 +
src/hypervisor/domain_job.h | 4 ++++
src/qemu/qemu_migration.c | 1 +
src/qemu/qemu_process.c | 7 +++++++
4 files changed, 13 insertions(+)
diff --git a/src/hypervisor/domain_job.c b/src/hypervisor/domain_job.c
index 49867c3982..191dc1c700 100644
--- a/src/hypervisor/domain_job.c
+++ b/src/hypervisor/domain_job.c
@@ -18,6 +18,7 @@ VIR_ENUM_IMPL(virDomainJob,
"modify",
"abort",
"migration operation",
+ "migration safe",
"none", /* async job is never stored in job.active */
"async nested",
);
diff --git a/src/hypervisor/domain_job.h b/src/hypervisor/domain_job.h
index fce35ffbf5..24bb93c59f 100644
--- a/src/hypervisor/domain_job.h
+++ b/src/hypervisor/domain_job.h
@@ -31,6 +31,10 @@ typedef enum {
VIR_JOB_MODIFY, /* May change state */
VIR_JOB_ABORT, /* Abort current async job */
VIR_JOB_MIGRATION_OP, /* Operation influencing outgoing migration */
+ VIR_JOB_MIGRATION_SAFE, /* Internal only job for event handlers which need
+ to be processed even during migration. The code
+ may only change state in a way that does not
+ affect migration. */
/* The following two items must always be the last items before JOB_LAST */
VIR_JOB_ASYNC, /* Asynchronous job */
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 4bf942e6ab..0314fb1148 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -127,6 +127,7 @@ qemuMigrationJobStart(virQEMUDriver *driver,
JOB_MASK(VIR_JOB_SUSPEND) |
JOB_MASK(VIR_JOB_MIGRATION_OP);
}
+ mask |= JOB_MASK(VIR_JOB_MIGRATION_SAFE);
if (qemuDomainObjBeginAsyncJob(driver, vm, job, op, apiFlags) < 0)
return -1;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 8a98c03395..ad529dabb4 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3472,6 +3472,7 @@ qemuProcessRestoreMigrationJob(virDomainObj *vm,
op = VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT;
allowedJobs = VIR_JOB_DEFAULT_MASK | JOB_MASK(VIR_JOB_MIGRATION_OP);
}
+ allowedJobs |= JOB_MASK(VIR_JOB_MIGRATION_SAFE);
qemuDomainObjRestoreAsyncJob(vm, job->asyncJob, job->phase,
job->asyncStarted, op,
@@ -3834,6 +3835,12 @@ qemuProcessRecoverJob(virQEMUDriver *driver,
*/
break;
+ case VIR_JOB_MIGRATION_SAFE:
+ /* event handlers, the reconnection code already handles them as we
+ * might as well just missed the event while we were not running
+ */
+ break;
+
case VIR_JOB_MIGRATION_OP:
case VIR_JOB_ABORT:
case VIR_JOB_ASYNC:
--
2.35.1