From: Peter Krempa Date: Mon, 24 Feb 2014 15:07:40 +0000 (+0100) Subject: storage: Don't lie about path used to look up in error message X-Git-Tag: v1.2.3-rc1~345 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46446313e8d8021849081bca097ab9195a604bb8;p=thirdparty%2Flibvirt.git storage: Don't lie about path used to look up in error message 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. --- diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 8b5aaab4d5..7dbff6ce25 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -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);