mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: snapshot: Add support for compressing external snapshot memory
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
This commit is contained in:
parent
550cae847b
commit
7df5093f67
@ -58,6 +58,7 @@ module Libvirtd_qemu =
|
|||||||
|
|
||||||
let save_entry = str_entry "save_image_format"
|
let save_entry = str_entry "save_image_format"
|
||||||
| str_entry "dump_image_format"
|
| str_entry "dump_image_format"
|
||||||
|
| str_entry "snapshot_image_format"
|
||||||
| str_entry "auto_dump_path"
|
| str_entry "auto_dump_path"
|
||||||
| bool_entry "auto_dump_bypass_cache"
|
| bool_entry "auto_dump_bypass_cache"
|
||||||
| bool_entry "auto_start_bypass_cache"
|
| bool_entry "auto_start_bypass_cache"
|
||||||
|
@ -278,8 +278,14 @@
|
|||||||
# the requested compression program can't be found, this falls
|
# the requested compression program can't be found, this falls
|
||||||
# back to "raw" compression.
|
# back to "raw" compression.
|
||||||
#
|
#
|
||||||
|
# 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"
|
#save_image_format = "raw"
|
||||||
#dump_image_format = "raw"
|
#dump_image_format = "raw"
|
||||||
|
#snapshot_image_format = "raw"
|
||||||
|
|
||||||
# When a domain is configured to be auto-dumped when libvirtd receives a
|
# 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
|
# watchdog event from qemu guest, libvirtd will save dump files in directory
|
||||||
|
@ -521,6 +521,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
|
|||||||
|
|
||||||
GET_VALUE_STR("save_image_format", cfg->saveImageFormat);
|
GET_VALUE_STR("save_image_format", cfg->saveImageFormat);
|
||||||
GET_VALUE_STR("dump_image_format", cfg->dumpImageFormat);
|
GET_VALUE_STR("dump_image_format", cfg->dumpImageFormat);
|
||||||
|
GET_VALUE_STR("snapshot_image_format", cfg->snapshotImageFormat);
|
||||||
|
|
||||||
GET_VALUE_STR("auto_dump_path", cfg->autoDumpPath);
|
GET_VALUE_STR("auto_dump_path", cfg->autoDumpPath);
|
||||||
GET_VALUE_BOOL("auto_dump_bypass_cache", cfg->autoDumpBypassCache);
|
GET_VALUE_BOOL("auto_dump_bypass_cache", cfg->autoDumpBypassCache);
|
||||||
GET_VALUE_BOOL("auto_start_bypass_cache", cfg->autoStartBypassCache);
|
GET_VALUE_BOOL("auto_start_bypass_cache", cfg->autoStartBypassCache);
|
||||||
|
@ -144,6 +144,7 @@ struct _virQEMUDriverConfig {
|
|||||||
|
|
||||||
char *saveImageFormat;
|
char *saveImageFormat;
|
||||||
char *dumpImageFormat;
|
char *dumpImageFormat;
|
||||||
|
char *snapshotImageFormat;
|
||||||
|
|
||||||
char *autoDumpPath;
|
char *autoDumpPath;
|
||||||
bool autoDumpBypassCache;
|
bool autoDumpBypassCache;
|
||||||
|
@ -12128,6 +12128,8 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
|
|||||||
bool transaction = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION);
|
bool transaction = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION);
|
||||||
int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */
|
int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */
|
||||||
bool pmsuspended = false;
|
bool pmsuspended = false;
|
||||||
|
virQEMUDriverConfigPtr cfg = NULL;
|
||||||
|
int compressed = QEMU_SAVE_FORMAT_RAW;
|
||||||
|
|
||||||
if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SNAPSHOT) < 0)
|
if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SNAPSHOT) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -12189,12 +12191,28 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
|
|||||||
JOB_MASK(QEMU_JOB_SUSPEND) |
|
JOB_MASK(QEMU_JOB_SUSPEND) |
|
||||||
JOB_MASK(QEMU_JOB_MIGRATION_OP));
|
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)))
|
if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, true)))
|
||||||
goto endjob;
|
goto endjob;
|
||||||
|
|
||||||
if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file,
|
if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file,
|
||||||
xml, QEMU_SAVE_FORMAT_RAW,
|
xml, compressed, resume, 0,
|
||||||
resume, 0,
|
|
||||||
QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
|
QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
|
||||||
goto endjob;
|
goto endjob;
|
||||||
|
|
||||||
@ -12283,6 +12301,7 @@ endjob:
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(xml);
|
VIR_FREE(xml);
|
||||||
|
virObjectUnref(cfg);
|
||||||
if (memory_unlink && ret < 0)
|
if (memory_unlink && ret < 0)
|
||||||
unlink(snap->def->file);
|
unlink(snap->def->file);
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ module Test_libvirtd_qemu =
|
|||||||
}
|
}
|
||||||
{ "save_image_format" = "raw" }
|
{ "save_image_format" = "raw" }
|
||||||
{ "dump_image_format" = "raw" }
|
{ "dump_image_format" = "raw" }
|
||||||
|
{ "snapshot_image_format" = "raw" }
|
||||||
{ "auto_dump_path" = "/var/lib/libvirt/qemu/dump" }
|
{ "auto_dump_path" = "/var/lib/libvirt/qemu/dump" }
|
||||||
{ "auto_dump_bypass_cache" = "0" }
|
{ "auto_dump_bypass_cache" = "0" }
|
||||||
{ "auto_start_bypass_cache" = "0" }
|
{ "auto_start_bypass_cache" = "0" }
|
||||||
|
Loading…
Reference in New Issue
Block a user