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

[libvirt] [PATCH] provide the object name on lookup error



  There were a number of places where the object name was not not
reported, based on the use I don't think the string could be NULL
in any of those. I also fixed a few POOL error which were really
VOLume ones.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
diff --git a/src/network_driver.c b/src/network_driver.c
index c5c4c2d..9621782 100644
--- a/src/network_driver.c
+++ b/src/network_driver.c
@@ -971,7 +971,7 @@ static virNetworkPtr networkLookupByName(virConnectPtr conn,
     networkDriverUnlock(driver);
     if (!network) {
         networkReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK,
-                         "%s", _("no network with matching name"));
+                         _("no network with matching name '%s'"), name);
         goto cleanup;
     }
 
diff --git a/src/node_device.c b/src/node_device.c
index e0aaefc..74e7a4f 100644
--- a/src/node_device.c
+++ b/src/node_device.c
@@ -280,7 +280,8 @@ static char *nodeDeviceDumpXML(virNodeDevicePtr dev,
 
     if (!obj) {
         virNodeDeviceReportError(dev->conn, VIR_ERR_INVALID_NODE_DEVICE,
-                              "%s", _("no node device with matching name"));
+                                _("no node device with matching name '%s'"),
+                                 dev->name);
         goto cleanup;
     }
 
@@ -308,7 +309,8 @@ static char *nodeDeviceGetParent(virNodeDevicePtr dev)
 
     if (!obj) {
         virNodeDeviceReportError(dev->conn, VIR_ERR_INVALID_NODE_DEVICE,
-                              "%s", _("no node device with matching name"));
+                                _("no node device with matching name '%s'"),
+                                 dev->name);
         goto cleanup;
     }
 
@@ -342,7 +344,8 @@ static int nodeDeviceNumOfCaps(virNodeDevicePtr dev)
 
     if (!obj) {
         virNodeDeviceReportError(dev->conn, VIR_ERR_INVALID_NODE_DEVICE,
-                              "%s", _("no node device with matching name"));
+                                _("no node device with matching name '%s'"),
+                                 dev->name);
         goto cleanup;
     }
 
@@ -372,7 +375,8 @@ nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames)
 
     if (!obj) {
         virNodeDeviceReportError(dev->conn, VIR_ERR_INVALID_NODE_DEVICE,
-                              "%s", _("no node device with matching name"));
+                                _("no node device with matching name '%s'"),
+                                 dev->name);
         goto cleanup;
     }
 
diff --git a/src/storage_driver.c b/src/storage_driver.c
index 5a26993..49e2c84 100644
--- a/src/storage_driver.c
+++ b/src/storage_driver.c
@@ -295,7 +295,7 @@ storagePoolLookupByName(virConnectPtr conn,
 
     if (!pool) {
         virStorageReportError(conn, VIR_ERR_NO_STORAGE_POOL,
-                              "%s", _("no pool with matching name"));
+                              _("no pool with matching name '%s'"), name);
         goto cleanup;
     }
 
@@ -1099,8 +1099,9 @@ storageVolumeLookupByName(virStoragePoolPtr obj,
     vol = virStorageVolDefFindByName(pool, name);
 
     if (!vol) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
-                              "%s", _("no storage vol with matching name"));
+        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_VOL,
+                             _("no storage vol with matching name '%s'"),
+                              name);
         goto cleanup;
     }
 
@@ -1340,7 +1341,8 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
 
     if (diffpool && !origpool) {
         virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
-                              "%s", _("no storage pool with matching name"));
+                             _("no storage pool with matching name '%s'"),
+                              vobj->pool);
         goto cleanup;
     }
 
@@ -1361,8 +1363,9 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
 
     origvol = virStorageVolDefFindByName(origpool, vobj->name);
     if (!origvol) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
-                              "%s", _("no storage vol with matching name"));
+        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_VOL,
+                             _("no storage vol with matching name '%s'"),
+                              vobj->name);
         goto cleanup;
     }
 
@@ -1501,8 +1504,9 @@ storageVolumeDelete(virStorageVolPtr obj,
     vol = virStorageVolDefFindByName(pool, obj->name);
 
     if (!vol) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
-                              "%s", _("no storage vol with matching name"));
+        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_VOL,
+                             _("no storage vol with matching name '%s'"),
+                              obj->name);
         goto cleanup;
     }
 
@@ -1576,8 +1580,9 @@ storageVolumeGetInfo(virStorageVolPtr obj,
     vol = virStorageVolDefFindByName(pool, obj->name);
 
     if (!vol) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
-                              "%s", _("no storage vol with matching name"));
+        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_VOL,
+                             _("no storage vol with matching name '%s'"),
+                              obj->name);
         goto cleanup;
     }
 
@@ -1628,8 +1633,9 @@ storageVolumeGetXMLDesc(virStorageVolPtr obj,
     vol = virStorageVolDefFindByName(pool, obj->name);
 
     if (!vol) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
-                              "%s", _("no storage vol with matching name"));
+        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_VOL,
+                             _("no storage vol with matching name '%s'"),
+                              obj->name);
         goto cleanup;
     }
 
@@ -1674,8 +1680,9 @@ storageVolumeGetPath(virStorageVolPtr obj) {
     vol = virStorageVolDefFindByName(pool, obj->name);
 
     if (!vol) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
-                              "%s", _("no storage vol with matching name"));
+        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_VOL,
+                             _("no storage vol with matching name '%s'"),
+                              obj->name);
         goto cleanup;
     }
 

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