Blob Blame History Raw
From 8f2cd77dc208cfa90b37faa18b092ca4a76a0716 Mon Sep 17 00:00:00 2001
Message-Id: <8f2cd77dc208cfa90b37faa18b092ca4a76a0716@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Thu, 21 Jul 2022 02:03:49 -0400
Subject: [PATCH] qemu: skip hardcoded hostdev migration check if QEMU can do
 it for us

libvirt currently will block migration for any vfio-assigned device
unless it is a network device that is associated with a virtio-net
failover device (ie. if the hostdev object has a teaming->type ==
VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT).

In the future there will be other vfio devices that can be migrated,
so we don't want to rely on this hardcoded block. QEMU 6.0+ will
anyway inform us of any devices that will block migration (as a part
of qemuDomainGetMigrationBlockers()), so we only need to do the
hardcoded check in the case of old QEMU that can't provide that
information.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 25883cd5f0b188f2417f294b7d219a77b219f7c2)

https://bugzilla.redhat.com/show_bug.cgi?id=1497907

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_migration.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index f571c9eb27..76903d612b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1495,6 +1495,14 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
                                _("cannot migrate domain: %s"), reasons);
                 return false;
             }
+        } else {
+            /* checks here are for anything that doesn't need to be
+             * checked by libvirt if running QEMU that can be queried
+             * about migration blockers.
+             */
+
+            if (!qemuMigrationSrcIsAllowedHostdev(vm->def))
+                return false;
         }
 
         if (remote) {
@@ -1521,9 +1529,6 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
             return false;
         }
 
-        if (!qemuMigrationSrcIsAllowedHostdev(vm->def))
-            return false;
-
         if (vm->def->cpu) {
             /* QEMU blocks migration and save with invariant TSC enabled
              * unless TSC frequency is explicitly set.
-- 
2.35.1