Signed-off-by: Claudio Fontana <cfontana(a)suse.de>
---
src/qemu/qemu_migration.c | 17 +++++++++++++----
src/qemu/qemu_migration.h | 2 +-
src/qemu/qemu_saveimage.c | 13 +++++++++++--
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 12b7e84f25..de963fc413 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5905,7 +5905,7 @@ qemuMigrationSrcToFileAux(virQEMUDriver *driver, virDomainObj *vm,
virCommand *compressor,
virDomainAsyncJob asyncJob,
const char *sun_path,
- int nchannels)
+ int nchannels, const char *pcomp)
{
qemuDomainObjPrivate *priv = vm->privateData;
bool bwParam = virQEMUCapsGet(priv->qemuCaps,
QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH);
@@ -5952,6 +5952,15 @@ qemuMigrationSrcToFileAux(virQEMUDriver *driver, virDomainObj *vm,
QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS,
nchannels) < 0)
return -1;
+ if (virQEMUCapsGet(priv->qemuCaps,
QEMU_CAPS_MIGRATION_PARAM_MULTIFD_COMPRESSION)) {
+ if (qemuMigrationParamsSetString(migParams,
+ QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION,
pcomp) < 0)
+ return -1;
+ } else if (pcomp != NULL) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("QEMU does not seem to support multifd
compression"));
+ return -1;
+ }
}
if (needParams && qemuMigrationParamsApply(driver, vm, asyncJob, migParams)
< 0)
@@ -6077,17 +6086,17 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm,
virDomainAsyncJob asyncJob)
{
return qemuMigrationSrcToFileAux(driver, vm, fd, compressor,
- asyncJob, NULL, -1);
+ asyncJob, NULL, -1, NULL);
}
int
qemuMigrationSrcToFilesMultiFd(virQEMUDriver *driver, virDomainObj *vm,
virDomainAsyncJob asyncJob,
const char *sun_path,
- int nchannels)
+ int nchannels, const char *pcomp)
{
return qemuMigrationSrcToFileAux(driver, vm, -1, NULL,
- asyncJob, sun_path, nchannels);
+ asyncJob, sun_path, nchannels, pcomp);
}
int
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 38f4877cf0..d6185770b2 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -223,7 +223,7 @@ int
qemuMigrationSrcToFilesMultiFd(virQEMUDriver *driver, virDomainObj *vm,
virDomainAsyncJob asyncJob,
const char *sun_path,
- int nchannels)
+ int nchannels, const char *pcomp)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
int
diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c
index 0187e47e28..8f589d1cce 100644
--- a/src/qemu/qemu_saveimage.c
+++ b/src/qemu/qemu_saveimage.c
@@ -481,13 +481,14 @@ qemuSaveImageCreate(virQEMUDriver *driver,
virQEMUSaveData *data,
virCommand *compressor,
int nconn,
- const char *pcomp G_GNUC_UNUSED,
+ const char *pcomp,
unsigned int flags,
virDomainAsyncJob asyncJob)
{
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virQEMUSaveFd saveFd = QEMU_SAVEFD_INVALID;
virQEMUSaveFd *multiFd = NULL;
+ virQEMUSaveMultiFdComp multiComp = QEMU_SAVE_MULTIFD_COMP_NONE;
unsigned int oflags = O_WRONLY | O_TRUNC | O_CREAT;
int ret = -1;
@@ -506,6 +507,14 @@ qemuSaveImageCreate(virQEMUDriver *driver,
if (qemuSecuritySetImageFDLabel(driver->securityManager, vm->def, saveFd.fd)
< 0)
goto cleanup;
+ if (pcomp) {
+ if ((multiComp = qemuSaveMultiFdCompTypeFromString(pcomp)) < 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Invalid %s multifd compression format
specified"), pcomp);
+ goto cleanup;
+ }
+ }
+ data->header.multifd_comp = multiComp;
if (virQEMUSaveDataWrite(data, saveFd.fd, saveFd.path) < 0)
goto cleanup;
@@ -535,7 +544,7 @@ qemuSaveImageCreate(virQEMUDriver *driver,
goto cleanup;
if (chown(sun_path, cfg->user, cfg->group) < 0)
goto cleanup;
- if (qemuMigrationSrcToFilesMultiFd(driver, vm, asyncJob, sun_path, nconn) <
0)
+ if (qemuMigrationSrcToFilesMultiFd(driver, vm, asyncJob, sun_path, nconn, pcomp)
< 0)
goto cleanup;
if (qemuSaveImageCloseMultiFd(multiFd, nconn, vm) < 0)
goto cleanup;
--
2.35.3