[libvirt] [PATCH 05/12] storage_conf: Put "%s" at the same line with error type

Osier Yang jyang at redhat.com
Wed May 22 12:05:15 UTC 2013


Trivial, but it allows the "error message" to have more spaces.
---
 src/conf/storage_conf.c | 95 ++++++++++++++++++++++++-------------------------
 1 file changed, 47 insertions(+), 48 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 5c8577e..76dae52 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -446,15 +446,15 @@ virStoragePoolDefParseAuthChap(xmlXPathContextPtr ctxt,
 {
     auth->login = virXPathString("string(./auth/@login)", ctxt);
     if (auth->login == NULL) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       "%s", _("missing auth login attribute"));
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("missing auth login attribute"));
         return -1;
     }
 
     auth->passwd = virXPathString("string(./auth/@passwd)", ctxt);
     if (auth->passwd == NULL) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       "%s", _("missing auth passwd attribute"));
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("missing auth passwd attribute"));
         return -1;
     }
 
@@ -470,8 +470,8 @@ virStoragePoolDefParseAuthCephx(xmlXPathContextPtr ctxt,
 
     auth->username = virXPathString("string(./auth/@username)", ctxt);
     if (auth->username == NULL) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       "%s", _("missing auth username attribute"));
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("missing auth username attribute"));
         return -1;
     }
 
@@ -490,8 +490,8 @@ virStoragePoolDefParseAuthCephx(xmlXPathContextPtr ctxt,
             goto cleanup;
         }
         if (virUUIDParse(uuid, auth->secret.uuid) < 0) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           "%s", _("invalid auth secret uuid"));
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("invalid auth secret uuid"));
             goto cleanup;
         }
         auth->secret.uuidUsable = true;
@@ -564,8 +564,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
         for (i = 0; i < source->nhost; i++) {
             name = virXMLPropString(nodeset[i], "name");
             if (name == NULL) {
-                virReportError(VIR_ERR_XML_ERROR,
-                               "%s", _("missing storage pool host name"));
+                virReportError(VIR_ERR_XML_ERROR, "%s",
+                               _("missing storage pool host name"));
                 goto cleanup;
             }
             source->hosts[i].name = name;
@@ -600,8 +600,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
             char *path = virXMLPropString(nodeset[i], "path");
             if (path == NULL) {
                 VIR_FREE(nodeset);
-                virReportError(VIR_ERR_XML_ERROR,
-                               "%s", _("missing storage pool source device path"));
+                virReportError(VIR_ERR_XML_ERROR, "%s",
+                               _("missing storage pool source device path"));
                 goto cleanup;
             }
             source->devices[i].path = path;
@@ -773,8 +773,8 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
 
         if (virStrToLong_i(mode, NULL, 8, &tmp) < 0 || (tmp & ~0777)) {
             VIR_FREE(mode);
-            virReportError(VIR_ERR_XML_ERROR,
-                           "%s", _("malformed octal mode"));
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("malformed octal mode"));
             goto error;
         }
         perms->mode = tmp;
@@ -785,8 +785,8 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
         perms->uid = (uid_t) -1;
     } else {
         if (virXPathLong("number(./owner)", ctxt, &v) < 0) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           "%s", _("malformed owner element"));
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("malformed owner element"));
             goto error;
         }
         perms->uid = (int)v;
@@ -796,8 +796,8 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
         perms->gid = (gid_t) -1;
     } else {
         if (virXPathLong("number(./group)", ctxt, &v) < 0) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           "%s", _("malformed group element"));
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("malformed group element"));
             goto error;
         }
         perms->gid = (int)v;
@@ -853,22 +853,22 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
         options->flags & VIR_STORAGE_POOL_SOURCE_NAME)
         ret->name = ret->source.name;
     if (ret->name == NULL) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       "%s", _("missing pool source name element"));
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("missing pool source name element"));
         goto cleanup;
     }
 
     uuid = virXPathString("string(./uuid)", ctxt);
     if (uuid == NULL) {
         if (virUUIDGenerate(ret->uuid) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("unable to generate uuid"));
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                           _("unable to generate uuid"));
             goto cleanup;
         }
     } else {
         if (virUUIDParse(uuid, ret->uuid) < 0) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           "%s", _("malformed uuid element"));
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("malformed uuid element"));
             goto cleanup;
         }
         VIR_FREE(uuid);
@@ -876,8 +876,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
 
     if (options->flags & VIR_STORAGE_POOL_SOURCE_HOST) {
         if (!ret->source.nhost) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           "%s",
+            virReportError(VIR_ERR_XML_ERROR, "%s",
                            _("missing storage pool source host name"));
             goto cleanup;
         }
@@ -885,8 +884,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
 
     if (options->flags & VIR_STORAGE_POOL_SOURCE_DIR) {
         if (!ret->source.dir) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           "%s", _("missing storage pool source path"));
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("missing storage pool source path"));
             goto cleanup;
         }
     }
@@ -924,8 +923,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
         } else if (ret->source.adapter.type ==
                    VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
             if (!ret->source.adapter.data.name) {
-                virReportError(VIR_ERR_XML_ERROR,
-                               "%s", _("missing storage pool source adapter name"));
+                virReportError(VIR_ERR_XML_ERROR, "%s",
+                               _("missing storage pool source adapter name"));
                 goto cleanup;
             }
         }
@@ -934,8 +933,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
     /* If DEVICE is the only source type, then its required */
     if (options->flags == VIR_STORAGE_POOL_SOURCE_DEVICE) {
         if (!ret->source.ndevice) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           "%s", _("missing storage pool source device name"));
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("missing storage pool source device name"));
             goto cleanup;
         }
     }
@@ -944,8 +943,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
      * path and permissions */
     if (!(options->flags & VIR_STORAGE_POOL_SOURCE_NETWORK)) {
         if ((tmppath = virXPathString("string(./target/path)", ctxt)) == NULL) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           "%s", _("missing storage pool target path"));
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("missing storage pool target path"));
             goto cleanup;
         }
         ret->target.path = virFileSanitizePath(tmppath);
@@ -1155,8 +1154,8 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def)
 
     type = virStoragePoolTypeToString(def->type);
     if (!type) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("unexpected pool type"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("unexpected pool type"));
         goto cleanup;
     }
     virBufferAsprintf(&buf, "<pool type='%s'>\n", type);
@@ -1220,8 +1219,8 @@ virStorageSize(const char *unit,
                unsigned long long *ret)
 {
     if (virStrToLong_ull(val, NULL, 10, ret) < 0) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       "%s", _("malformed capacity element"));
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("malformed capacity element"));
         return -1;
     }
     /* off_t is signed, so you cannot create a file larger than 2**63
@@ -1254,8 +1253,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
 
     ret->name = virXPathString("string(./name)", ctxt);
     if (ret->name == NULL) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       "%s", _("missing volume name element"));
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("missing volume name element"));
         goto cleanup;
     }
 
@@ -1265,8 +1264,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
     capacity = virXPathString("string(./capacity)", ctxt);
     unit = virXPathString("string(./capacity/@unit)", ctxt);
     if (capacity == NULL) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       "%s", _("missing capacity element"));
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("missing capacity element"));
         goto cleanup;
     }
     if (virStorageSize(unit, capacity, &ret->capacity) < 0)
@@ -1666,8 +1665,8 @@ virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
     }
 
     if (virMutexInit(&pool->lock) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("cannot initialize mutex"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("cannot initialize mutex"));
         VIR_FREE(pool);
         return NULL;
     }
@@ -1815,8 +1814,8 @@ virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
     }
 
     if (!(xml = virStoragePoolDefFormat(def))) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("failed to generate XML"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("failed to generate XML"));
         return -1;
     }
 
@@ -1878,8 +1877,8 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
 
     type = virStoragePoolTypeToString(def->type);
     if (!type) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("unexpected pool type"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("unexpected pool type"));
         goto cleanup;
     }
 
-- 
1.8.1.4




More information about the libvir-list mailing list