test/lvol: rewrite thin_provisioning_filling_disks_less_than_lvs_size to bash

Change-Id: Iec5277f86e2f663eafd2c4c32515c2bf30a1e068
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/+/708
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:
Michal Berger 2020-04-01 12:06:23 +02:00 committed by Tomasz Zawadzki
parent 0e6ee49e3c
commit a317fccab7
3 changed files with 11 additions and 72 deletions

View File

@ -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',
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
850: 'clear_method_none',
851: 'clear_method_unmap',
or

View File

@ -118,8 +118,6 @@ def case_message(func):
552: 'bdev_lvol_delete_lvstore_with_clones',
553: 'unregister_lvol_bdev',
602: 'bdev_lvol_create_lvstore_with_all_clear_methods',
# Provisioning
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
# logical volume clear_method test
850: 'clear_method_none',
851: 'clear_method_unmap',
@ -578,64 +576,6 @@ class TestCases(object):
# - Error code response printed to stdout
return fail_count
@case_message
def test_case655(self):
"""
thin_provisioning_filling_disks_less_than_lvs_size
Check if writing to two thin provisioned lvol bdevs
less than total size of lvol store will end with success
"""
# 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")
lvs_size = self.get_lvs_size()
bdev_size = int(lvs_size * 0.7)
# construct two thin provisioned lvol bdevs on created lvol store
# with size equal to 70% of 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)
lvol_bdev0 = self.c.get_lvol_bdev_with_name(bdev_name0)
lvol_bdev1 = self.c.get_lvol_bdev_with_name(bdev_name1)
# check if bdevs are available and size of every disk is equal to 70% of lvs size
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 = int(int(lvol_bdev0['num_blocks']) * int(lvol_bdev0['block_size']) * 0.7)
# fill first disk with 70% of its size
# check if operation didn't fail
fail_count += self.run_fio_test(nbd_name0, 0, size, "write", "0xcc")
size = int(int(lvol_bdev1['num_blocks']) * int(lvol_bdev1['block_size']) * 0.7)
# fill second disk also with 70% of its size
# check if operation didn't fail
fail_count += self.run_fio_test(nbd_name1, 0, size, "write", "0xee")
fail_count += self.c.nbd_stop_disk(nbd_name0)
fail_count += self.c.nbd_stop_disk(nbd_name1)
# destroy thin provisioned lvol bdevs
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_case850(self):
""""

View File

@ -192,25 +192,25 @@ function test_thin_overprovisioning() {
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 ))
# Fill first bdev to 50% of its space with specific pattern
fill_size=$(( lvol_size_mb * 5 / 10 / LVS_DEFAULT_CLUSTER_SIZE_MB * LVS_DEFAULT_CLUSTER_SIZE_MB ))
fill_size=$(( fill_size * 1024 * 1024))
run_fio_test /dev/nbd0 0 $fill_size "write" "0xcc"
# Fill second bdev up to 75% of its space
# Fill second bdev up to 50% of its space
run_fio_test /dev/nbd1 0 $fill_size "write" "0xcc"
# Fill rest of second bdev
# Check that error message occured while filling second bdev with data
run_fio_test /dev/nbd1 0 $fill_size "write" "0xcc" && false
offset=$fill_size
fill_size_rest=$(( size - fill_size ))
run_fio_test /dev/nbd1 0 "$offset" "$fill_size_rest" "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"
run_fio_test /dev/nbd0 $offset $fill_size_rest "read" "0x00"
nbd_stop_disks "$DEFAULT_RPC_ADDR" /dev/nbd0
nbd_stop_disks "$DEFAULT_RPC_ADDR" /dev/nbd1