From ee4d2df87d5a1d9a914d4f9c24d1b6c8a377c6aa Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 12 Oct 2017 20:31:33 +0200 Subject: [PATCH] storage: Fill in 'type' field for virStorageSource in storage driver Storage driver uses virStorageSource only partially to store it's configuration but fully when parsing backing files of storage volumes. This patch sets the 'type' field to a value other than VIR_STORAGE_TYPE_NONE so that further patches can add a terminator element to backing chains without breaking iteration. --- src/conf/storage_conf.c | 4 ++++ src/storage/storage_backend_gluster.c | 2 ++ src/storage/storage_backend_logical.c | 1 + 3 files changed, 7 insertions(+) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index c35fa0e15c..7c373e7810 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1109,6 +1109,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, if (VIR_ALLOC(ret) < 0) return NULL; + ret->target.type = VIR_STORAGE_TYPE_FILE; + ret->name = virXPathString("string(./name)", ctxt); if (ret->name == NULL) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -1133,6 +1135,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, if (VIR_ALLOC(ret->target.backingStore) < 0) goto error; + ret->target.backingStore->type = VIR_STORAGE_TYPE_FILE; + ret->target.backingStore->path = backingStore; backingStore = NULL; diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index eac771b42f..5eea84f16e 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -306,6 +306,8 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state, if (VIR_ALLOC(vol->target.backingStore) < 0) goto cleanup; + vol->target.backingStore->type = VIR_STORAGE_TYPE_NETWORK; + vol->target.backingStore->path = meta->backingStoreRaw; if (backingFormat < 0) diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index 0ad357729b..1e0f04e4e1 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -340,6 +340,7 @@ virStorageBackendLogicalMakeVol(char **const groups, goto cleanup; vol->target.backingStore->format = VIR_STORAGE_POOL_LOGICAL_LVM2; + vol->target.backingStore->type = VIR_STORAGE_TYPE_BLOCK; } if (!vol->key && VIR_STRDUP(vol->key, groups[2]) < 0) -- 2.39.5