render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 0ba11af2300d0aaf80456575e03848f843ae29de Mon Sep 17 00:00:00 2001
Message-Id: <0ba11af2300d0aaf80456575e03848f843ae29de@dist-git>
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
Date: Thu, 21 Jul 2022 19:29:15 +0200
Subject: [PATCH] qemu: remove hardcoded migration fail for vDPA devices if we
 can ask QEMU
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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>

(cherry picked from commit 2103807e330487952f423d86f541a7a28e003e95)
Resolves: https://bugzilla.redhat.com/2092833
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 src/qemu/qemu_migration.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index cfb7626bb0..2f77e45abf 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -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;
-- 
2.35.1