[libvirt] [PATCH] qemu: Remove bogus codes in function getCompressionType

Osier Yang jyang at redhat.com
Tue Jul 26 07:04:04 UTC 2011


The error will never be reported, remove the codes, and also
improve the docs in qemu.conf to tell user the truth.
---
 src/qemu/qemu.conf     |    4 ++++
 src/qemu/qemu_driver.c |   16 +++++-----------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 145062c..75d945b 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -199,6 +199,10 @@
 # save_image_format is used when you use 'virsh save' at scheduled saving.
 # dump_image_format is used when you use 'virsh dump' at emergency crashdump.
 #
+# If the specified format is not valid (the valid formats are "raw", "lzop",
+# "gzip", "bzip2", and "xz"), or the compress program is not available, "raw"
+# will be used as the format silently without error or warning.
+#
 # save_image_format = "raw"
 # dump_image_format = "raw"
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b928004..48fc46a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2712,19 +2712,13 @@ getCompressionType(struct qemud_driver *driver)
      */
     if (driver->dumpImageFormat) {
         compress = qemudSaveCompressionTypeFromString(driver->dumpImageFormat);
-        if (compress < 0) {
-            qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                            _("Invalid dump image format specified in "
-                              "configuration file, using raw"));
+        /* Use "raw" as the format if the specified format is not valid,
+         * or the compress program is not available,
+         */
+        if (compress < 0)
             return QEMUD_SAVE_FORMAT_RAW;
-        }
-        if (!qemudCompressProgramAvailable(compress)) {
-            qemuReportError(VIR_ERR_OPERATION_FAILED,
-                            "%s", _("Compression program for dump image format "
-                                    "in configuration file isn't available, "
-                                    "using raw"));
+        if (!qemudCompressProgramAvailable(compress))
             return QEMUD_SAVE_FORMAT_RAW;
-        }
     }
     return compress;
 }
-- 
1.7.6




More information about the libvir-list mailing list