depth++;
nextpath = meta.backingStore;
+ /* Stop iterating if we reach a non-file backing store */
+ if (nextpath && !meta.backingStoreIsFile) {
+ VIR_DEBUG("Stopping iteration on non-file backing store: %s",
+ nextpath);
+ break;
+ }
+
format = meta.backingStoreFormat;
if (format == VIR_STORAGE_FILE_AUTO &&
return true;
}
+static bool
+virBackingStoreIsFile(const char *backing)
+{
+ /* Backing store is a network block device */
+ if (STRPREFIX(backing, "nbd:"))
+ return false;
+ return true;
+}
static int
virStorageFileGetMetadataFromBuf(int format,
if (ret == BACKING_STORE_ERROR)
return -1;
+ meta->backingStoreIsFile = false;
if (backing != NULL) {
- meta->backingStore = absolutePathFromBaseFile(path, backing);
+ if (virBackingStoreIsFile(backing)) {
+ meta->backingStoreIsFile = true;
+ meta->backingStore = absolutePathFromBaseFile(path, backing);
+ } else {
+ meta->backingStore = strdup(backing);
+ }
VIR_FREE(backing);
if (meta->backingStore == NULL) {
virReportOOMError();
typedef struct _virStorageFileMetadata {
char *backingStore;
int backingStoreFormat;
+ bool backingStoreIsFile;
unsigned long long capacity;
bool encrypted;
} virStorageFileMetadata;