render / rpms / libvirt

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