]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Fill in 'type' field for virStorageSource in storage driver
authorPeter Krempa <pkrempa@redhat.com>
Thu, 12 Oct 2017 18:31:33 +0000 (20:31 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 17 Oct 2017 04:19:18 +0000 (06:19 +0200)
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
src/storage/storage_backend_gluster.c
src/storage/storage_backend_logical.c

index c35fa0e15cfbfe5053881372ba82478887134430..7c373e7810225d4b50b663d21332886c25cb909a 100644 (file)
@@ -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;
 
index eac771b42f9694f37a54eb48d9bc1a958ce4162a..5eea84f16e31891ab1cad99b8b1b8a4e997fbf72 100644 (file)
@@ -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)
index 0ad357729b91f119a905959e56941130f8d1eb63..1e0f04e4e1c8473ddc094ca33fbbc412975dde30 100644 (file)
@@ -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)