提交 cc76cf31 编写于 作者: C Charles Duffy 提交者: Chris Lalancette

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 <Charles_Duffy@dell.com>
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: NCharles Duffy <Charles_Duffy@dell.com>
Signed-off-by: NChris Lalancette <clalance@redhat.com>
上级 1dac1b37
...@@ -134,8 +134,8 @@ ...@@ -134,8 +134,8 @@
# memory from the domain is dumped out directly to a file. If you have # 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 # 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 # 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" # are being saved to disk, you can also set "gzip", "bzip2", "lzma"
# for save_image_format. Note that this means you slow down the # or "lzop" for save_image_format. Note that this means you slow down
# process of saving a domain in order to save disk space. # the process of saving a domain in order to save disk space.
# #
# save_image_format = "raw" # save_image_format = "raw"
...@@ -3483,6 +3483,7 @@ enum qemud_save_formats { ...@@ -3483,6 +3483,7 @@ enum qemud_save_formats {
QEMUD_SAVE_FORMAT_GZIP, QEMUD_SAVE_FORMAT_GZIP,
QEMUD_SAVE_FORMAT_BZIP2, QEMUD_SAVE_FORMAT_BZIP2,
QEMUD_SAVE_FORMAT_LZMA, QEMUD_SAVE_FORMAT_LZMA,
QEMUD_SAVE_FORMAT_LZOP,
}; };
struct qemud_save_header { struct qemud_save_header {
...@@ -3523,6 +3524,8 @@ static int qemudDomainSave(virDomainPtr dom, ...@@ -3523,6 +3524,8 @@ static int qemudDomainSave(virDomainPtr dom,
header.compressed = QEMUD_SAVE_FORMAT_BZIP2; header.compressed = QEMUD_SAVE_FORMAT_BZIP2;
else if (STREQ(driver->saveImageFormat, "lzma")) else if (STREQ(driver->saveImageFormat, "lzma"))
header.compressed = QEMUD_SAVE_FORMAT_LZMA; header.compressed = QEMUD_SAVE_FORMAT_LZMA;
else if (STREQ(driver->saveImageFormat, "lzop"))
header.compressed = QEMUD_SAVE_FORMAT_LZOP;
else { else {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("Invalid save image format specified in configuration file")); "%s", _("Invalid save image format specified in configuration file"));
...@@ -3615,6 +3618,9 @@ static int qemudDomainSave(virDomainPtr dom, ...@@ -3615,6 +3618,9 @@ static int qemudDomainSave(virDomainPtr dom,
else if (header.compressed == QEMUD_SAVE_FORMAT_LZMA) else if (header.compressed == QEMUD_SAVE_FORMAT_LZMA)
internalret = virAsprintf(&command, "migrate \"exec:" internalret = virAsprintf(&command, "migrate \"exec:"
"lzma -c >> '%s' 2>/dev/null\"", safe_path); "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 { else {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
_("Invalid compress format %d"), _("Invalid compress format %d"),
...@@ -4237,6 +4243,8 @@ static int qemudDomainRestore(virConnectPtr conn, ...@@ -4237,6 +4243,8 @@ static int qemudDomainRestore(virConnectPtr conn,
intermediate_argv[0] = "bzip2"; intermediate_argv[0] = "bzip2";
else if (header.compressed == QEMUD_SAVE_FORMAT_LZMA) else if (header.compressed == QEMUD_SAVE_FORMAT_LZMA)
intermediate_argv[0] = "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) { else if (header.compressed != QEMUD_SAVE_FORMAT_RAW) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
_("Unknown compressed save format %d"), _("Unknown compressed save format %d"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册