]> xenbits.xensource.com Git - libvirt.git/commitdiff
Introduce VIR_JOB_MIGRATION_SAFE job type
authorJiri Denemark <jdenemar@redhat.com>
Tue, 24 May 2022 14:17:23 +0000 (16:17 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 7 Jun 2022 15:40:21 +0000 (17:40 +0200)
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>
src/hypervisor/domain_job.c
src/hypervisor/domain_job.h
src/qemu/qemu_migration.c
src/qemu/qemu_process.c

index 49867c39823f06c0d24d0442c64c799bd8090e70..5939d93e4760eb3d9c71f9b3490082409d9d3ab3 100644 (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",
 );
index fce35ffbf5a6bb1d91dd08169f996d93134930c3..30f950ec2305997babc49de3095d3af24a4c8907 100644 (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 */
index 761cf3ce8d65f047bec9e0bd9cbafca0e48589b7..341395ac6df0b3bf4638bb4bda6e8a762cff57bd 100644 (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;
index 8a98c033951abaad924235e7bc212e160d7ab7bf..e53f7c9c79b9036f752579f68218ae1b596c69ff 100644 (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: