]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: remove hardcoded migration fail for vDPA devices if we can ask QEMU
authorEugenio Pérez <eperezma@redhat.com>
Wed, 20 Jul 2022 16:05:49 +0000 (18:05 +0200)
committerLaine Stump <laine@redhat.com>
Thu, 21 Jul 2022 04:58:06 +0000 (00:58 -0400)
vDPA devices will be migratable soon, so we shouldn't unconditionally
block migration of any domain with a vDPA device. Instead, we should
rely on QEMU to make the decision when that info is available from the
query-migrate QMP command (QEMU versions too old to have that info in
the results of query-migrate don't support migration of vDPA devices,
so in that case we will continue to unconditionally block migration).

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/qemu/qemu_migration.c

index 87c26b4e2c7dc1096eaa92bba9947ff266c734d5..5d1e5f987b406e9ad6417912e79d912cd0a41c47 100644 (file)
@@ -1455,9 +1455,11 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
     int nsnapshots;
     int pauseReason;
     size_t i;
+    bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
+                                            QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
 
-    /* Ask qemu if it has a migration blocker */
-    if (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;
@@ -1576,7 +1578,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
             virDomainNetDef *net = vm->def->nets[i];
             qemuSlirp *slirp;
 
-            if (net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
+            if (!blockedReasonsCap && net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
                 virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                                _("vDPA devices cannot be migrated"));
                 return false;