Commit 661adc77 authored by Pawel Kaminski's avatar Pawel Kaminski Committed by Tomasz Zawadzki
Browse files

test/lvol: rewrite thin_provisioning_data_integrity_test to bash

parent 7d0cd374
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ function usage() {
                                    552: 'bdev_lvol_delete_lvstore_with_clones',
                                    553: 'unregister_lvol_bdev',
                                    602: 'bdev_lvol_create_lvstore_with_all_clear_methods',
                                    652: 'thin_provisioning_data_integrity_test',
                                    653: 'thin_provisioning_resize',
                                    654: 'thin_overprovisioning',
                                    655: 'thin_provisioning_filling_disks_less_than_lvs_size',
+0 −43
Original line number Diff line number Diff line
@@ -119,7 +119,6 @@ def case_message(func):
            553: 'unregister_lvol_bdev',
            602: 'bdev_lvol_create_lvstore_with_all_clear_methods',
            # Provisioning
            652: 'thin_provisioning_data_integrity_test',
            653: 'thin_provisioning_resize',
            654: 'thin_overprovisioning',
            655: 'thin_provisioning_filling_disks_less_than_lvs_size',
@@ -581,48 +580,6 @@ class TestCases(object):
        # - Error code response printed to stdout
        return fail_count

    def test_case652(self):
        """
        thin_provisioning_data_integrity_test

        Check if data written to thin provisioned lvol bdev
        were properly written (fio test with verification).
        """
        # create malloc bdev
        base_name = self.c.bdev_malloc_create(self.total_size,
                                              self.block_size)
        # construct lvol store on malloc bdev
        uuid_store = self.c.bdev_lvol_create_lvstore(base_name,
                                                     self.lvs_name)
        fail_count = self.c.check_bdev_lvol_get_lvstores(base_name, uuid_store,
                                                         self.cluster_size)
        lvs = self.c.bdev_lvol_get_lvstores(self.lvs_name)[0]
        free_clusters_start = int(lvs['free_clusters'])
        bdev_size = self.get_lvs_size()
        # construct thin provisioned lvol bdev with size equal to lvol store
        bdev_name = self.c.bdev_lvol_create(uuid_store, self.lbd_name,
                                            bdev_size, thin=True)

        lvol_bdev = self.c.get_lvol_bdev_with_name(bdev_name)
        nbd_name = "/dev/nbd0"
        fail_count += self.c.nbd_start_disk(lvol_bdev['name'], nbd_name)
        size = bdev_size * MEGABYTE
        # on the whole lvol bdev perform write operation with verification
        fail_count += self.run_fio_test(nbd_name, 0, size, "write", "0xcc")

        fail_count += self.c.nbd_stop_disk(nbd_name)
        # destroy thin provisioned lvol bdev
        fail_count += self.c.bdev_lvol_delete(lvol_bdev['name'])
        # destroy lvol store
        fail_count += self.c.bdev_lvol_delete_lvstore(uuid_store)
        # destroy malloc bdev
        fail_count += self.c.bdev_malloc_delete(base_name)
        # Expected result:
        # - calls successful, return code = 0
        # - verification ends with success
        # - no other operation fails
        return fail_count

    @case_message
    def test_case653(self):
        """
+24 −0
Original line number Diff line number Diff line
@@ -97,6 +97,29 @@ function test_thin_lvol_check_zeroes() {
	rpc_cmd bdev_malloc_delete "$malloc_name"
}

# Check if data written to thin provisioned lvol bdev
# were properly written (fio test with verification)
function test_thin_lvol_check_integrity() {
	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 thin provisioned lvol bdev with size equals to lvol store space
	lvol_size_mb=$(( LVS_DEFAULT_CAPACITY_MB ))
	# Round down lvol size to the nearest cluster size boundary
	lvol_size_mb=$(( lvol_size_mb / LVS_DEFAULT_CLUSTER_SIZE_MB * LVS_DEFAULT_CLUSTER_SIZE_MB ))
	lvol_size=$(( lvol_size_mb * 1024 * 1024 ))
	lvol_uuid=$(rpc_cmd bdev_lvol_create -u "$lvs_uuid" lvol_test "$lvol_size_mb" -t)

	nbd_start_disks "$DEFAULT_RPC_ADDR" "$lvol_uuid" /dev/nbd0
	run_fio_test /dev/nbd0 0 $lvol_size "write" "0xcc"

	# Clean up
	nbd_stop_disks "$DEFAULT_RPC_ADDR" /dev/nbd0
	rpc_cmd bdev_lvol_delete "$lvol_uuid"
	rpc_cmd bdev_lvol_delete_lvstore -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
@@ -104,6 +127,7 @@ waitforlisten $spdk_pid

run_test "test_thin_lvol_check_space" test_thin_lvol_check_space
run_test "test_thin_lvol_check_zeroes" test_thin_lvol_check_zeroes
run_test "test_thin_lvol_check_integrity" test_thin_lvol_check_integrity

trap - SIGINT SIGTERM EXIT
killprocess $spdk_pid