Avoid breaking gluster volumes that don't have local representation. Use
the provided name when canonicalization fails. Broken by commit 79f11b35
Fixes:
$ virsh pool-start glusterpool
error: Failed to start pool glusterpool
error: unable to resolve 'asdf': No such file or directory
---
src/util/virstoragefile.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 5fbb6e7..c707200 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1012,10 +1012,12 @@ virStorageFileGetMetadataFromBuf(const char *path,
virStorageFileMetadataPtr ret = NULL;
char *canonPath;
- if (!(canonPath = canonicalize_file_name(path))) {
+ if (!(canonPath = canonicalize_file_name(path)) &&
+ VIR_STRDUP(canonPath, path) < 0) {
virReportSystemError(errno, _("unable to resolve '%s'"),
path);
return NULL;
}
+
if (VIR_ALLOC(ret) < 0)
goto cleanup;
--
1.9.1