]> xenbits.xensource.com Git - libvirt.git/commitdiff
support lzop save compression for qemu
authorCharles Duffy <charles@dyfis.net>
Fri, 28 Aug 2009 18:13:47 +0000 (13:13 -0500)
committerChris Lalancette <clalance@redhat.com>
Mon, 31 Aug 2009 19:11:51 +0000 (21:11 +0200)
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: Charles Duffy <Charles_Duffy@dell.com>
Signed-off-by: Chris Lalancette <clalance@redhat.com>
src/qemu.conf
src/qemu_driver.c

index 1f10b43e53b1c78a4426381e601b5f25a3cf4aa9..9aecc2637e5329e67771fbae52c5df99f17620a4 100644 (file)
 # 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"
index f51430761aaa272ff7406b4cec8deb5a0581fd15..3ebe8020e287ff4f2ecb2e9675193f0cbad2a77e 100644 (file)
@@ -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"),