From cc76cf31d7fadd64f763d5630d8da87ba33112ae Mon Sep 17 00:00:00 2001 From: Charles Duffy Date: Fri, 28 Aug 2009 13:13:47 -0500 Subject: [PATCH] support lzop save compression for qemu Per prior discussion -- this was, indeed, trivial. I'm a little disappointed to be breaking the ordering characteristics of the enum (as it had been ordered by increasing time requirements and decreasing output size), but breaking any save files with the old constants in the headers would of course be worse. >From 2a9cdcfc88de091a8d34aa3fc3b1208d7681790e Mon Sep 17 00:00:00 2001 From: Charles Duffy Date: Fri, 28 Aug 2009 11:49:54 -0500 Subject: [PATCH] support lzop save compression for qemu One of the larger disincentives towards use of compression for migrated-out save files is performance impact. This patch adds support for lzop; CPU time for compression is about 5x faster than gzip (the next most performant algorithm) and decompression is about 3x faster. Signed-off-by: Charles Duffy Signed-off-by: Chris Lalancette --- src/qemu.conf | 6 +++--- src/qemu_driver.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/qemu.conf b/src/qemu.conf index 1f10b43e53..9aecc2637e 100644 --- a/src/qemu.conf +++ b/src/qemu.conf @@ -134,8 +134,8 @@ # memory from the domain is dumped out directly to a file. If you have # guests with a large amount of memory, however, this can take up quite # a bit of space. If you would like to compress the images while they -# are being saved to disk, you can also set "gzip", "bzip2", or "lzma" -# for save_image_format. Note that this means you slow down the -# process of saving a domain in order to save disk space. +# are being saved to disk, you can also set "gzip", "bzip2", "lzma" +# or "lzop" for save_image_format. Note that this means you slow down +# the process of saving a domain in order to save disk space. # # save_image_format = "raw" diff --git a/src/qemu_driver.c b/src/qemu_driver.c index f51430761a..3ebe8020e2 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -3483,6 +3483,7 @@ enum qemud_save_formats { QEMUD_SAVE_FORMAT_GZIP, QEMUD_SAVE_FORMAT_BZIP2, QEMUD_SAVE_FORMAT_LZMA, + QEMUD_SAVE_FORMAT_LZOP, }; struct qemud_save_header { @@ -3523,6 +3524,8 @@ static int qemudDomainSave(virDomainPtr dom, header.compressed = QEMUD_SAVE_FORMAT_BZIP2; else if (STREQ(driver->saveImageFormat, "lzma")) header.compressed = QEMUD_SAVE_FORMAT_LZMA; + else if (STREQ(driver->saveImageFormat, "lzop")) + header.compressed = QEMUD_SAVE_FORMAT_LZOP; else { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "%s", _("Invalid save image format specified in configuration file")); @@ -3615,6 +3618,9 @@ static int qemudDomainSave(virDomainPtr dom, else if (header.compressed == QEMUD_SAVE_FORMAT_LZMA) internalret = virAsprintf(&command, "migrate \"exec:" "lzma -c >> '%s' 2>/dev/null\"", safe_path); + else if (header.compressed == QEMUD_SAVE_FORMAT_LZOP) + internalret = virAsprintf(&command, "migrate \"exec:" + "lzop -c >> '%s' 2>/dev/null\"", safe_path); else { qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, _("Invalid compress format %d"), @@ -4237,6 +4243,8 @@ static int qemudDomainRestore(virConnectPtr conn, intermediate_argv[0] = "bzip2"; else if (header.compressed == QEMUD_SAVE_FORMAT_LZMA) intermediate_argv[0] = "lzma"; + else if (header.compressed == QEMUD_SAVE_FORMAT_LZOP) + intermediate_argv[0] = "lzop"; else if (header.compressed != QEMUD_SAVE_FORMAT_RAW) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, _("Unknown compressed save format %d"), -- GitLab