diff --git a/test/lvol/basic.sh b/test/lvol/basic.sh index e103f85b2..318544a32 100755 --- a/test/lvol/basic.sh +++ b/test/lvol/basic.sh @@ -178,6 +178,27 @@ function test_construct_lvols_conflict_alias() { check_leftover_devices } +# try to create an lvol on inexistent lvs uuid +function test_construct_lvol_inexistent_lvs() { + # 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) + + # try to create an lvol on inexistent lvs + dummy_uuid="00000000-0000-0000-0000-000000000000" + rpc_cmd bdev_lvol_create -u "$dummy_uuid" lvol_test "$LVS_DEFAULT_CAPACITY_MB" && false + + lvols=$(rpc_cmd bdev_get_bdevs | jq -r '[ .[] | select(.product_name == "Logical Volume") ]') + [ "$(jq length <<< "$lvols")" == "0" ] + + # clean up + 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=$! trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT @@ -187,6 +208,7 @@ 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 +run_test "test_construct_lvol_inexistent_lvs" test_construct_lvol_inexistent_lvs trap - SIGINT SIGTERM EXIT killprocess $spdk_pid diff --git a/test/lvol/lvol.sh b/test/lvol/lvol.sh index a13103ca7..3c6bc8ef0 100755 --- a/test/lvol/lvol.sh +++ b/test/lvol/lvol.sh @@ -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: - 100: 'construct_logical_volume_nonexistent_lvs_uuid', 101: 'bdev_lvol_create_on_full_lvol_store', 102: 'bdev_lvol_create_name_twice', 150: 'bdev_lvol_resize_positive', diff --git a/test/lvol/test_cases.py b/test/lvol/test_cases.py index 37eda95ee..7a1b2727b 100644 --- a/test/lvol/test_cases.py +++ b/test/lvol/test_cases.py @@ -111,7 +111,6 @@ def case_message(func): def inner(*args, **kwargs): test_name = { # bdev_lvol_create - negative tests - 100: 'construct_logical_volume_nonexistent_lvs_uuid', 101: 'bdev_lvol_create_on_full_lvol_store', 102: 'bdev_lvol_create_name_twice', # resize_lvol_store - positive tests @@ -307,27 +306,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_case100(self): - """ - construct_logical_volume_nonexistent_lvs_uuid - - Negative test for constructing a new logical_volume. - Call bdev_lvol_create with lvs_uuid which does not - exist in configuration. - """ - fail_count = 0 - # Try to call bdev_lvol_create with lvs_uuid which does not exist - if self.c.bdev_lvol_create(self._gen_lvs_uuid(), - self.lbd_name, - 32) == 0: - fail_count += 1 - - # Expected result: - # - return code != 0 - # - ENODEV response printed to stdout - return fail_count - @case_message def test_case101(self): """