[PATCH 1/2] qemu: don't try to query QEMU about migration blockers during offline migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The new code that queries QEMU about migration blockers was put at the
top of qemuMigrationSrcIsAllowed(), but that function can also be
called in the case of offline migration (ie when the domain is
inactive / QEMU isn't running). This check should have been put inside
the "if (!(flags & VIR_MIGRATE_OFFLINE))" conditional, so let's move
it there.

Fixes: 156e99f686690855be4e45d9b8b3194191a8bc31
Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 5d1e5f987b..6fc5791f61 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1455,22 +1455,6 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
     int nsnapshots;
     int pauseReason;
     size_t i;
-    bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
-                                            QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
-
-    /* Ask qemu if it have a migration blocker */
-    if (blockedReasonsCap) {
-        g_auto(GStrv) blockers = NULL;
-        if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0)
-            return false;
-
-        if (blockers && blockers[0]) {
-            g_autofree char *reasons = g_strjoinv("; ", blockers);
-            virReportError(VIR_ERR_OPERATION_INVALID,
-                           _("cannot migrate domain: %s"), reasons);
-            return false;
-        }
-    }
 
     /* perform these checks only when migrating to remote hosts */
     if (remote) {
@@ -1488,6 +1472,24 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
 
     /* following checks don't make sense for offline migration */
     if (!(flags & VIR_MIGRATE_OFFLINE)) {
+        bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
+                                                QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
+
+        /* Ask qemu if it has a migration blocker */
+        if (blockedReasonsCap) {
+            g_auto(GStrv) blockers = NULL;
+
+            if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0)
+                return false;
+
+            if (blockers && blockers[0]) {
+                g_autofree char *reasons = g_strjoinv("; ", blockers);
+                virReportError(VIR_ERR_OPERATION_INVALID,
+                               _("cannot migrate domain: %s"), reasons);
+                return false;
+            }
+        }
+
         if (remote) {
             /* cancel migration if disk I/O error is emitted while migrating */
             if (flags & VIR_MIGRATE_ABORT_ON_ERROR &&
-- 
2.35.3




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux