Since the function is tightly connected to migration, it was renamed as
qemuMigrationCapsCheck and moved to qemu_migration_params.c.

Signed-off-by: Jiri Denemark <jdene...@redhat.com>
---
 src/qemu/qemu_domain.c           | 72 --------------------------------
 src/qemu/qemu_domain.h           |  4 --
 src/qemu/qemu_migration_params.c | 72 ++++++++++++++++++++++++++++++++
 src/qemu/qemu_migration_params.h |  5 +++
 src/qemu/qemu_process.c          |  2 +-
 5 files changed, 78 insertions(+), 77 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 100304fd05..84476de11b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11798,78 +11798,6 @@ qemuDomainCheckCCWS390AddressSupport(const 
virDomainDef *def,
 }
 
 
-int
-qemuDomainCheckMigrationCapabilities(virQEMUDriverPtr driver,
-                                     virDomainObjPtr vm,
-                                     qemuDomainAsyncJob asyncJob)
-{
-    qemuDomainObjPrivatePtr priv = vm->privateData;
-    char **caps = NULL;
-    char **capStr;
-    int ret = -1;
-    int rc;
-
-    if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
-        return -1;
-
-    rc = qemuMonitorGetMigrationCapabilities(priv->mon, &caps);
-
-    if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
-        goto cleanup;
-
-    if (!caps) {
-        ret = 0;
-        goto cleanup;
-    }
-
-    priv->migrationCaps = virBitmapNew(QEMU_MONITOR_MIGRATION_CAPS_LAST);
-    if (!priv->migrationCaps)
-        goto cleanup;
-
-    for (capStr = caps; *capStr; capStr++) {
-        int cap = qemuMonitorMigrationCapsTypeFromString(*capStr);
-
-        if (cap < 0) {
-            VIR_DEBUG("Unknown migration capability: '%s'", *capStr);
-        } else {
-            ignore_value(virBitmapSetBit(priv->migrationCaps, cap));
-            VIR_DEBUG("Found migration capability: '%s'", *capStr);
-        }
-    }
-
-    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT)) {
-        if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
-            goto cleanup;
-
-        rc = qemuMonitorSetMigrationCapability(priv->mon,
-                                               
QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
-                                               true);
-
-        if (qemuDomainObjExitMonitor(driver, vm) < 0)
-            goto cleanup;
-
-        if (rc < 0) {
-            virResetLastError();
-            VIR_DEBUG("Cannot enable migration events; clearing capability");
-            virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
-        }
-    }
-
-    /* Migration events capability must always be enabled, clearing it from
-     * migration capabilities bitmap makes sure it won't be touched anywhere
-     * else.
-     */
-    ignore_value(virBitmapClearBit(priv->migrationCaps,
-                                   QEMU_MONITOR_MIGRATION_CAPS_EVENTS));
-
-    ret = 0;
-
- cleanup:
-    virStringListFree(caps);
-    return ret;
-}
-
-
 /**
  * qemuDomainPrepareDiskSourceChain:
  *
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 21e12f6594..415b2ca093 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -988,10 +988,6 @@ bool qemuDomainCheckCCWS390AddressSupport(const 
virDomainDef *def,
                                     const char *devicename);
 
 int
-qemuDomainCheckMigrationCapabilities(virQEMUDriverPtr driver,
-                                     virDomainObjPtr vm,
-                                     qemuDomainAsyncJob asyncJob);
-int
 qemuDomainPrepareDiskSourceChain(virDomainDiskDefPtr disk,
                                  virStorageSourcePtr src,
                                  virQEMUDriverConfigPtr cfg,
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 72ecafd057..461df876db 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -452,3 +452,75 @@ qemuMigrationParamsReset(virQEMUDriverPtr driver,
         virFreeError(err);
     }
 }
+
+
+int
+qemuMigrationCapsCheck(virQEMUDriverPtr driver,
+                       virDomainObjPtr vm,
+                       int asyncJob)
+{
+    qemuDomainObjPrivatePtr priv = vm->privateData;
+    char **caps = NULL;
+    char **capStr;
+    int ret = -1;
+    int rc;
+
+    if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+        return -1;
+
+    rc = qemuMonitorGetMigrationCapabilities(priv->mon, &caps);
+
+    if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
+        goto cleanup;
+
+    if (!caps) {
+        ret = 0;
+        goto cleanup;
+    }
+
+    priv->migrationCaps = virBitmapNew(QEMU_MONITOR_MIGRATION_CAPS_LAST);
+    if (!priv->migrationCaps)
+        goto cleanup;
+
+    for (capStr = caps; *capStr; capStr++) {
+        int cap = qemuMonitorMigrationCapsTypeFromString(*capStr);
+
+        if (cap < 0) {
+            VIR_DEBUG("Unknown migration capability: '%s'", *capStr);
+        } else {
+            ignore_value(virBitmapSetBit(priv->migrationCaps, cap));
+            VIR_DEBUG("Found migration capability: '%s'", *capStr);
+        }
+    }
+
+    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT)) {
+        if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+            goto cleanup;
+
+        rc = qemuMonitorSetMigrationCapability(priv->mon,
+                                               
QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
+                                               true);
+
+        if (qemuDomainObjExitMonitor(driver, vm) < 0)
+            goto cleanup;
+
+        if (rc < 0) {
+            virResetLastError();
+            VIR_DEBUG("Cannot enable migration events; clearing capability");
+            virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
+        }
+    }
+
+    /* Migration events capability must always be enabled, clearing it from
+     * migration capabilities bitmap makes sure it won't be touched anywhere
+     * else.
+     */
+    ignore_value(virBitmapClearBit(priv->migrationCaps,
+                                   QEMU_MONITOR_MIGRATION_CAPS_EVENTS));
+
+    ret = 0;
+
+ cleanup:
+    virStringListFree(caps);
+    return ret;
+}
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index 33b3c27e51..a006357825 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -79,4 +79,9 @@ qemuMigrationParamsReset(virQEMUDriverPtr driver,
                          virDomainObjPtr vm,
                          int asyncJob);
 
+int
+qemuMigrationCapsCheck(virQEMUDriverPtr driver,
+                       virDomainObjPtr vm,
+                       int asyncJob);
+
 #endif /* __QEMU_MIGRATION_PARAMS_H__ */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7d678046c8..11276dace9 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1840,7 +1840,7 @@ qemuConnectMonitor(virQEMUDriverPtr driver, 
virDomainObjPtr vm, int asyncJob,
     if (qemuProcessInitMonitor(driver, vm, asyncJob) < 0)
         return -1;
 
-    if (qemuDomainCheckMigrationCapabilities(driver, vm, asyncJob) < 0)
+    if (qemuMigrationCapsCheck(driver, vm, asyncJob) < 0)
         return -1;
 
     return 0;
-- 
2.17.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to