test/lvol: rewrite thin_provisioning_data_integrity_test to bash
Change-Id: I9a955143917ecad991a16429d6c7f4aff55acacf Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/705 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Michal Berger <michalx.berger@intel.com>
This commit is contained in:
parent
7d0cd374b3
commit
661adc77c3
@ -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',
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user