[libvirt PATCH v4 4/4] qemu_migration: Do not forbid vDPA devices if can query blockers

Eugenio Pérez eperezma at redhat.com
Wed Jul 20 16:05:49 UTC 2022


vDPA devices will be migratable soon. Since they are not migratable
before qemu 6.0, and qemu pre-6.0 didn't have the capability of asking
for migration blockers, let it hardcoded in that case.

Otherwise, ask qemu about the explicit blocker.

Signed-off-by: Eugenio Pérez <eperezma at redhat.com>
Reviewed-by: Jiri Denemark <jdenemar at redhat.com>
---
v3: Fix indentation
---
 src/qemu/qemu_migration.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2e3044289a..b554027da2 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1454,9 +1454,11 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
     int pauseReason;
     size_t i;
     int r;
+    bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
+                                            QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
 
     /* Ask qemu if it have a migration blocker */
-    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_BLOCKED_REASONS)) {
+    if (blockedReasonsCap) {
         g_auto(GStrv) blockers = NULL;
         r = qemuDomainGetMigrationBlockers(driver, vm, &blockers);
         if (r != 0)
@@ -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.31.1



More information about the libvir-list mailing list