diff --git a/src/hypervisor/domain_job.c b/src/hypervisor/domain_job.c index 49867c3982..5939d93e47 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", + "modify 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..30f950ec23 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_MODIFY_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 761cf3ce8d..341395ac6d 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_MODIFY_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..e53f7c9c79 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_MODIFY_MIGRATION_SAFE); qemuDomainObjRestoreAsyncJob(vm, job->asyncJob, job->phase, job->asyncStarted, op, @@ -3834,6 +3835,12 @@ qemuProcessRecoverJob(virQEMUDriver *driver, */ break; + case VIR_JOB_MODIFY_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: