From c96cefbfd7905abd6e53d4e79c8f5014c68b7ad8 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Thu, 27 Jun 2019 19:47:38 +0200 Subject: [PATCH] test/lvol: rewrite construct_lvol_bdev_name_twice to bash Change-Id: Ice91dbec4c2d09b6a056711b7a0c6b29b20476cc Signed-off-by: Darek Stojaczyk Signed-off-by: Pawel Kaminski Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459676 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Karol Latecki Reviewed-by: Maciej Szwed --- test/lvol/basic.sh | 24 ++++++++++++++++++++++ test/lvol/lvol.sh | 1 - test/lvol/test_cases.py | 44 ----------------------------------------- 3 files changed, 24 insertions(+), 45 deletions(-) diff --git a/test/lvol/basic.sh b/test/lvol/basic.sh index d9c6f4830..2ce60c538 100755 --- a/test/lvol/basic.sh +++ b/test/lvol/basic.sh @@ -218,6 +218,29 @@ function test_construct_lvol_full_lvs() { check_leftover_devices } +# try to create two lvols with conflicting aliases +function test_construct_lvol_alias_conflict() { + # 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 valid lvol + lvol_size_mb=$(round_down $(( LVS_DEFAULT_CAPACITY_MB / 2 )) ) + lvol1_uuid=$(rpc_cmd bdev_lvol_create -l lvs_test lvol_test "$lvol_size_mb") + lvol1=$(rpc_cmd bdev_get_bdevs -b "$lvol1_uuid") + + # try to create another lvol with a name that's already taken + rpc_cmd bdev_lvol_create -l lvs_test lvol_test "$lvol_size_mb" && false + + # 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" + rpc_cmd bdev_get_bdevs -b "$malloc_name" && false + check_leftover_devices +} + + $rootdir/app/spdk_tgt/spdk_tgt & spdk_pid=$! trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT @@ -229,6 +252,7 @@ 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 run_test "test_construct_lvol_full_lvs" test_construct_lvol_full_lvs +run_test "test_construct_lvol_alias_conflict" test_construct_lvol_alias_conflict trap - SIGINT SIGTERM EXIT killprocess $spdk_pid diff --git a/test/lvol/lvol.sh b/test/lvol/lvol.sh index ecc45a768..e58bdbd78 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: - 102: 'bdev_lvol_create_name_twice', 150: 'bdev_lvol_resize_positive', 200: 'resize_logical_volume_nonexistent_logical_volume', 201: 'resize_logical_volume_with_size_out_of_range', diff --git a/test/lvol/test_cases.py b/test/lvol/test_cases.py index eb46d902a..3d46adc1f 100644 --- a/test/lvol/test_cases.py +++ b/test/lvol/test_cases.py @@ -110,8 +110,6 @@ def test_counter(): def case_message(func): def inner(*args, **kwargs): test_name = { - # bdev_lvol_create - negative tests - 102: 'bdev_lvol_create_name_twice', # resize_lvol_store - positive tests 150: 'bdev_lvol_resize_positive', # resize lvol store - negative tests @@ -305,48 +303,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_case102(self): - """ - bdev_lvol_create_name_twice - - Negative test for constructing lvol bdev using the same - friendly name twice on the same logical volume store. - """ - # Construct malloc bdev - base_name = self.c.bdev_malloc_create(self.total_size, - self.block_size) - # Create logical volume store on malloc bdev - uuid_store = self.c.bdev_lvol_create_lvstore(base_name, - self.lvs_name) - # Using bdev_lvol_get_lvstores verify that logical volume store was correctly created - fail_count = self.c.check_bdev_lvol_get_lvstores(base_name, uuid_store, - self.cluster_size) - size = self.get_lvs_size() - # Construct logical volume on lvol store and verify it was correctly created - uuid_bdev = self.c.bdev_lvol_create(uuid_store, - self.lbd_name, - size) - fail_count += self.c.check_bdev_get_bdevs_methods(uuid_bdev, - size) - # Try to create another logical volume on the same lvol store using - # the same friendly name as in previous step - # This step should fail - if self.c.bdev_lvol_create(uuid_store, - self.lbd_name, - size) == 0: - fail_count += 1 - - self.c.bdev_lvol_delete(uuid_bdev) - self.c.bdev_lvol_delete_lvstore(uuid_store) - self.c.bdev_malloc_delete(base_name) - - # Expected results: - # - creating two logical volumes with the same friendly name within the same - # lvol store should not be possible - # - no other operation fails - return fail_count - @case_message def test_case150(self): """