Commit 4256981d authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Tomasz Zawadzki
Browse files

test/lvol: rewrite construct_lvol_bdev_using_name_positive to bash



Make it a part of existing test_construct_lvol_basic
test case. It's the same test, but the lvol is created
using lvs alias rather than uuid.

Change-Id: I909ded489eb441aa9fa212b11b2cbb91b5db5bbe
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Signed-off-by: default avatarPawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459672


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
parent da90d41a
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -45,6 +45,20 @@ function test_construct_lvol() {
	[ "$(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 ))" ]
	[ "$(jq -r '.[0].driver_specific.lvol.lvol_store_uuid' <<< "$lvol")" = "$lvs_uuid" ]

	# clean up and create another lvol, this time use lvs alias instead of uuid
	rpc_cmd bdev_lvol_delete "$lvol_uuid"
	! rpc_cmd bdev_get_bdevs -b "$lvol_uuid"
	lvol_uuid=$(rpc_cmd bdev_lvol_create -l lvs_test 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 ))" ]
	[ "$(jq -r '.[0].driver_specific.lvol.lvol_store_uuid' <<< "$lvol")" = "$lvs_uuid" ]

	# clean up
	rpc_cmd bdev_lvol_delete "$lvol_uuid"
+0 −1
Original line number Diff line number Diff line
@@ -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:
                                    52: 'bdev_lvol_create_using_name_positive',
                                    53: 'bdev_lvol_create_duplicate_names_positive',
                                    100: 'construct_logical_volume_nonexistent_lvs_uuid',
                                    101: 'bdev_lvol_create_on_full_lvol_store',
+0 −38
Original line number Diff line number Diff line
@@ -111,7 +111,6 @@ def case_message(func):
    def inner(*args, **kwargs):
        test_name = {
            # bdev_lvol_create - positive tests
            52: 'bdev_lvol_create_using_name_positive',
            53: 'bdev_lvol_create_duplicate_names_positive',
            # bdev_lvol_create - negative tests
            100: 'construct_logical_volume_nonexistent_lvs_uuid',
@@ -310,43 +309,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_case52(self):
        """
        bdev_lvol_create_using_name_positive

        Positive test for constructing a logical volume using friendly names.
        Verify that logical volumes can be created by using a friendly name
        instead of uuid when referencing to lvol store.
        """
        # Create malloc bdev
        base_name = self.c.bdev_malloc_create(self.total_size,
                                              self.block_size)
        # Construct lvol store
        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()
        # Create logical volume on lvol store by using a friendly name
        # as a reference
        uuid_bdev = self.c.bdev_lvol_create(self.lvs_name,
                                            self.lbd_name,
                                            lvs_size)
        # Verify logical volume was correctly created
        fail_count += self.c.check_bdev_get_bdevs_methods(uuid_bdev,
                                                          lvs_size)

        fail_count += self.c.bdev_lvol_delete(uuid_bdev)
        fail_count += self.c.bdev_lvol_delete_lvstore(uuid_store)
        fail_count += self.c.bdev_malloc_delete(base_name)

        # Expected result:
        # - calls successful, return code = 0
        # - no other operation fails
        return fail_count

    @case_message
    def test_case53(self):
        """