[libvirt] [PATCH] support lzop save compression for qemu

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

 



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@xxxxxxxx>
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@xxxxxxxx>
---
 src/qemu_driver.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index eb22940..cbbedd3 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -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"),
-- 
1.6.4

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]