test/lvol: rewrite construct_logical_volume_positive to bash

Change-Id: Idd734af0ffc912852f8185c16d8591dd8152b7dd
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459518
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-06-26 19:35:56 +02:00 committed by Tomasz Zawadzki
parent 7fa9063148
commit f54ce6fb91
3 changed files with 25 additions and 39 deletions

View File

@ -30,12 +30,37 @@ function test_construct_lvs() {
rpc_cmd bdev_malloc_delete "$malloc_name"
}
# create lvs + lvol on top, verify lvol's parameters
function test_construct_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")
lvol=$(rpc_cmd bdev_get_bdevs -b "$lvol_uuid")
[ "$(jq -r '.[0].name' <<< "$lvol")" = "$lvol_uuid" ]
[ "$(jq -r '.[0].uuid' <<< "$lvol")" = "$lvol_uuid" ]
[ "$(jq -r '.[0].aliases[0]' <<< "$lvol")" = "lvs_test/lvol_test" ]
[ "$(jq -r '.[0].block_size' <<< "$lvol")" = "$MALLOC_BS" ]
[ "$(jq -r '.[0].num_blocks' <<< "$lvol")" = "$(( LVS_DEFAULT_CAPACITY / MALLOC_BS ))" ]
# clean up
rpc_cmd bdev_lvol_delete "$lvol_uuid"
! rpc_cmd bdev_get_bdevs -b "$lvol_uuid"
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid"
! rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid"
rpc_cmd bdev_malloc_delete "$malloc_name"
}
$rootdir/app/spdk_tgt/spdk_tgt &
spdk_pid=$!
trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT
waitforlisten $spdk_pid
run_lvol_test test_construct_lvs
run_lvol_test test_construct_lvol
trap - SIGINT SIGTERM EXIT
killprocess $spdk_pid

View File

@ -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:
50: 'construct_logical_volume_positive',
51: 'construct_multi_logical_volumes_positive',
52: 'bdev_lvol_create_using_name_positive',
53: 'bdev_lvol_create_duplicate_names_positive',

View File

@ -111,7 +111,6 @@ def case_message(func):
def inner(*args, **kwargs):
test_name = {
# bdev_lvol_create - positive tests
50: 'construct_logical_volume_positive',
51: 'construct_multi_logical_volumes_positive',
52: 'bdev_lvol_create_using_name_positive',
53: 'bdev_lvol_create_duplicate_names_positive',
@ -312,43 +311,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_case50(self):
"""
construct_logical_volume_positive
Positive test for constructing a new logical volume.
Call bdev_lvol_create with correct lvol store UUID and size in MiB for this bdev
"""
# Create malloc bdev
base_name = self.c.bdev_malloc_create(self.total_size,
self.block_size)
# Create 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)
lvs_size = self.get_lvs_size()
# Construct lvol bdev on correct lvs_uuid and size
uuid_bdev = self.c.bdev_lvol_create(uuid_store,
self.lbd_name,
lvs_size)
# Check correct uuid values in response bdev_get_bdevs command
fail_count += self.c.check_bdev_get_bdevs_methods(uuid_bdev,
lvs_size)
self.c.bdev_lvol_delete(uuid_bdev)
self.c.bdev_lvol_delete_lvstore(uuid_store)
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_case51(self):
"""