Since the function is tightly connected to migration, it was renamed as
qemuMigrationCapsCheck and moved to qemu_migration.c.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_domain.c | 72 ---------------------------------------
src/qemu/qemu_domain.h | 4 ---
src/qemu/qemu_migration.c | 72 +++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_migration.h | 6 ++++
src/qemu/qemu_process.c | 2 +-
5 files changed, 79 insertions(+), 77 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9d1c33b54a..a1bbe256f5 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11781,78 +11781,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.c b/src/qemu/qemu_migration.c
index e5231555de..a2a6616862 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -6162,6 +6162,78 @@ qemuMigrationSrcFetchMirrorStats(virQEMUDriverPtr driver,
}
+int
+qemuMigrationCapsCheck(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;
+}
+
+
bool
qemuMigrationAnyCapsGet(virDomainObjPtr vm,
qemuMonitorMigrationCaps cap)
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index a075aec124..3dca8a1889 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -37,6 +37,7 @@
* - qemuMigrationParamsXXX - runs on source or dest host
* - qemuMigrationOptionXXX - runs on source or dest host
* - qemuMigrationJobXXX - runs on source or dest host
+ * - qemuMigrationCapsXXX - runs on source or dest host
*/
typedef struct _qemuMigrationCompression qemuMigrationCompression;
@@ -308,6 +309,11 @@ qemuMigrationSrcFetchMirrorStats(virQEMUDriverPtr driver,
qemuDomainAsyncJob asyncJob,
qemuDomainJobInfoPtr jobInfo);
+int
+qemuMigrationCapsCheck(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ qemuDomainAsyncJob asyncJob);
+
bool
qemuMigrationAnyCapsGet(virDomainObjPtr vm,
qemuMonitorMigrationCaps cap);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c0105c8b84..df2db53a97 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1835,7 +1835,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