test/lvol: rewrite nested_construct_lvol_bdev_on_full_lvol_store to bash
Change-Id: I6a33d54260f2181995b962db21efc9556a5a4c0c Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461880 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Maciej Szwed <maciej.szwed@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com>
This commit is contained in:
parent
912f3b4c12
commit
c6e1399118
@ -285,6 +285,46 @@ function test_construct_lvol_alias_conflict() {
|
||||
check_leftover_devices
|
||||
}
|
||||
|
||||
# create an lvs+lvol, create another lvs on lvol and then a nested lvol
|
||||
function test_construct_nested_lvol() {
|
||||
# create an lvol store
|
||||
malloc_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)
|
||||
lvs_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc_name" lvs_test)
|
||||
|
||||
# create an lvol on top
|
||||
lvol_uuid=$(rpc_cmd bdev_lvol_create -u "$lvs_uuid" lvol_test "$LVS_DEFAULT_CAPACITY_MB")
|
||||
# create a nested lvs
|
||||
nested_lvs_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$lvol_uuid" nested_lvs)
|
||||
|
||||
nested_lvol_size_mb=$(( LVS_DEFAULT_CAPACITY_MB - LVS_DEFAULT_CLUSTER_SIZE_MB ))
|
||||
nested_lvol_size=$(( nested_lvol_size_mb * 1024 * 1024 ))
|
||||
|
||||
# create a nested lvol
|
||||
nested_lvol1_uuid=$(rpc_cmd bdev_lvol_create -u "$nested_lvs_uuid" nested_lvol1 "$nested_lvol_size_mb")
|
||||
nested_lvol1=$(rpc_cmd bdev_get_bdevs -b "$nested_lvol1_uuid")
|
||||
|
||||
[ "$(jq -r '.[0].name' <<< "$nested_lvol1")" = "$nested_lvol1_uuid" ]
|
||||
[ "$(jq -r '.[0].uuid' <<< "$nested_lvol1")" = "$nested_lvol1_uuid" ]
|
||||
[ "$(jq -r '.[0].aliases[0]' <<< "$nested_lvol1")" = "nested_lvs/nested_lvol1" ]
|
||||
[ "$(jq -r '.[0].block_size' <<< "$nested_lvol1")" = "$MALLOC_BS" ]
|
||||
[ "$(jq -r '.[0].num_blocks' <<< "$nested_lvol1")" = "$(( nested_lvol_size / MALLOC_BS ))" ]
|
||||
[ "$(jq -r '.[0].driver_specific.lvol.lvol_store_uuid' <<< "$nested_lvol1")" = "$nested_lvs_uuid" ]
|
||||
|
||||
# try to create another nested lvol on a lvs that's already full
|
||||
rpc_cmd bdev_lvol_create -u "$nested_lvs_uuid" nested_lvol2 "$nested_lvol_size_mb" && false
|
||||
|
||||
# clean up
|
||||
rpc_cmd bdev_lvol_delete "$nested_lvol1_uuid"
|
||||
rpc_cmd bdev_get_bdevs -b "$nested_lvol1_uuid" && false
|
||||
rpc_cmd bdev_lvol_delete_lvstore -u "$nested_lvs_uuid"
|
||||
rpc_cmd bdev_lvol_get_lvstores -u "$nested_lvs_uuid" && false
|
||||
rpc_cmd bdev_lvol_delete "$lvol_uuid"
|
||||
rpc_cmd bdev_get_bdevs -b "$lvol_uuid" && false
|
||||
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid"
|
||||
rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid" && false
|
||||
rpc_cmd bdev_malloc_delete "$malloc_name"
|
||||
check_leftover_devices
|
||||
}
|
||||
|
||||
$rootdir/app/spdk_tgt/spdk_tgt &
|
||||
spdk_pid=$!
|
||||
@ -301,6 +341,7 @@ run_test "test_construct_lvols_conflict_alias" test_construct_lvols_conflict_ali
|
||||
run_test "test_construct_lvol_inexistent_lvs" test_construct_lvol_inexistent_lvs
|
||||
run_test "test_construct_lvol_full_lvs" test_construct_lvol_full_lvs
|
||||
run_test "test_construct_lvol_alias_conflict" test_construct_lvol_alias_conflict
|
||||
run_test "test_construct_nested_lvol" test_construct_nested_lvol
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
killprocess $spdk_pid
|
||||
|
@ -34,7 +34,6 @@ function usage() {
|
||||
301: 'delete_lvol_store_underlying_bdev',
|
||||
350: 'nested_destroy_logical_volume_negative',
|
||||
400: 'nested_construct_logical_volume_positive',
|
||||
500: 'nested_bdev_lvol_create_on_full_lvol_store',
|
||||
550: 'delete_bdev_positive',
|
||||
551: 'delete_lvol_bdev',
|
||||
552: 'bdev_lvol_delete_lvstore_with_clones',
|
||||
|
@ -126,8 +126,6 @@ def case_message(func):
|
||||
# bdev_lvol_delete_lvstore - negative tests
|
||||
300: 'bdev_lvol_delete_lvstore_nonexistent_lvs_uuid',
|
||||
301: 'delete_lvol_store_underlying_bdev',
|
||||
# nested bdev_lvol_create - test negative
|
||||
500: 'nested_bdev_lvol_create_on_full_lvol_store',
|
||||
550: 'delete_bdev_positive',
|
||||
551: 'delete_lvol_bdev',
|
||||
552: 'bdev_lvol_delete_lvstore_with_clones',
|
||||
@ -723,56 +721,6 @@ class TestCases(object):
|
||||
return fail_count
|
||||
|
||||
# negative tests
|
||||
@case_message
|
||||
def test_case500(self):
|
||||
"""
|
||||
nested_bdev_lvol_create_on_full_lvol_store
|
||||
|
||||
Negative test for constructing a new nested lvol bdev.
|
||||
Call bdev_lvol_create on a full lvol store.
|
||||
"""
|
||||
# Create malloc bdev
|
||||
base_name = self.c.bdev_malloc_create(self.total_size,
|
||||
self.block_size)
|
||||
# Construct_lvol_store on correct, exisitng malloc bdev
|
||||
uuid_store = self.c.bdev_lvol_create_lvstore(base_name,
|
||||
self.lvs_name)
|
||||
# Check correct uuid values in response bdev_lvol_get_lvstores command
|
||||
fail_count = self.c.check_bdev_lvol_get_lvstores(base_name, uuid_store,
|
||||
self.cluster_size)
|
||||
# Construct lvol bdev
|
||||
size = self.get_lvs_size()
|
||||
uuid_bdev = self.c.bdev_lvol_create(uuid_store,
|
||||
self.lbd_name, size)
|
||||
# Construct nested lvol store on created lvol_bdev
|
||||
nested_lvs_name = self.lvs_name + "_nested"
|
||||
nested_lvs_uuid = self.c.bdev_lvol_create_lvstore(uuid_bdev,
|
||||
nested_lvs_name)
|
||||
# Check correct uuid values in response bdev_lvol_get_lvstores command
|
||||
fail_count += self.c.check_bdev_lvol_get_lvstores(uuid_bdev, nested_lvs_uuid,
|
||||
self.cluster_size)
|
||||
# Construct nested lvol bdev on previously created nested lvol store
|
||||
# with size equal to size of nested lvol store
|
||||
nested_size = self.get_lvs_size(nested_lvs_name)
|
||||
nested_lbd_name = self.lbd_name + "_nested"
|
||||
nested_uuid_bdev = self.c.bdev_lvol_create(nested_lvs_uuid,
|
||||
nested_lbd_name, nested_size)
|
||||
fail_count += self.c.check_bdev_get_bdevs_methods(nested_uuid_bdev, nested_size)
|
||||
|
||||
# Try construct another lvol bdev as in previous step; this call should fail
|
||||
# as nested lvol store space is already claimed by lvol bdev
|
||||
nested_lbd_name = self.lbd_name + "_nested2"
|
||||
if self.c.bdev_lvol_create(nested_lvs_uuid, nested_lbd_name, nested_size) == 0:
|
||||
fail_count += 1
|
||||
|
||||
fail_count += self.c.bdev_malloc_delete(base_name)
|
||||
|
||||
# Expected result:
|
||||
# - second bdev_lvol_create call on nested lvol store return code != 0
|
||||
# - EEXIST response printed to stdout
|
||||
# - no other operation fails
|
||||
return fail_count
|
||||
|
||||
@case_message
|
||||
def test_case550(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user