Commit 912f3b4c authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

test/lvol: rewrite construct_lvs_name_twice to bash

parent 580b19f9
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -58,6 +58,23 @@ function test_construct_two_lvs_on_the_same_bdev() {
	check_leftover_devices
}

# try to create two lvs with conflicting aliases
function test_construct_lvs_conflict_alias() {
	# create first bdev and lvs
	malloc1_name=$(rpc_cmd construct_malloc_bdev $MALLOC_SIZE_MB $MALLOC_BS)
	lvs1_uuid=$(rpc_cmd construct_lvol_store "$malloc1_name" lvs_test)

	# create second bdev and lvs with the same name as previously
	malloc2_name=$(rpc_cmd construct_malloc_bdev $MALLOC_SIZE_MB $MALLOC_BS)
	rpc_cmd construct_lvol_store "$malloc2_name" lvs_test && false

	# clean up
	rpc_cmd destroy_lvol_store -u "$lvs1_uuid"
	rpc_cmd get_lvol_stores -u "$lvs1_uuid" && false
	rpc_cmd delete_malloc_bdev "$malloc1_name"
	rpc_cmd delete_malloc_bdev "$malloc2_name"
	check_leftover_devices
}

# create lvs + lvol on top, verify lvol's parameters
function test_construct_lvol() {
@@ -277,6 +294,7 @@ waitforlisten $spdk_pid
run_test "test_construct_lvs" test_construct_lvs
run_test "test_construct_lvs_nonexistent_bdev" test_construct_lvs_nonexistent_bdev
run_test "test_construct_two_lvs_on_the_same_bdev" test_construct_two_lvs_on_the_same_bdev
run_test "test_construct_lvs_conflict_alias" test_construct_lvs_conflict_alias
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
+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ function usage() {
                                    301: 'delete_lvol_store_underlying_bdev',
                                    350: 'nested_destroy_logical_volume_negative',
                                    400: 'nested_construct_logical_volume_positive',
                                    452: 'construct_lvs_name_twice',
                                    500: 'nested_bdev_lvol_create_on_full_lvol_store',
                                    550: 'delete_bdev_positive',
                                    551: 'delete_lvol_bdev',
+0 −38
Original line number Diff line number Diff line
@@ -126,8 +126,6 @@ def case_message(func):
            # bdev_lvol_delete_lvstore - negative tests
            300: 'bdev_lvol_delete_lvstore_nonexistent_lvs_uuid',
            301: 'delete_lvol_store_underlying_bdev',
            # bdev_lvol_create_lvstore - negative tests
            452: 'construct_lvs_name_twice',
            # nested bdev_lvol_create - test negative
            500: 'nested_bdev_lvol_create_on_full_lvol_store',
            550: 'delete_bdev_positive',
@@ -725,42 +723,6 @@ class TestCases(object):
        return fail_count

    # negative tests
    @case_message
    def test_case452(self):
        """
        construct_lvs_name_twice

        Negative test for constructing a new lvol store using the same
        friendly name twice.
        """
        fail_count = 0
        # Create malloc bdev
        base_name_1 = self.c.bdev_malloc_create(self.total_size,
                                                self.block_size)
        # Construct second malloc bdev
        base_name_2 = self.c.bdev_malloc_create(self.total_size,
                                                self.block_size)
        # Construct lvol store on first malloc
        uuid_store_1 = self.c.bdev_lvol_create_lvstore(base_name_1,
                                                       self.lvs_name)
        # using bdev_lvol_get_lvstores verify that logical volume store was correctly created
        # and has arguments as provided in step earlier (cluster size, friendly name, base bdev)
        fail_count += self.c.check_bdev_lvol_get_lvstores(base_name_1,
                                                          uuid_store_1,
                                                          self.cluster_size)
        # Try to create another logical volume store on second malloc bdev using the
        # same friendly name as before. This step is expected to fail as lvol stores
        # cannot have the same name
        if self.c.bdev_lvol_create_lvstore(base_name_2,
                                           self.lvs_name) == 0:
            fail_count += 1

        fail_count += self.c.bdev_lvol_delete_lvstore(uuid_store_1)
        fail_count += self.c.bdev_malloc_delete(base_name_1)
        fail_count += self.c.bdev_malloc_delete(base_name_2)

        return fail_count

    @case_message
    def test_case500(self):
        """