|
|
9119d9 |
From a6d413271d9e0467ba32561bb1b8f3412bdfdc69 Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <a6d413271d9e0467ba32561bb1b8f3412bdfdc69@dist-git>
|
|
|
9119d9 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
9119d9 |
Date: Wed, 24 Sep 2014 11:01:30 +0200
|
|
|
9119d9 |
Subject: [PATCH] storage: Improve error message when traversing backing chains
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1138231
|
|
|
9119d9 |
|
|
|
9119d9 |
Report also the name of the parent file and uid/gid used to access it to
|
|
|
9119d9 |
help debugging broken storage configurations.
|
|
|
9119d9 |
|
|
|
9119d9 |
(cherry picked from commit eaf43e37552e6b40468b72b2819d9b7a5874095e)
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/storage/storage_driver.c | 20 +++++++++++++++-----
|
|
|
9119d9 |
1 file changed, 15 insertions(+), 5 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
|
|
|
9119d9 |
index c3b29c4..7c518bf 100644
|
|
|
9119d9 |
--- a/src/storage/storage_driver.c
|
|
|
9119d9 |
+++ b/src/storage/storage_driver.c
|
|
|
9119d9 |
@@ -2781,6 +2781,7 @@ virStorageFileChown(virStorageSourcePtr src,
|
|
|
9119d9 |
/* Recursive workhorse for virStorageFileGetMetadata. */
|
|
|
9119d9 |
static int
|
|
|
9119d9 |
virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
|
|
|
9119d9 |
+ virStorageSourcePtr parent,
|
|
|
9119d9 |
uid_t uid, gid_t gid,
|
|
|
9119d9 |
bool allow_probe,
|
|
|
9119d9 |
bool report_broken,
|
|
|
9119d9 |
@@ -2805,9 +2806,18 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
|
|
|
9119d9 |
return -1;
|
|
|
9119d9 |
|
|
|
9119d9 |
if (virStorageFileAccess(src, F_OK) < 0) {
|
|
|
9119d9 |
- virReportSystemError(errno,
|
|
|
9119d9 |
- _("Cannot access backing file %s"),
|
|
|
9119d9 |
- src->path);
|
|
|
9119d9 |
+ if (src == parent) {
|
|
|
9119d9 |
+ virReportSystemError(errno,
|
|
|
9119d9 |
+ _("Cannot access storage file '%s' "
|
|
|
9119d9 |
+ "(as uid:%d, gid:%d)"),
|
|
|
9119d9 |
+ src->path, (int)uid, (int)gid);
|
|
|
9119d9 |
+ } else {
|
|
|
9119d9 |
+ virReportSystemError(errno,
|
|
|
9119d9 |
+ _("Cannot access backing file '%s' "
|
|
|
9119d9 |
+ "of storage file '%s' (as uid:%d, gid:%d)"),
|
|
|
9119d9 |
+ src->path, parent->path, (int)uid, (int)gid);
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
@@ -2848,7 +2858,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
|
|
|
9119d9 |
else
|
|
|
9119d9 |
backingStore->format = backingFormat;
|
|
|
9119d9 |
|
|
|
9119d9 |
- if ((ret = virStorageFileGetMetadataRecurse(backingStore,
|
|
|
9119d9 |
+ if ((ret = virStorageFileGetMetadataRecurse(backingStore, parent,
|
|
|
9119d9 |
uid, gid,
|
|
|
9119d9 |
allow_probe, report_broken,
|
|
|
9119d9 |
cycle)) < 0) {
|
|
|
9119d9 |
@@ -2912,7 +2922,7 @@ virStorageFileGetMetadata(virStorageSourcePtr src,
|
|
|
9119d9 |
if (src->format <= VIR_STORAGE_FILE_NONE)
|
|
|
9119d9 |
src->format = allow_probe ? VIR_STORAGE_FILE_AUTO : VIR_STORAGE_FILE_RAW;
|
|
|
9119d9 |
|
|
|
9119d9 |
- ret = virStorageFileGetMetadataRecurse(src, uid, gid,
|
|
|
9119d9 |
+ ret = virStorageFileGetMetadataRecurse(src, src, uid, gid,
|
|
|
9119d9 |
allow_probe, report_broken, cycle);
|
|
|
9119d9 |
|
|
|
9119d9 |
virHashFree(cycle);
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.1
|
|
|
9119d9 |
|