[PATCH 4/7] qemu: migration: Don't reactivate block nodes after migration failure any more

Peter Krempa via Devel posted 7 patches 2 weeks ago
[PATCH 4/7] qemu: migration: Don't reactivate block nodes after migration failure any more
Posted by Peter Krempa via Devel 2 weeks ago
From: Peter Krempa <pkrempa@redhat.com>

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>
---
 src/qemu/qemu_migration.c | 50 ++-------------------------------------
 1 file changed, 2 insertions(+), 48 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a11d1d8452..9109c4526d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -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) {
-- 
2.51.0