]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: Don't lie about path used to look up in error message
authorPeter Krempa <pkrempa@redhat.com>
Mon, 24 Feb 2014 15:07:40 +0000 (16:07 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 5 Mar 2014 08:22:09 +0000 (09:22 +0100)
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

index 8b5aaab4d5c817f8fdb211149149dc3547f48aa1..7dbff6ce25d3304c962ec3774af4b942284e287b 100644 (file)
@@ -1508,9 +1508,16 @@ storageVolLookupByPath(virConnectPtr conn,
         virStoragePoolObjUnlock(pool);
     }
 
-    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);