test/lvol: rewrite construct_lvol_bdev_duplicate_names_positive to bash
Change-Id: Ib0d0b685582913deb2a6ce09f2753fc6a1288630 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459673 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
This commit is contained in:
parent
0db73d0975
commit
cf510c7047
@ -132,6 +132,52 @@ function test_construct_multi_lvols() {
|
||||
check_leftover_devices
|
||||
}
|
||||
|
||||
# create 2 lvolstores, each with a single lvol on top.
|
||||
# use a single alias for both lvols, there should be no conflict
|
||||
# since they're in different lvolstores
|
||||
function test_construct_lvols_conflict_alias() {
|
||||
# create an lvol store 1
|
||||
malloc1_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)
|
||||
lvs1_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc1_name" lvs_test1)
|
||||
|
||||
# create an lvol on lvs1
|
||||
lvol1_uuid=$(rpc_cmd bdev_lvol_create -l lvs_test1 lvol_test "$LVS_DEFAULT_CAPACITY_MB")
|
||||
lvol1=$(rpc_cmd bdev_get_bdevs -b "$lvol1_uuid")
|
||||
|
||||
# use a different size for second malloc to keep those differentiable
|
||||
malloc2_size_mb=$(( MALLOC_SIZE_MB / 2 ))
|
||||
|
||||
# create an lvol store 2
|
||||
malloc2_name=$(rpc_cmd bdev_malloc_create $malloc2_size_mb $MALLOC_BS)
|
||||
lvs2_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc2_name" lvs_test2)
|
||||
|
||||
lvol2_size_mb=$(round_down $(( LVS_DEFAULT_CAPACITY_MB / 2 )) )
|
||||
|
||||
# create an lvol on lvs2
|
||||
lvol2_uuid=$(rpc_cmd bdev_lvol_create -l lvs_test2 lvol_test "$lvol2_size_mb")
|
||||
lvol2=$(rpc_cmd bdev_get_bdevs -b "$lvol2_uuid")
|
||||
|
||||
[ "$(jq -r '.[0].name' <<< "$lvol1")" = "$lvol1_uuid" ]
|
||||
[ "$(jq -r '.[0].uuid' <<< "$lvol1")" = "$lvol1_uuid" ]
|
||||
[ "$(jq -r '.[0].aliases[0]' <<< "$lvol1")" = "lvs_test1/lvol_test" ]
|
||||
[ "$(jq -r '.[0].driver_specific.lvol.lvol_store_uuid' <<< "$lvol1")" = "$lvs1_uuid" ]
|
||||
|
||||
[ "$(jq -r '.[0].name' <<< "$lvol2")" = "$lvol2_uuid" ]
|
||||
[ "$(jq -r '.[0].uuid' <<< "$lvol2")" = "$lvol2_uuid" ]
|
||||
[ "$(jq -r '.[0].aliases[0]' <<< "$lvol2")" = "lvs_test2/lvol_test" ]
|
||||
[ "$(jq -r '.[0].driver_specific.lvol.lvol_store_uuid' <<< "$lvol2")" = "$lvs2_uuid" ]
|
||||
|
||||
# clean up
|
||||
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs1_uuid"
|
||||
rpc_cmd bdev_lvol_get_lvstores -u "$lvs1_uuid" && false
|
||||
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs2_uuid"
|
||||
rpc_cmd bdev_lvol_get_lvstores -u "$lvs2_uuid" && false
|
||||
rpc_cmd bdev_malloc_delete "$malloc1_name"
|
||||
rpc_cmd bdev_get_bdevs -b "$malloc1_name" && false
|
||||
rpc_cmd bdev_malloc_delete "$malloc2_name"
|
||||
check_leftover_devices
|
||||
}
|
||||
|
||||
$rootdir/app/spdk_tgt/spdk_tgt &
|
||||
spdk_pid=$!
|
||||
trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT
|
||||
@ -140,6 +186,7 @@ waitforlisten $spdk_pid
|
||||
run_test "test_construct_lvs" test_construct_lvs
|
||||
run_test "test_construct_lvol" test_construct_lvol
|
||||
run_test "test_construct_multi_lvols" test_construct_multi_lvols
|
||||
run_test "test_construct_lvols_conflict_alias" test_construct_lvols_conflict_alias
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
killprocess $spdk_pid
|
||||
|
@ -16,3 +16,7 @@ function check_leftover_devices() {
|
||||
leftover_lvs=$(rpc_cmd bdev_lvol_get_lvstores)
|
||||
[ "$(jq length <<< "$leftover_lvs")" == "0" ]
|
||||
}
|
||||
|
||||
function round_down() {
|
||||
echo $(( $1 / LVS_DEFAULT_CLUSTER_SIZE_MB * LVS_DEFAULT_CLUSTER_SIZE_MB ))
|
||||
}
|
||||
|
@ -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:
|
||||
53: 'bdev_lvol_create_duplicate_names_positive',
|
||||
100: 'construct_logical_volume_nonexistent_lvs_uuid',
|
||||
101: 'bdev_lvol_create_on_full_lvol_store',
|
||||
102: 'bdev_lvol_create_name_twice',
|
||||
|
@ -110,8 +110,6 @@ def test_counter():
|
||||
def case_message(func):
|
||||
def inner(*args, **kwargs):
|
||||
test_name = {
|
||||
# bdev_lvol_create - positive tests
|
||||
53: 'bdev_lvol_create_duplicate_names_positive',
|
||||
# bdev_lvol_create - negative tests
|
||||
100: 'construct_logical_volume_nonexistent_lvs_uuid',
|
||||
101: 'bdev_lvol_create_on_full_lvol_store',
|
||||
@ -309,57 +307,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_case53(self):
|
||||
"""
|
||||
bdev_lvol_create_duplicate_names_positive
|
||||
|
||||
Positive test for constructing a logical volumes using friendly names.
|
||||
Verify that logical volumes can use the same argument for friendly names
|
||||
if they are created on separate logical volume stores.
|
||||
"""
|
||||
# Construct two malloc bdevs
|
||||
base_name_1 = self.c.bdev_malloc_create(self.total_size,
|
||||
self.block_size)
|
||||
base_name_2 = self.c.bdev_malloc_create(self.total_size,
|
||||
self.block_size)
|
||||
# Create logical volume stores on created malloc bdevs
|
||||
uuid_store_1 = self.c.bdev_lvol_create_lvstore(base_name_1,
|
||||
self.lvs_name + "1")
|
||||
uuid_store_2 = self.c.bdev_lvol_create_lvstore(base_name_2,
|
||||
self.lvs_name + "2")
|
||||
# Verify stores were created correctly
|
||||
fail_count = self.c.check_bdev_lvol_get_lvstores(base_name_1, uuid_store_1,
|
||||
self.cluster_size)
|
||||
fail_count = self.c.check_bdev_lvol_get_lvstores(base_name_2, uuid_store_2,
|
||||
self.cluster_size)
|
||||
|
||||
lvs_size = self.get_lvs_size(self.lvs_name + "1")
|
||||
# Create logical volume on first lvol store
|
||||
uuid_bdev_1 = self.c.bdev_lvol_create(uuid_store_1,
|
||||
self.lbd_name,
|
||||
lvs_size)
|
||||
# Using the same friendly name argument create logical volume on second
|
||||
# lvol store
|
||||
uuid_bdev_2 = self.c.bdev_lvol_create(uuid_store_2,
|
||||
self.lbd_name,
|
||||
lvs_size)
|
||||
# Verify two lvol bdevs were correctly created
|
||||
fail_count += self.c.check_bdev_get_bdevs_methods(uuid_bdev_1, lvs_size)
|
||||
fail_count += self.c.check_bdev_get_bdevs_methods(uuid_bdev_2, lvs_size)
|
||||
|
||||
fail_count += self.c.bdev_lvol_delete(uuid_bdev_1)
|
||||
fail_count += self.c.bdev_lvol_delete(uuid_bdev_2)
|
||||
fail_count += self.c.bdev_lvol_delete_lvstore(uuid_store_1)
|
||||
fail_count += self.c.bdev_lvol_delete_lvstore(uuid_store_2)
|
||||
fail_count += self.c.bdev_malloc_delete(base_name_1)
|
||||
fail_count += self.c.bdev_malloc_delete(base_name_2)
|
||||
|
||||
# Expected result:
|
||||
# - calls successful, return code = 0
|
||||
# - no other operation fails
|
||||
return fail_count
|
||||
|
||||
@case_message
|
||||
def test_case100(self):
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user