mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-30 18:50:18 +03:00
qemu: Add function to get migration params for save
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@suse.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
ac2f196ddd
commit
c939bf537e
@ -7134,7 +7134,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,
|
||||
|
@ -792,6 +792,27 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
|
||||
}
|
||||
|
||||
|
||||
qemuMigrationParams *
|
||||
qemuMigrationParamsForSave(bool sparse)
|
||||
{
|
||||
g_autoptr(qemuMigrationParams) saveParams = NULL;
|
||||
|
||||
if (!(saveParams = qemuMigrationParamsNew()))
|
||||
return NULL;
|
||||
|
||||
if (sparse) {
|
||||
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,
|
||||
|
@ -87,6 +87,9 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
|
||||
unsigned int flags,
|
||||
qemuMigrationParty party);
|
||||
|
||||
qemuMigrationParams *
|
||||
qemuMigrationParamsForSave(bool sparse);
|
||||
|
||||
int
|
||||
qemuMigrationParamsDump(qemuMigrationParams *migParams,
|
||||
virTypedParameterPtr *params,
|
||||
|
Loading…
x
Reference in New Issue
Block a user