Blame SOURCES/libvirt-qemu-remove-hardcoded-migration-fail-for-vDPA-devices-if-we-can-ask-QEMU.patch

032100
From 0ba11af2300d0aaf80456575e03848f843ae29de Mon Sep 17 00:00:00 2001
032100
Message-Id: <0ba11af2300d0aaf80456575e03848f843ae29de@dist-git>
032100
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
032100
Date: Thu, 21 Jul 2022 19:29:15 +0200
032100
Subject: [PATCH] qemu: remove hardcoded migration fail for vDPA devices if we
032100
 can ask QEMU
032100
MIME-Version: 1.0
032100
Content-Type: text/plain; charset=UTF-8
032100
Content-Transfer-Encoding: 8bit
032100
032100
vDPA devices will be migratable soon, so we shouldn't unconditionally
032100
block migration of any domain with a vDPA device. Instead, we should
032100
rely on QEMU to make the decision when that info is available from the
032100
query-migrate QMP command (QEMU versions too old to have that info in
032100
the results of query-migrate don't support migration of vDPA devices,
032100
so in that case we will continue to unconditionally block migration).
032100
032100
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
032100
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
032100
Reviewed-by: Laine Stump <laine@redhat.com>
032100
032100
(cherry picked from commit 2103807e330487952f423d86f541a7a28e003e95)
032100
Resolves: https://bugzilla.redhat.com/2092833
032100
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
032100
---
032100
 src/qemu/qemu_migration.c | 8 +++++---
032100
 1 file changed, 5 insertions(+), 3 deletions(-)
032100
032100
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
032100
index cfb7626bb0..2f77e45abf 100644
032100
--- a/src/qemu/qemu_migration.c
032100
+++ b/src/qemu/qemu_migration.c
032100
@@ -1455,9 +1455,11 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
032100
     int nsnapshots;
032100
     int pauseReason;
032100
     size_t i;
032100
+    bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
032100
+                                            QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
032100
 
032100
-    /* Ask qemu if it has a migration blocker */
032100
-    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_BLOCKED_REASONS)) {
032100
+    /* Ask qemu if it have a migration blocker */
032100
+    if (blockedReasonsCap) {
032100
         g_auto(GStrv) blockers = NULL;
032100
         if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0)
032100
             return false;
032100
@@ -1576,7 +1578,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
032100
             virDomainNetDef *net = vm->def->nets[i];
032100
             qemuSlirp *slirp;
032100
 
032100
-            if (net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
032100
+            if (!blockedReasonsCap && net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
032100
                 virReportError(VIR_ERR_OPERATION_INVALID, "%s",
032100
                                _("vDPA devices cannot be migrated"));
032100
                 return false;
032100
-- 
032100
2.35.1
032100