[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Reintroduce lzop compression



>From 3c4f6568623ed420a9e71da33b9ce74abda289a8 Mon Sep 17 00:00:00 2001
From: Charles Duffy <Charles_Duffy dell com>
Date: Wed, 9 Sep 2009 15:53:25 -0500
Subject: [PATCH] Reintroduce support for lzop compression

lzop was removed due to some confusion over whether it provided functional
advantages distinct from xz. This has been addressed in the mailing list post
archived at http://permalink.gmane.org/gmane.comp.emulators.libvirt/16487, and
support for lzop is re-added here.

lzop is added to the enum after xz, leaving xz at the position lzma was
originally in (which is appropriate, as it should handle decompression of
lzma-format files) and giving lzop back its prior position.

Documentation in qemu.conf is amended to remove references to lzma and add
suggestions regarding the tradeoffs made by various compressors.

Signed-off-by: Charles Duffy <charles dyfis net>
---
 libvirt.spec.in   |    1 +
 src/qemu.conf     |    7 ++++---
 src/qemu_driver.c |    9 ++++++---
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index b01f9c2..0157eee 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -117,6 +117,7 @@ Requires: /usr/bin/qemu-img
 # For image compression
 Requires: gzip
 Requires: bzip2
+Requires: lzop
 Requires: xz
 %else
 %if %{with_xen}
diff --git a/src/qemu.conf b/src/qemu.conf
index 342bb8a..6d6b86a 100644
--- a/src/qemu.conf
+++ b/src/qemu.conf
@@ -134,9 +134,10 @@
 # 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", "lzma", "xz",
-# 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.
+# are being saved to disk, you can also set "lzop", "gzip", "bzip2", or "xz"
+# for save_image_format.  Note that this means you slow down the process of
+# saving a domain in order to save disk space; the list above is in descending
+# order by performance and ascending order by compression ratio.
 #
 # save_image_format = "raw"
 
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 8f16e72..5c2a8ec 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -3624,10 +3624,10 @@ enum qemud_save_formats {
     QEMUD_SAVE_FORMAT_BZIP2 = 2,
     /*
      * Deprecated by xz and never used as part of a release
-     * QEMUD_SAVE_FORMAT_LZMA,
-     * QEMUD_SAVE_FORMAT_LZOP,
+     * QEMUD_SAVE_FORMAT_LZMA
      */
     QEMUD_SAVE_FORMAT_XZ = 3,
+    QEMUD_SAVE_FORMAT_LZOP = 4,
     /* Note: add new members only at the end.
        These values are used in the on-disk format.
        Do not change or re-use numbers. */
@@ -3640,7 +3640,8 @@ VIR_ENUM_IMPL(qemudSaveCompression, QEMUD_SAVE_FORMAT_LAST,
               "raw",
               "gzip",
               "bzip2",
-              "xz")
+              "xz",
+              "lzop")
 
 struct qemud_save_header {
     char magic[sizeof(QEMUD_SAVE_MAGIC)-1];
@@ -4384,6 +4385,8 @@ static int qemudDomainRestore(virConnectPtr conn,
             intermediate_argv[0] = "bzip2";
         else if (header.compressed == QEMUD_SAVE_FORMAT_XZ)
             intermediate_argv[0] = "xz";
+        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"),
-- 
1.6.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]