mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
test: storage: Fill in default vol types for every pool
Fill in a default volume type for every pool type, as reported by the VolGetInfo API. Now that we cover the whole enum, report an error for invalid values. Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
47cbc92987
commit
4ec884e387
@ -5164,13 +5164,28 @@ testStorageVolDelete(virStorageVolPtr vol,
|
|||||||
static int
|
static int
|
||||||
testStorageVolumeTypeForPool(int pooltype)
|
testStorageVolumeTypeForPool(int pooltype)
|
||||||
{
|
{
|
||||||
switch (pooltype) {
|
switch ((virStoragePoolType) pooltype) {
|
||||||
case VIR_STORAGE_POOL_DIR:
|
case VIR_STORAGE_POOL_DIR:
|
||||||
case VIR_STORAGE_POOL_FS:
|
case VIR_STORAGE_POOL_FS:
|
||||||
case VIR_STORAGE_POOL_NETFS:
|
case VIR_STORAGE_POOL_NETFS:
|
||||||
|
case VIR_STORAGE_POOL_VSTORAGE:
|
||||||
return VIR_STORAGE_VOL_FILE;
|
return VIR_STORAGE_VOL_FILE;
|
||||||
default:
|
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:
|
||||||
return VIR_STORAGE_VOL_BLOCK;
|
return VIR_STORAGE_VOL_BLOCK;
|
||||||
|
case VIR_STORAGE_POOL_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virStoragePoolType, pooltype);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5193,7 +5208,8 @@ testStorageVolGetInfo(virStorageVolPtr vol,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
memset(info, 0, sizeof(*info));
|
memset(info, 0, sizeof(*info));
|
||||||
info->type = testStorageVolumeTypeForPool(def->type);
|
if ((info->type = testStorageVolumeTypeForPool(def->type)) < 0)
|
||||||
|
goto cleanup;
|
||||||
info->capacity = privvol->target.capacity;
|
info->capacity = privvol->target.capacity;
|
||||||
info->allocation = privvol->target.allocation;
|
info->allocation = privvol->target.allocation;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user