[libvirt] [PATCH v2] qemu: Warning prompt if invalid dump image format specified

Osier Yang jyang at redhat.com
Tue Jan 25 08:42:53 UTC 2011


"getCompressionType" trys to throw error when invalid dump image
format is specified, or the compression program for the specified
image format is not available, but at the same time, it returns
enum qemud_save_formats, as a result, upper function will think
it was successful, and disgard to check the error.

Change "qemuReportError" into "VIR_WARN" instead to let the user
known what happened.

v1 patch is here:
http://www.redhat.com/archives/libvir-list/2011-January/msg00715.html

As it reverted b6f13bb7002da76db15242e1d996e8a6222a754, and it was
intentionally to chose the behavior of falling back to raw if the
compression type is invalid, so simply use "VIR_WARN" to fix the
problem.

* src/qemu/qemu_driver.c
---
 src/qemu/qemu_driver.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 34cc29f..dac71fa 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4806,16 +4806,15 @@ 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"));
+            VIR_WARN("Invalid dump image format '%s' specified in "
+                     "configuration file, using raw",
+                     driver->dumpImageFormat);
             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"));
+            VIR_WARN("Compression program for dump image format '%s' "
+                     "in configuration file isn't available, using raw",
+                     driver->dumpImageFormat);
             return QEMUD_SAVE_FORMAT_RAW;
         }
     }
--
1.7.3.2




More information about the libvir-list mailing list