test/lvol: rewrite destroy_multi_logical_volumes_positive to bash
Change-Id: Ia9e2bc269c4c7ee77afca3b001a6ef52612c5264 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462466 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>
This commit is contained in:
parent
e9c4aaf260
commit
9751011fa9
@ -31,12 +31,43 @@ function test_hotremove_lvol_store() {
|
||||
check_leftover_devices
|
||||
}
|
||||
|
||||
# destroy lvs with 4 lvols on top
|
||||
function test_hotremove_lvol_store_multiple_lvols() {
|
||||
# create lvs
|
||||
malloc_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)
|
||||
lvs_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc_name" lvs_test)
|
||||
|
||||
# calculate lvol size
|
||||
lvol_size_mb=$( round_down $(( (MALLOC_SIZE_MB- LVS_DEFAULT_CLUSTER_SIZE_MB) / 4 )) )
|
||||
|
||||
# create 4 lvols
|
||||
for i in $(seq 1 4); do
|
||||
rpc_cmd bdev_lvol_create -u "$lvs_uuid" "lvol_test${i}" "$lvol_size_mb"
|
||||
done
|
||||
|
||||
lvols=$(rpc_cmd bdev_get_bdevs | jq -r '[ .[] | select(.product_name == "Logical Volume") ]')
|
||||
[ "$(jq length <<< "$lvols")" == "4" ]
|
||||
|
||||
# remove lvs (with 4 lvols open)
|
||||
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid"
|
||||
rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid" && false
|
||||
|
||||
# make sure all lvols are gone
|
||||
lvols=$(rpc_cmd bdev_get_bdevs | jq -r '[ .[] | select(.product_name == "Logical Volume") ]')
|
||||
[ "$(jq length <<< "$lvols")" == "0" ]
|
||||
|
||||
# clean up
|
||||
rpc_cmd bdev_malloc_delete "$malloc_name"
|
||||
check_leftover_devices
|
||||
}
|
||||
|
||||
$rootdir/app/spdk_tgt/spdk_tgt &
|
||||
spdk_pid=$!
|
||||
trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT
|
||||
waitforlisten $spdk_pid
|
||||
|
||||
run_test "test_hotremove_lvol_store" test_hotremove_lvol_store
|
||||
run_test "test_hotremove_lvol_store_multiple_lvols" test_hotremove_lvol_store_multiple_lvols
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
killprocess $spdk_pid
|
||||
|
@ -21,7 +21,6 @@ function usage() {
|
||||
echo " --block-size Block size for this bdev"
|
||||
echo "-x set -x for script debug"
|
||||
echo " --test-cases= List test cases which will be run:
|
||||
253: 'destroy_multi_logical_volumes_positive',
|
||||
254: 'destroy_after_bdev_lvol_resize_positive',
|
||||
255: 'delete_lvol_store_persistent_positive',
|
||||
300: 'bdev_lvol_delete_lvstore_nonexistent_lvs_uuid',
|
||||
|
@ -112,7 +112,6 @@ def case_message(func):
|
||||
def inner(*args, **kwargs):
|
||||
test_name = {
|
||||
# bdev_lvol_delete_lvstore - positive tests
|
||||
253: 'destroy_multi_logical_volumes_positive',
|
||||
254: 'destroy_after_bdev_lvol_resize_positive',
|
||||
255: 'delete_lvol_store_persistent_positive',
|
||||
# bdev_lvol_delete_lvstore - negative tests
|
||||
@ -291,48 +290,6 @@ class TestCases(object):
|
||||
lvs = self.c.bdev_lvol_get_lvstores(lvs_name)[0]
|
||||
return int(int(lvs['cluster_size']) / MEGABYTE)
|
||||
|
||||
@case_message
|
||||
def test_case253(self):
|
||||
"""
|
||||
Name: destroy_multi_logical_volumes_positive
|
||||
|
||||
Positive test for destroying a logical volume store with multiple lvol
|
||||
bdevs created on top.
|
||||
Call bdev_lvol_create with correct lvol store UUID and
|
||||
size is equal to one quarter of the this bdev size.
|
||||
"""
|
||||
# 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)
|
||||
size = self.get_lvs_divided_size(4)
|
||||
# Construct four lvol bdevs on correct lvs_uuid and
|
||||
# size is equal to one quarter of the lvol size
|
||||
for i in range(4):
|
||||
uuid_bdev = self.c.bdev_lvol_create(uuid_store,
|
||||
self.lbd_name + str(i),
|
||||
size)
|
||||
fail_count += self.c.check_bdev_get_bdevs_methods(uuid_bdev, size)
|
||||
|
||||
# Destroy lvol store
|
||||
self.c.bdev_lvol_delete_lvstore(uuid_store)
|
||||
# Check correct response bdev_lvol_get_lvstores command
|
||||
if self.c.check_bdev_lvol_get_lvstores("", "", "") == 1:
|
||||
fail_count += 1
|
||||
self.c.bdev_malloc_delete(base_name)
|
||||
|
||||
# Expected result:
|
||||
# - call successful, return code = 0
|
||||
# - get_lvol_store: backend used for bdev_lvol_create has name
|
||||
# field set with the same name as returned from RPC call for all repeat
|
||||
# - no other operation fails
|
||||
return fail_count
|
||||
|
||||
@case_message
|
||||
def test_case254(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user