]> xenbits.xensource.com Git - libvirt.git/commitdiff
Because of my patch last week that converted the various virStorage*FromString
authorChris Lalancette <clalance@redhat.com>
Tue, 21 Oct 2008 17:18:45 +0000 (17:18 +0000)
committerChris Lalancette <clalance@redhat.com>
Tue, 21 Oct 2008 17:18:45 +0000 (17:18 +0000)
and virStorage*ToString implementations to the generic VIR_ENUM_IMPL, there were
a couple of places that didn't properly set errors when they failed.  This patch
fixes these places up.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
ChangeLog
src/storage_conf.c

index eefc6664eafc90de07a03575e8ee43a1e04c34cb..97acbd041ac8c4a80076a65866034d4a93acfd57 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Oct 21 19:18:00 CEST 2008 Chris Lalancette <clalance@redhat.com>
+       * src/storage_conf.c: Make sure to set errors on paths where
+         ->formatToString() or ->formatFromString() fail.
+
 Tue Oct 21 19:13:00 CEST 2008 Chris Lalancette <clalance@redhat.com>
        * src/qemu_driver.c src/storage_conf.c src/network_driver.c
          src/storage_driver.c: Shore up the uses of virGetLastError() so that
index 23e7538f0c7b5c9f047ea695d6f49a549f066d29..792e740ff48dd506825998f1772be62b2d56927b 100644 (file)
@@ -276,6 +276,8 @@ virStoragePoolDefParseDoc(virConnectPtr conn,
     if (options->formatFromString) {
         char *format = virXPathString(conn, "string(/pool/source/format/@type)", ctxt);
         if ((ret->source.format = (options->formatFromString)(format)) < 0) {
+            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+                                  _("unknown pool format type %s"), format);
             VIR_FREE(format);
             goto cleanup;
         }
@@ -521,8 +523,12 @@ virStoragePoolDefFormat(virConnectPtr conn,
 
     if (options->formatToString) {
         const char *format = (options->formatToString)(def->source.format);
-        if (!format)
+        if (!format) {
+            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                                  _("unknown pool format number %d"),
+                                  def->source.format);
             goto cleanup;
+        }
         virBufferVSprintf(&buf,"    <format type='%s'/>\n", format);
     }
 
@@ -751,6 +757,8 @@ virStorageVolDefParseDoc(virConnectPtr conn,
     if (options->formatFromString) {
         char *format = virXPathString(conn, "string(/volume/target/format/@type)", ctxt);
         if ((ret->target.format = (options->formatFromString)(format)) < 0) {
+            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+                                  _("unknown volume format type %s"), format);
             VIR_FREE(format);
             goto cleanup;
         }
@@ -885,8 +893,12 @@ virStorageVolDefFormat(virConnectPtr conn,
 
     if (options->formatToString) {
         const char *format = (options->formatToString)(def->target.format);
-        if (!format)
+        if (!format) {
+            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                                  _("unknown volume format number %d"),
+                                  def->target.format);
             goto cleanup;
+        }
         virBufferVSprintf(&buf,"    <format type='%s'/>\n", format);
     }