1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

Introduce VIR_JOB_MIGRATION_SAFE job type

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@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Jiri Denemark 2022-05-24 16:17:23 +02:00
parent 5915f93ed0
commit b01426a238
4 changed files with 13 additions and 0 deletions

View File

@ -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",
);

View File

@ -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 */

View File

@ -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;

View File

@ -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: