On 04/20/2014 04:13 PM, Peter Krempa wrote: > Move the code checking the presence of the backing file to the recursive > worker function instead of the metadata parser. The recursive worker > will later be changed to parse more than just local files and this > change will help the separation. > --- > src/util/virstoragefile.c | 63 > ++++++++++++++++++++--------------------------- > 1 file changed, 27 insertions(+), 36 deletions(-) > > diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c > index 513f15d..a005e00 100644 > --- a/src/util/virstoragefile.c > +++ b/src/util/virstoragefile.c > @@ -795,7 +795,7 @@ qcow2GetFeatures(virBitmapPtr *features, > * information about the file and its backing store. */ > static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) > ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(7) > -ATTRIBUTE_NONNULL(8) ATTRIBUTE_NONNULL(9) > +ATTRIBUTE_NONNULL(8)
This hunk belongs in 4/18.
> @@ -1192,7 +1164,26 @@ virStorageFileGetMetadataRecurse(const char *path,
> const char *canonPath,
> ret = 0;
> }
>
> - if (ret == 0 && meta->backingStore) {
> + if (ret == 0 && meta->backingStoreRaw) {
> + if (virStorageIsFile(meta->backingStoreRaw)) {
> + if (virFindBackingFile(directory,
> + meta->backingStoreRaw,
> + &backingDirectory,
> + &meta->backingStore) < 0) {
> + /* the backing file is (currently) unavailable, treat this
> + * file as standalone:
> + * backingStoreRaw is kept to mark broken image chains */
> + VIR_WARN("Backing file '%s' of image '%s' is missing.",
> + meta->backingStoreRaw, path);
> +
> + return 0;
> + }
> + } else {
> + if (VIR_STRDUP(meta->backingStore, meta->backingStoreRaw) < 0)
> + return -1;
> + }
> +
> +
> virStorageFileMetadataPtr backing;
This puts a declaration after statement; if you want, you could squash
this in. Either way, ACK.
diff --git i/src/util/virstoragefile.c w/src/util/virstoragefile.c
index 6f0fb79..82b5c65 100644
--- i/src/util/virstoragefile.c
+++ w/src/util/virstoragefile.c
@@ -1168,6 +1168,8 @@ virStorageFileGetMetadataRecurse(const char *path,
const char *canonPath,
}
if (ret == 0 && meta->backingStoreRaw) {
+ virStorageFileMetadataPtr backing;
+
if (virStorageIsFile(meta->backingStoreRaw)) {
if (virFindBackingFile(directory,
meta->backingStoreRaw,
@@ -1186,9 +1188,6 @@ virStorageFileGetMetadataRecurse(const char *path,
const char *canonPath,
return -1;
}
-
- virStorageFileMetadataPtr backing;
-
if (backingFormat == VIR_STORAGE_FILE_AUTO && !allow_probe)
backingFormat = VIR_STORAGE_FILE_RAW;
else if (backingFormat == VIR_STORAGE_FILE_AUTO_SAFE)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
