]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: migration: Don't reactivate block nodes after migration failure any more
authorPeter Krempa <pkrempa@redhat.com>
Fri, 25 Jul 2025 14:13:39 +0000 (16:13 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 21 Oct 2025 13:32:40 +0000 (15:32 +0200)
The other code paths which do want to issue block jobs can reactivate
the nodes when necessary so we don't need to do that unconditionally
after failed/cancelled migration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_migration.c

index a11d1d8452dedd9c8867fe8039062027ea2f2077..9109c4526db1894461fa44191c04ad09a190b174 100644 (file)
@@ -220,43 +220,6 @@ qemuMigrationSrcStoreDomainState(virDomainObj *vm)
 }
 
 
-/**
- * qemuMigrationBlockNodesReactivate:
- *
- * In case when we're keeping the VM paused qemu will not re-activate the block
- * device backend tree so blockjobs would fail. In case when qemu supports the
- * 'blockdev-set-active' command this function will re-activate the block nodes.
- */
-static void
-qemuMigrationBlockNodesReactivate(virDomainObj *vm,
-                                  virDomainAsyncJob asyncJob)
-{
-    virErrorPtr orig_err;
-    qemuDomainObjPrivate *priv = vm->privateData;
-    int rc;
-
-    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_SET_ACTIVE))
-        return;
-
-    VIR_DEBUG("re-activating block nodes");
-
-    virErrorPreserveLast(&orig_err);
-
-    if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0)
-        goto cleanup;
-
-    rc = qemuMonitorBlockdevSetActive(priv->mon, NULL, true);
-
-    qemuDomainObjExitMonitor(vm);
-
-    if (rc < 0)
-        VIR_WARN("failed to re-activate block nodes after migration of VM '%s'", vm->def->name);
-
- cleanup:
-    virErrorRestore(&orig_err);
-}
-
-
 static void
 qemuMigrationSrcRestoreDomainState(virQEMUDriver *driver, virDomainObj *vm)
 {
@@ -279,11 +242,11 @@ qemuMigrationSrcRestoreDomainState(virQEMUDriver *driver, virDomainObj *vm)
 
     if (preMigrationState != VIR_DOMAIN_RUNNING ||
         state != VIR_DOMAIN_PAUSED)
-        goto reactivate;
+        return;
 
     if (reason == VIR_DOMAIN_PAUSED_IOERROR) {
         VIR_DEBUG("Domain is paused due to I/O error, skipping resume");
-        goto reactivate;
+        return;
     }
 
     VIR_DEBUG("Restoring pre-migration state due to migration error");
@@ -306,14 +269,7 @@ qemuMigrationSrcRestoreDomainState(virQEMUDriver *driver, virDomainObj *vm)
                                                       VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR);
             virObjectEventStateQueue(driver->domainEventState, event);
         }
-
-        goto reactivate;
     }
-
-    return;
-
- reactivate:
-    qemuMigrationBlockNodesReactivate(vm, VIR_ASYNC_JOB_MIGRATION_OUT);
 }
 
 
@@ -6891,8 +6847,6 @@ qemuMigrationDstFinishFresh(virQEMUDriver *driver,
 
         if (*inPostCopy)
             *doKill = false;
-    } else {
-        qemuMigrationBlockNodesReactivate(vm, VIR_ASYNC_JOB_MIGRATION_IN);
     }
 
     if (mig->jobData) {