On 04/10/14 05:41, Eric Blake wrote:
So far, my work has been merely preserving the status quo of
backing file analysis. But this patch starts to tread in the
territory of making the backing chain code more powerful - we
will eventually support network storage containing non-raw
formats. Here, we expose metadata information about a network
backing store, even if that information is still hardcoded to
a raw format for now.
* src/util/virstoragefile.c (virStorageFileGetMetadataRecurse):
Also populate struct for non-file backing.
(virStorageFileGetMetadata, virStorageFileGetMetadatainternal):
Recognize non-file top image.
(virFindBackingFile): Add comment.
* tests/virstoragetest.c (mymain): Update test to reflect it.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/util/virstoragefile.c | 62 +++++++++++++++++++++++++++++++++++------------
tests/virstoragetest.c | 17 +++++++++----
2 files changed, 59 insertions(+), 20 deletions(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index f5fe8ad..7a91a01 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -874,6 +882,12 @@ virStorageFileGetMetadataInternal(const char
*path,
meta->backingStoreRaw, path);
}
+ } else {
+ if (VIR_STRDUP(meta->backingStoreRaw, backing) < 0) {
+ VIR_FREE(backing);
+ goto cleanup;
+ }
+ backingFormat = VIR_STORAGE_FILE_RAW;
}
VIR_FREE(backing);
meta->backingStoreFormat = backingFormat;
This hunk invalidates the comment in virStorageFileChainCheckBroken, as
currently backing store raw will be set always.
ACK with the comment updated.
Peter