[PATCH 1/3] storage: Don't lie about path used to look up in error message

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

 



In storageVolLookupByPath the provided path is "sanitized" at first.
This removes some extra slashes and stuff. When the lookup of the volume
fails the original path is used which makes it hard to trace errors in
some cases.

Improve the error message to print the sanitized path along with the
user provided path if they are not equal.
---
 src/storage/storage_driver.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index e0ebdb0..42cb397 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1484,9 +1484,15 @@ storageVolLookupByPath(virConnectPtr conn,
         virStoragePoolObjUnlock(driver->pools.objs[i]);
     }

-    if (!ret)
-        virReportError(VIR_ERR_NO_STORAGE_VOL,
-                       _("no storage vol with matching path %s"), path);
+    if (!ret) {
+        if (STREQ(path, cleanpath)) {
+            virReportError(VIR_ERR_NO_STORAGE_VOL,
+                           _("no storage vol with matching path '%s'"), path);
+        } else {
+            virReportError(VIR_ERR_NO_STORAGE_VOL,
+                           _("no storage vol with matching path '%s' (%s)"), path, cleanpath);
+        }
+    }

 cleanup:
     VIR_FREE(cleanpath);
-- 
1.8.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]