Introduce qemuMigrationParamsForSave() to create a
qemuMigrationParams object initialized with appropriate migration
capabilities and parameters for a save operation.
Note that mapped-ram capability also requires the multifd capability.
For now, the number of multifd channels is set to 1. Future work
to support parallel save/restore can set the number of channels to
a user-specified value.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/qemu/qemu_migration.c | 2 +-
src/qemu/qemu_migration_params.c | 21 +++++++++++++++++++++
src/qemu/qemu_migration_params.h | 3 +++
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 4fd7a0aafb..c1bdaa273b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -6965,7 +6965,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm,
/* Increase migration bandwidth to unlimited since target is a file.
* Failure to change migration speed is not fatal. */
- if (!(migParams = qemuMigrationParamsNew()))
+ if (!(migParams = qemuMigrationParamsForSave(false)))
return -1;
if (qemuMigrationParamsSetULL(migParams,
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 03937df2d3..503d6165b0 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -783,6 +783,27 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
}
+qemuMigrationParams *
+qemuMigrationParamsForSave(bool mappedRam)
+{
+ g_autoptr(qemuMigrationParams) saveParams = NULL;
+
+ if (!(saveParams = qemuMigrationParamsNew()))
+ return NULL;
+
+ if (mappedRam) {
+ if (virBitmapSetBit(saveParams->caps, QEMU_MIGRATION_CAP_MAPPED_RAM) < 0)
+ return NULL;
+ if (virBitmapSetBit(saveParams->caps, QEMU_MIGRATION_CAP_MULTIFD) < 0)
+ return NULL;
+ saveParams->params[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS].value.i = 1;
+ saveParams->params[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS].set = true;
+ }
+
+ return g_steal_pointer(&saveParams);
+}
+
+
int
qemuMigrationParamsDump(qemuMigrationParams *migParams,
virTypedParameterPtr *params,
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index 91a1965a74..fe239d9a8f 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -86,6 +86,9 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
unsigned int flags,
qemuMigrationParty party);
+qemuMigrationParams *
+qemuMigrationParamsForSave(bool mappedRam);
+
int
qemuMigrationParamsDump(qemuMigrationParams *migParams,
virTypedParameterPtr *params,
--
2.35.3