From: Peter Krempa <pkre...@redhat.com>

Libvirt detects QEMU_CAPS_MIGRATE_RDMA by probing
'query-migrate-capabilities' for the presence of 'rdma-pin-all'.

In qemu the entry in 'query-migrate-capabilities' existed since the
introduction of the command in qemu-2.0. We thus always detect this
capability.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 src/qemu/qemu_migration.c | 26 +++++++-------------------
 src/qemu/qemu_migration.h |  3 +--
 src/qemu/qemu_process.c   |  2 +-
 3 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index b22248e3b9..a8f4dd489c 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2387,20 +2387,14 @@ qemuMigrationDstOPDRelocate(virQEMUDriver *driver 
G_GNUC_UNUSED,


 int
-qemuMigrationDstCheckProtocol(virQEMUCaps *qemuCaps,
-                              const char *migrateFrom)
+qemuMigrationDstCheckProtocol(const char *migrateFrom)
 {
-    if (STRPREFIX(migrateFrom, "rdma")) {
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_RDMA)) {
-            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
-                           _("incoming RDMA migration is not supported with 
this QEMU binary"));
-            return -1;
-        }
-    } else if (!STRPREFIX(migrateFrom, "tcp") &&
-               !STRPREFIX(migrateFrom, "exec") &&
-               !STRPREFIX(migrateFrom, "fd") &&
-               !STRPREFIX(migrateFrom, "unix") &&
-               STRNEQ(migrateFrom, "stdio")) {
+    if (!STRPREFIX(migrateFrom, "tcp") &&
+        !STRPREFIX(migrateFrom, "exec") &&
+        !STRPREFIX(migrateFrom, "fd") &&
+        !STRPREFIX(migrateFrom, "unix") &&
+        !STRPREFIX(migrateFrom, "rdma") &&
+        STRNEQ(migrateFrom, "stdio")) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("unknown migration protocol"));
         return -1;
@@ -5330,7 +5324,6 @@ qemuMigrationSrcPerformNative(virQEMUDriver *driver,
                               qemuMigrationParams *migParams,
                               const char *nbdURI)
 {
-    qemuDomainObjPrivate *priv = vm->privateData;
     g_autoptr(virURI) uribits = NULL;
     int ret = -1;
     qemuMigrationSpec spec;
@@ -5353,11 +5346,6 @@ qemuMigrationSrcPerformNative(virQEMUDriver *driver,
     }

     if (STREQ(uribits->scheme, "rdma")) {
-        if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_RDMA)) {
-            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
-                           _("outgoing RDMA migration is not supported with 
this QEMU binary"));
-            return -1;
-        }
         if (!virMemoryLimitIsSet(vm->def->mem.hard_limit)) {
             virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                            _("cannot start RDMA migration with no memory hard 
limit set"));
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index beb888160a..36865040df 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -274,8 +274,7 @@ qemuMigrationDstErrorReport(virQEMUDriver *driver,
                             const char *name);

 int
-qemuMigrationDstCheckProtocol(virQEMUCaps *qemuCaps,
-                              const char *migrateFrom);
+qemuMigrationDstCheckProtocol(const char *migrateFrom);

 char *
 qemuMigrationDstGetURI(const char *migrateFrom,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index a81c02c9d5..059834648d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4997,7 +4997,7 @@ qemuProcessIncomingDefNew(virQEMUDriver *driver,
     qemuDomainObjPrivate *priv = vm->privateData;
     qemuProcessIncomingDef *inc = NULL;

-    if (qemuMigrationDstCheckProtocol(priv->qemuCaps, migrateFrom) < 0)
+    if (qemuMigrationDstCheckProtocol(migrateFrom) < 0)
         return NULL;

     inc = g_new0(qemuProcessIncomingDef, 1);
-- 
2.51.0

Reply via email to