[libvirt] Re: [PATCH] also allow use of XZ for Qemu image compression

Daniel Veillard veillard at redhat.com
Wed Sep 9 13:01:14 UTC 2009


On Wed, Sep 09, 2009 at 12:08:13PM +0200, Jim Meyering wrote:
> Daniel Veillard wrote:
> 
> > On Wed, Sep 09, 2009 at 11:57:40AM +0200, Jim Meyering wrote:
> >> Daniel Veillard wrote:
> >> >   Hum, I realize that support of LZOP was added after 0.7.0, so we never
> >> > made a release with it (well except for git snapshot which may have been
> >> > pushed).
> >> >   I wonder if the best is not to just drop the lzop option altogether
> >> > and stick xz as a package dependancy until we have found a way to
> >> > provide at the API level which compression options are actually
> >> > available.
> >> >
> >> >   Opinions ?
> >>
> >> Dropping lzop sounds good.  It seems lzop is not very popular.
> >> We don't need that many choices.
> >>
> >> Maybe even nuke lzma too before we're stuck with it forever.
> >> Technically, we can do that, since it was added only a month ago,
> >> also after 0.7.0:
> >>
> >>   v0.7.0-35-g2d6a581
> >
> > Actually om my machine here lzma is provided as a backward compat option
> > by xz, so yes I'm inclined to remove that option too:
> >
> > aphio:~ -> which lzma
> > /usr/bin/lzma
> > paphio:~ -> rpm -qf /usr/bin/lzma
> > xz-lzma-compat-4.999.8-0.8.beta.20090817git.fc11.x86_64
> >
> > I will post a patch later,
> 
> FYI, xz can decompress lzma-compressed input:
> 
>   $ echo foooo |lzma -c|xz -dc
>   foooo
> 
> so libvirt won't need the "lzma" command, as long as xz is available.

  Okay, I suggest the following patch removing the 2 extra compressors
and making sure the package including the daemon, if compiled with qemu
has the proper dependancies.
  xz package dependancy is IMHO a small price to pay: Size: 443012
to garantee reliability and bzip2 and gzip are so standard that it
should not be a problem for anybody to list them explicitely.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
-------------- next part --------------
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 9371898..b01f9c2 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -114,6 +114,10 @@ Requires: glusterfs-client >= 2.0.1
 %if %{with_qemu}
 # From QEMU RPMs
 Requires: /usr/bin/qemu-img
+# For image compression
+Requires: gzip
+Requires: bzip2
+Requires: xz
 %else
 %if %{with_xen}
 # From Xen RPMs
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 9a9ae73..8f16e72 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -3622,9 +3622,12 @@ enum qemud_save_formats {
     QEMUD_SAVE_FORMAT_RAW = 0,
     QEMUD_SAVE_FORMAT_GZIP = 1,
     QEMUD_SAVE_FORMAT_BZIP2 = 2,
-    QEMUD_SAVE_FORMAT_LZMA = 3,  /* deprecated, in favor of xz */
-    QEMUD_SAVE_FORMAT_LZOP = 4,
-    QEMUD_SAVE_FORMAT_XZ = 5,
+    /*
+     * Deprecated by xz and never used as part of a release
+     * QEMUD_SAVE_FORMAT_LZMA,
+     * QEMUD_SAVE_FORMAT_LZOP,
+     */
+    QEMUD_SAVE_FORMAT_XZ = 3,
     /* Note: add new members only at the end.
        These values are used in the on-disk format.
        Do not change or re-use numbers. */
@@ -3637,8 +3640,6 @@ VIR_ENUM_IMPL(qemudSaveCompression, QEMUD_SAVE_FORMAT_LAST,
               "raw",
               "gzip",
               "bzip2",
-              "lzma",
-              "lzop",
               "xz")
 
 struct qemud_save_header {
@@ -4381,10 +4382,6 @@ static int qemudDomainRestore(virConnectPtr conn,
             intermediate_argv[0] = "gzip";
         else if (header.compressed == QEMUD_SAVE_FORMAT_BZIP2)
             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_XZ)
             intermediate_argv[0] = "xz";
         else if (header.compressed != QEMUD_SAVE_FORMAT_RAW) {


More information about the libvir-list mailing list