]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Start a migration phase in qemuMigrationAnyConnectionClosed
authorJiri Denemark <jdenemar@redhat.com>
Tue, 10 May 2022 13:20:25 +0000 (15:20 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 7 Jun 2022 15:40:20 +0000 (17:40 +0200)
Non-postcopy case talks to QEMU monitor and thus needs to create a
nested job. Since qemuMigrationAnyConnectionClosed is called in case
there's no thread processing a migration API, we need to make the
current thread a temporary owner of the migration job to avoid "This
thread doesn't seem to be the async job owner: 0". This is done by
starting a migration phase.

While no monitor interaction happens in postcopy case and just setting
the phase (to indicate a broken postcopy migration) would be enough,
being consistent and setting the owner does not hurt anything.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_migration.c

index c59cf27d2e6b246e5dec104a8f3e58795b726f17..92cd696fbe5d8f871bba08f3d9bd5d755670b5eb 100644 (file)
@@ -2317,6 +2317,7 @@ qemuMigrationAnyConnectionClosed(virDomainObj *vm,
     virQEMUDriver *driver = priv->driver;
     qemuDomainJobPrivate *jobPriv = priv->job.privateData;
     bool postcopy = false;
+    int phase;
 
     VIR_DEBUG("vm=%s, conn=%p, asyncJob=%s, phase=%s",
               vm->def->name, conn,
@@ -2376,12 +2377,17 @@ qemuMigrationAnyConnectionClosed(virDomainObj *vm,
         return;
     }
 
+    if (postcopy)
+        phase = QEMU_MIGRATION_PHASE_POSTCOPY_FAILED;
+    else
+        phase = QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED;
+    ignore_value(qemuMigrationJobStartPhase(vm, phase));
+
     if (postcopy) {
         if (priv->job.asyncJob == VIR_ASYNC_JOB_MIGRATION_OUT)
             qemuMigrationSrcPostcopyFailed(vm);
         else
             qemuMigrationDstPostcopyFailed(vm);
-        ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_POSTCOPY_FAILED));
         qemuDomainCleanupAdd(vm, qemuProcessCleanupMigrationJob);
         qemuMigrationJobContinue(vm);
     } else {