test/lvol: rewrite thin_overprovisioning to bash
Change-Id: I0cef2a609c2c57708f1cb62ff17025d4643b0ac4 Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Signed-off-by: Michal Berger <michalx.berger@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/707 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>
This commit is contained in:
parent
e4442af984
commit
0e6ee49e3c
@ -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',
|
||||
654: 'thin_overprovisioning',
|
||||
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
|
||||
850: 'clear_method_none',
|
||||
851: 'clear_method_unmap',
|
||||
|
@ -119,7 +119,6 @@ def case_message(func):
|
||||
553: 'unregister_lvol_bdev',
|
||||
602: 'bdev_lvol_create_lvstore_with_all_clear_methods',
|
||||
# Provisioning
|
||||
654: 'thin_overprovisioning',
|
||||
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
|
||||
# logical volume clear_method test
|
||||
850: 'clear_method_none',
|
||||
@ -579,78 +578,6 @@ class TestCases(object):
|
||||
# - Error code response printed to stdout
|
||||
return fail_count
|
||||
|
||||
@case_message
|
||||
def test_case654(self):
|
||||
"""
|
||||
thin_overprovisioning
|
||||
|
||||
Create two thin provisioned lvol bdevs with max size
|
||||
and check if writting more than total size of lvol store
|
||||
will cause failures.
|
||||
"""
|
||||
# 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'])
|
||||
lbd_name0 = self.lbd_name + str("0")
|
||||
lbd_name1 = self.lbd_name + str("1")
|
||||
bdev_size = self.get_lvs_size()
|
||||
# construct two thin provisioned lvol bdevs on created lvol store
|
||||
# with size equals to free lvs size
|
||||
bdev_name0 = self.c.bdev_lvol_create(uuid_store, lbd_name0,
|
||||
bdev_size, thin=True)
|
||||
bdev_name1 = self.c.bdev_lvol_create(uuid_store, lbd_name1,
|
||||
bdev_size, thin=True)
|
||||
|
||||
lvs = self.c.bdev_lvol_get_lvstores(self.lvs_name)[0]
|
||||
free_clusters_create_lvol = int(lvs['free_clusters'])
|
||||
if free_clusters_start != free_clusters_create_lvol:
|
||||
fail_count += 1
|
||||
lvol_bdev0 = self.c.get_lvol_bdev_with_name(bdev_name0)
|
||||
lvol_bdev1 = self.c.get_lvol_bdev_with_name(bdev_name1)
|
||||
|
||||
nbd_name0 = "/dev/nbd0"
|
||||
nbd_name1 = "/dev/nbd1"
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev0['name'], nbd_name0)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev1['name'], nbd_name1)
|
||||
|
||||
size = "75%"
|
||||
# fill first bdev to 75% of its space with specific pattern
|
||||
fail_count += self.run_fio_test(nbd_name0, 0, size, "write", "0xcc")
|
||||
|
||||
size = "75%"
|
||||
# fill second bdev up to 75% of its space
|
||||
# check that error message occured while filling second bdev with data
|
||||
fail_count += self.run_fio_test(nbd_name1, 0, size, "write", "0xee",
|
||||
expected_ret_value=1)
|
||||
|
||||
size = "75%"
|
||||
# check if data on first disk stayed unchanged
|
||||
fail_count += self.run_fio_test(nbd_name0, 0, size, "read", "0xcc")
|
||||
|
||||
size = "25%"
|
||||
offset = "75%"
|
||||
fail_count += self.run_fio_test(nbd_name0, offset, size, "read", "0x00")
|
||||
|
||||
fail_count += self.c.nbd_stop_disk(nbd_name0)
|
||||
fail_count += self.c.nbd_stop_disk(nbd_name1)
|
||||
# destroy thin provisioned lvol bdev
|
||||
fail_count += self.c.bdev_lvol_delete(lvol_bdev0['name'])
|
||||
fail_count += self.c.bdev_lvol_delete(lvol_bdev1['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
|
||||
# - no other operation fails
|
||||
return fail_count
|
||||
|
||||
@case_message
|
||||
def test_case655(self):
|
||||
"""
|
||||
|
@ -181,6 +181,46 @@ function test_thin_lvol_resize() {
|
||||
rpc_cmd bdev_malloc_delete "$malloc_name"
|
||||
}
|
||||
|
||||
function test_thin_overprovisioning() {
|
||||
malloc_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)
|
||||
lvs_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc_name" lvs_test)
|
||||
|
||||
# Construct two thin provisioned lvol bdevs on created lvol store
|
||||
# with size equal to free lvol store size
|
||||
lvol_size_mb=$( round_down $(( LVS_DEFAULT_CAPACITY_MB )) )
|
||||
lvol_size=$(( lvol_size_mb * 1024 * 1024 ))
|
||||
lvol_uuid1=$(rpc_cmd bdev_lvol_create -u "$lvs_uuid" lvol_test1 "$lvol_size_mb" -t)
|
||||
lvol_uuid2=$(rpc_cmd bdev_lvol_create -u "$lvs_uuid" lvol_test2 "$lvol_size_mb" -t)
|
||||
|
||||
lvs=$(rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid")
|
||||
free_clusters_start="$(jq -r '.[0].free_clusters' <<< "$lvs")"
|
||||
|
||||
nbd_start_disks "$DEFAULT_RPC_ADDR" "$lvol_uuid1" /dev/nbd0
|
||||
nbd_start_disks "$DEFAULT_RPC_ADDR" "$lvol_uuid2" /dev/nbd1
|
||||
# Fill first bdev to 75% of its space with specific pattern
|
||||
fill_size=$(( lvol_size * 75 / 100 ))
|
||||
run_fio_test /dev/nbd0 0 $fill_size "write" "0xcc"
|
||||
|
||||
# Fill second bdev up to 75% of its space
|
||||
# Check that error message occured while filling second bdev with data
|
||||
run_fio_test /dev/nbd1 0 $fill_size "write" "0xcc" && false
|
||||
|
||||
# Check if data on first disk stayed unchanged
|
||||
run_fio_test /dev/nbd0 0 $fill_size "read" "0xcc"
|
||||
|
||||
offset=$(( lvol_size * 75 / 100 ))
|
||||
fill_size=$(( lvol_size * 25 / 100 ))
|
||||
run_fio_test /dev/nbd0 $offset $fill_size "read" "0x00"
|
||||
|
||||
nbd_stop_disks "$DEFAULT_RPC_ADDR" /dev/nbd0
|
||||
nbd_stop_disks "$DEFAULT_RPC_ADDR" /dev/nbd1
|
||||
|
||||
rpc_cmd bdev_lvol_delete "$lvol_uuid2"
|
||||
rpc_cmd bdev_lvol_delete "$lvol_uuid1"
|
||||
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
|
||||
@ -190,6 +230,7 @@ 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
|
||||
run_test "test_thin_lvol_resize" test_thin_lvol_resize
|
||||
run_test "test_thin_overprovisioning" test_thin_overprovisioning
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
killprocess $spdk_pid
|
||||
|
Loading…
Reference in New Issue
Block a user