1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

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.
This commit is contained in:
Peter Krempa 2014-02-24 16:07:40 +01:00
parent 7fb3902b0f
commit 46446313e8

View 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);