Fill in a default volume type for every pool type, as reported
by the VolGetInfo API.

Signed-off-by: Cole Robinson <crobi...@redhat.com>
---
A more complete fix would take into account VolDef->type, so test
driver users could set this value via volume XML. That would require
adding a PostParse callback to the storage driver infrastructure.
This is still an improvement in the interim and would be part of
a complete fix anyways

 src/test/test_driver.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index ce0df1f8e3..3f37b2ede7 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5164,13 +5164,26 @@ testStorageVolDelete(virStorageVolPtr vol,
 static int
 testStorageVolumeTypeForPool(int pooltype)
 {
-    switch (pooltype) {
-        case VIR_STORAGE_POOL_DIR:
-        case VIR_STORAGE_POOL_FS:
-        case VIR_STORAGE_POOL_NETFS:
-            return VIR_STORAGE_VOL_FILE;
-        default:
-            return VIR_STORAGE_VOL_BLOCK;
+    switch ((virStoragePoolType) pooltype) {
+    case VIR_STORAGE_POOL_DIR:
+    case VIR_STORAGE_POOL_FS:
+    case VIR_STORAGE_POOL_NETFS:
+    case VIR_STORAGE_POOL_VSTORAGE:
+        return VIR_STORAGE_VOL_FILE;
+    case VIR_STORAGE_POOL_SHEEPDOG:
+    case VIR_STORAGE_POOL_ISCSI_DIRECT:
+    case VIR_STORAGE_POOL_GLUSTER:
+    case VIR_STORAGE_POOL_RBD:
+        return VIR_STORAGE_VOL_NETWORK;
+    case VIR_STORAGE_POOL_LOGICAL:
+    case VIR_STORAGE_POOL_DISK:
+    case VIR_STORAGE_POOL_MPATH:
+    case VIR_STORAGE_POOL_ISCSI:
+    case VIR_STORAGE_POOL_SCSI:
+    case VIR_STORAGE_POOL_ZFS:
+    case VIR_STORAGE_POOL_LAST:
+    default:
+        return VIR_STORAGE_VOL_BLOCK;
     }
 }
 
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to