The regular save image code has the support to compress images using a specified algorithm. This was not implemented for external checkpoints although it shares most of the backend code. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1017227 --- src/qemu/qemu.conf | 6 ++++++ src/qemu/qemu_conf.c | 1 + src/qemu/qemu_conf.h | 1 + src/qemu/qemu_driver.c | 23 +++++++++++++++++++++-- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 7cf67df..aff5e6d 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -283,9 +283,15 @@ # specified format isn't valid, or the requested compression program can't be # found. # +# snapshot_image_format specifies the compression algorithm of the memory save +# image when an external snapshot of a domain is taken. This does not apply +# on disk image format. It is an error if the specified format isn't valid, +# or the requested compression program can't be found. +# #save_image_format = "raw" #dump_image_format = "raw" #managedsave_image_format = "raw" +#snapshot_image_format = "raw" # When a domain is configured to be auto-dumped when libvirtd receives a # watchdog event from qemu guest, libvirtd will save dump files in directory diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 3e3cc28..ecc9a54 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -522,6 +522,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, GET_VALUE_STR("save_image_format", cfg->saveImageFormat); GET_VALUE_STR("dump_image_format", cfg->dumpImageFormat); GET_VALUE_STR("managedsave_image_format", cfg->managedsaveImageFormat); + GET_VALUE_STR("snapshot_image_format", cfg->snapshotImageFormat); GET_VALUE_STR("auto_dump_path", cfg->autoDumpPath); GET_VALUE_BOOL("auto_dump_bypass_cache", cfg->autoDumpBypassCache); diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 3a68c4a..947e1b4 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -145,6 +145,7 @@ struct _virQEMUDriverConfig { char *saveImageFormat; char *dumpImageFormat; char *managedsaveImageFormat; + char *snapshotImageFormat; char *autoDumpPath; bool autoDumpBypassCache; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index bd69e5f..64eec4d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12116,6 +12116,8 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, bool transaction = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION); int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */ bool pmsuspended = false; + virQEMUDriverConfigPtr cfg = NULL; + int compressed = QEMU_SAVE_FORMAT_RAW; if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SNAPSHOT) < 0) goto cleanup; @@ -12177,12 +12179,28 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, JOB_MASK(QEMU_JOB_SUSPEND) | JOB_MASK(QEMU_JOB_MIGRATION_OP)); + cfg = virQEMUDriverGetConfig(driver); + if (cfg->snapshotImageFormat) { + compressed = qemuSaveCompressionTypeFromString(cfg->snapshotImageFormat); + if (compressed < 0) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("Invalid snapshot image format specified " + "in configuration file")); + goto cleanup; + } + if (!qemuCompressProgramAvailable(compressed)) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("Compression program for image format " + "in configuration file isn't available")); + goto cleanup; + } + } + if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, true))) goto endjob; if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file, - xml, QEMU_SAVE_FORMAT_RAW, - resume, 0, + xml, compressed, resume, 0, QEMU_ASYNC_JOB_SNAPSHOT)) < 0) goto endjob; @@ -12271,6 +12289,7 @@ endjob: cleanup: VIR_FREE(xml); + virObjectUnref(cfg); if (memory_unlink && ret < 0) unlink(snap->def->file); -- 1.8.3.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list