Chris Lalancette wrote: > Jim Meyering wrote: >> While this patch stays minimal by simply adding XZ/xz to the list, >> I think it would be better to remove lzma, since it uses >> an inferior format (which lacks an integrity check), and >> has been effectively subsumed by xz. >> >> Let me know if you'd like that, and I'll prepare the slightly >> more invasive patch. > > I'm on the fence about it. While I do understand the situation now (thanks for > explaining), I think keeping lzma for compatibility with older distros might be > a good idea. Either way, we have to keep the LZMA slot in the enum "free", > since it's part of the on-disk ABI for the save format. And on that note... > >> diff --git a/src/qemu_driver.c b/src/qemu_driver.c >> index f64d70b..7b64712 100644 >> --- a/src/qemu_driver.c >> +++ b/src/qemu_driver.c >> @@ -3622,7 +3622,8 @@ enum qemud_save_formats { >> QEMUD_SAVE_FORMAT_RAW, >> QEMUD_SAVE_FORMAT_GZIP, >> QEMUD_SAVE_FORMAT_BZIP2, >> - QEMUD_SAVE_FORMAT_LZMA, >> + QEMUD_SAVE_FORMAT_LZMA, /* deprecated, in favor of xz */ >> + QEMUD_SAVE_FORMAT_XZ, >> QEMUD_SAVE_FORMAT_LZOP, >> }; > > You'll need to add QEMUD_SAVE_FORMAT_XZ to the end of the enum, to maintain > on-disk compatibility. Otherwise it looks good. Thanks. Good point. Here's an amended patch: Note, I've reordered the if/else placement to match enum member ordering, too. >From 24309516094b058cce9f5eb123877bd5eec2cfc2 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@xxxxxxxxxx> Date: Tue, 8 Sep 2009 20:52:37 +0200 Subject: [PATCH] also allow use of XZ for Qemu image compression * src/qemu_driver.c (enum qemud_save_formats) [QEMUD_SAVE_FORMAT_XZ]: New member. [QEMUD_SAVE_FORMAT_LZMA]: Mark as deprecated. (qemudDomainSave, qemudDomainRestore): Handle the new member. * src/qemu.conf: Mention xz, too. --- src/qemu.conf | 2 +- src/qemu_driver.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/qemu.conf b/src/qemu.conf index 06babc4..342bb8a 100644 --- a/src/qemu.conf +++ b/src/qemu.conf @@ -134,7 +134,7 @@ # 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" +# 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. # diff --git a/src/qemu_driver.c b/src/qemu_driver.c index f64d70b..99b3390 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -3622,8 +3622,9 @@ enum qemud_save_formats { QEMUD_SAVE_FORMAT_RAW, QEMUD_SAVE_FORMAT_GZIP, QEMUD_SAVE_FORMAT_BZIP2, - QEMUD_SAVE_FORMAT_LZMA, + QEMUD_SAVE_FORMAT_LZMA, /* deprecated, in favor of xz */ QEMUD_SAVE_FORMAT_LZOP, + QEMUD_SAVE_FORMAT_XZ, }; struct qemud_save_header { @@ -3666,6 +3667,8 @@ static int qemudDomainSave(virDomainPtr dom, header.compressed = QEMUD_SAVE_FORMAT_LZMA; else if (STREQ(driver->saveImageFormat, "lzop")) header.compressed = QEMUD_SAVE_FORMAT_LZOP; + else if (STREQ(driver->saveImageFormat, "xz")) + header.compressed = QEMUD_SAVE_FORMAT_XZ; else { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "%s", _("Invalid save image format specified in configuration file")); @@ -3761,6 +3764,9 @@ static int qemudDomainSave(virDomainPtr dom, else if (header.compressed == QEMUD_SAVE_FORMAT_LZOP) internalret = virAsprintf(&command, "migrate \"exec:" "lzop -c >> '%s' 2>/dev/null\"", safe_path); + else if (header.compressed == QEMUD_SAVE_FORMAT_XZ) + internalret = virAsprintf(&command, "migrate \"exec:" + "xz -c >> '%s' 2>/dev/null\"", safe_path); else { qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, _("Invalid compress format %d"), @@ -4385,6 +4391,8 @@ static int qemudDomainRestore(virConnectPtr conn, 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) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, _("Unknown compressed save format %d"), -- 1.6.5.rc0.164.g5f6b0 -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list