From 6642c9e9dea277e665f38846cb48ec014fed99fa Mon Sep 17 00:00:00 2001 From: Pawel Niedzwiecki Date: Fri, 27 Jul 2018 15:55:19 +0200 Subject: [PATCH] teest/lvol: Use lvol store default cluster size Change-Id: I45b6b0abe989cecb7293a3fb8c5a9299f618af7e Signed-off-by: Pawel Niedzwiecki Reviewed-on: https://review.gerrithub.io/420630 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker Chandler-Test-Pool: SPDK Automated Test System --- test/lvol/lvol.sh | 7 +- test/lvol/lvol_test.py | 13 ++- test/lvol/rpc_commands_lib.py | 12 +-- test/lvol/test_cases.py | 149 ++++++++++++---------------------- 4 files changed, 68 insertions(+), 113 deletions(-) diff --git a/test/lvol/lvol.sh b/test/lvol/lvol.sh index bebb43cba9..8fdf975dcf 100755 --- a/test/lvol/lvol.sh +++ b/test/lvol/lvol.sh @@ -3,9 +3,8 @@ set -e BASE_DIR=$(readlink -f $(dirname $0)) [[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../ && pwd)" -total_size=64 +total_size=256 block_size=512 -cluster_sz=1048576 #1MiB test_cases=all x="" @@ -19,7 +18,6 @@ function usage() { echo "-h, --help print help and exit" echo " --total-size Size of malloc bdev in MB (int > 0)" echo " --block-size Block size for this bdev" - echo " --cluster-sz size of cluster (in bytes)" echo "-x set -x for script debug" echo " --test-cases= List test cases which will be run: 1: 'construct_lvs_positive', @@ -91,7 +89,6 @@ while getopts 'xh-:' optchar; do help) usage $0 && exit 0;; total-size=*) total_size="${OPTARG#*=}" ;; block-size=*) block_size="${OPTARG#*=}" ;; - cluster-sz=*) cluster_sz="${OPTARG#*=}" ;; test-cases=*) test_cases="${OPTARG#*=}" ;; *) usage $0 "Invalid argument '$OPTARG'" && exit 1 ;; esac @@ -137,7 +134,7 @@ function vhost_kill() trap "vhost_kill; exit 1" SIGINT SIGTERM EXIT vhost_start -$BASE_DIR/lvol_test.py $rpc_py $total_size $block_size $cluster_sz $BASE_DIR $TEST_DIR/app/vhost "${test_cases[@]}" +$BASE_DIR/lvol_test.py $rpc_py $total_size $block_size $BASE_DIR $TEST_DIR/app/vhost "${test_cases[@]}" vhost_kill trap - SIGINT SIGTERM EXIT diff --git a/test/lvol/lvol_test.py b/test/lvol/lvol_test.py index 0eca30ed88..54394b73be 100755 --- a/test/lvol/lvol_test.py +++ b/test/lvol/lvol_test.py @@ -14,25 +14,22 @@ if __name__ == "__main__": rpc_py = None total_size = None block_size = None - cluster_size = None num_test = None fail_count = 0 tc_failed = [] tc_list = [] - if len(sys.argv) == 8 and len(sys.argv[7].split(',')) <= test_counter(): + if len(sys.argv) == 7 and len(sys.argv[6].split(',')) <= test_counter(): rpc_py = sys.argv[1] total_size = int(sys.argv[2]) block_size = int(sys.argv[3]) - cluster_size = int(sys.argv[4]) - base_dir_path = sys.argv[5] - app_path = sys.argv[6] - tc_list = sys.argv[7].split(',') + base_dir_path = sys.argv[4] + app_path = sys.argv[5] + tc_list = sys.argv[6].split(',') else: print("Invalid argument") try: - tc = TestCases(rpc_py, total_size, block_size, cluster_size, base_dir_path, app_path) - + tc = TestCases(rpc_py, total_size, block_size, base_dir_path, app_path) if "all" in tc_list: tc_list = sorted([i.split("test_case")[1] for i in dir(TestCases) if "test_case" in i], key=int) diff --git a/test/lvol/rpc_commands_lib.py b/test/lvol/rpc_commands_lib.py index 242ade58fa..ec0b9f29b6 100644 --- a/test/lvol/rpc_commands_lib.py +++ b/test/lvol/rpc_commands_lib.py @@ -111,12 +111,14 @@ class Commands_Rpc(object): output = self.rpc.construct_malloc_bdev(total_size, block_size)[0] return output.rstrip('\n') - def construct_lvol_store(self, base_name, lvs_name, cluster_size): + def construct_lvol_store(self, base_name, lvs_name, cluster_size=None): print("INFO: RPC COMMAND construct_lvol_store") - output = self.rpc.construct_lvol_store( - base_name, - lvs_name, - "-c {cluster_sz}".format(cluster_sz=cluster_size))[0] + if cluster_size: + output = self.rpc.construct_lvol_store(base_name, + lvs_name, + "-c {cluster_sz}".format(cluster_sz=cluster_size))[0] + else: + output = self.rpc.construct_lvol_store(base_name, lvs_name)[0] return output.rstrip('\n') def construct_lvol_bdev(self, uuid, lbd_name, size, thin=False): diff --git a/test/lvol/test_cases.py b/test/lvol/test_cases.py index 7200ab3c07..ba9bf44766 100644 --- a/test/lvol/test_cases.py +++ b/test/lvol/test_cases.py @@ -161,11 +161,11 @@ def case_message(func): class TestCases(object): - def __init__(self, rpc_py, total_size, block_size, cluster_size, base_dir_path, app_path): + def __init__(self, rpc_py, total_size, block_size, base_dir_path, app_path): self.c = Commands_Rpc(rpc_py) self.total_size = total_size self.block_size = block_size - self.cluster_size = cluster_size + self.cluster_size = None self.path = base_dir_path self.app_path = app_path self.lvs_name = "lvs_test" @@ -290,8 +290,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) self.c.destroy_lvol_store(uuid_store) @@ -305,8 +304,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) @@ -326,8 +324,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) size = self.get_lvol_bdev_split_size(4) @@ -354,8 +351,7 @@ class TestCases(object): self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) @@ -379,11 +375,9 @@ class TestCases(object): self.block_size) uuid_store_1 = self.c.construct_lvol_store(base_name_1, - self.lvs_name + "1", - self.cluster_size) + self.lvs_name + "1") uuid_store_2 = self.c.construct_lvol_store(base_name_2, - self.lvs_name + "2", - self.cluster_size) + self.lvs_name + "2") fail_count = self.c.check_get_lvol_stores(base_name_1, uuid_store_1, self.cluster_size) fail_count = self.c.check_get_lvol_stores(base_name_2, uuid_store_2, @@ -421,8 +415,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) lvs_size = self.get_lvs_size() @@ -443,12 +436,10 @@ class TestCases(object): @case_message def test_case102(self): - size = int((self.total_size / 2) - 1) base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) size = self.get_lvs_size() @@ -472,8 +463,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) # size is equal to one quarter of size malloc bdev @@ -514,8 +504,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) lvs_size = self.get_lvs_size() @@ -537,8 +526,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) self.c.destroy_lvol_store(uuid_store) @@ -552,8 +540,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) fail_count += self.c.destroy_lvol_store(self.lvs_name) @@ -567,8 +554,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) lvs_size = self.get_lvs_size() @@ -590,8 +576,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) size = self.get_lvol_bdev_split_size(4) @@ -613,8 +598,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) size = self.get_lvol_bdev_split_size(4) @@ -623,7 +607,7 @@ class TestCases(object): size) fail_count += self.c.check_get_bdevs_methods(uuid_bdev, size) - sz = size + 1 + sz = size + 4 self.c.resize_lvol_bdev(uuid_bdev, sz) fail_count += self.c.check_get_bdevs_methods(uuid_bdev, sz) sz = size * 2 @@ -632,7 +616,7 @@ class TestCases(object): sz = size * 3 self.c.resize_lvol_bdev(uuid_bdev, sz) fail_count += self.c.check_get_bdevs_methods(uuid_bdev, sz) - sz = (size * 4) - 1 + sz = (size * 4) - 4 self.c.resize_lvol_bdev(uuid_bdev, sz) fail_count += self.c.check_get_bdevs_methods(uuid_bdev, sz) sz = 0 @@ -650,8 +634,7 @@ class TestCases(object): base_path = path.dirname(sys.argv[0]) base_name = "Nvme0n1p0" uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) if self.c.destroy_lvol_store(self.lvs_name) != 0: @@ -682,8 +665,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) @@ -721,13 +703,11 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) if self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) == 0: + self.lvs_name) == 0: fail_count += 1 self.c.destroy_lvol_store(uuid_store) self.c.delete_malloc_bdev(base_name) @@ -741,14 +721,12 @@ class TestCases(object): base_name_2 = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store_1 = self.c.construct_lvol_store(base_name_1, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name_1, uuid_store_1, self.cluster_size) if self.c.construct_lvol_store(base_name_2, - self.lvs_name, - self.cluster_size) == 0: + self.lvs_name) == 0: fail_count += 1 fail_count += self.c.destroy_lvol_store(uuid_store_1) @@ -803,8 +781,7 @@ class TestCases(object): self.block_size) # Construct_lvol_store on correct, exisitng malloc bdev uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) # Check correct uuid values in response get_lvol_stores command fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) @@ -1063,8 +1040,7 @@ class TestCases(object): self.block_size) # create lvol store on mamloc bdev uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) lvs = self.c.get_lvol_stores(self.lvs_name)[0] @@ -1125,6 +1101,7 @@ class TestCases(object): # destroy lvol store fail_count += self.c.destroy_lvol_store(uuid_store) # destroy malloc bdev + fail_count += self.c.delete_malloc_bdev(base_name) # Expected result: # - calls successful, return code = 0 # - no other operation fails @@ -1143,8 +1120,7 @@ class TestCases(object): self.block_size) # construct lvol store on malloc bdev uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) lvs = self.c.get_lvol_stores(self.lvs_name)[0] @@ -1183,6 +1159,7 @@ class TestCases(object): # destroy lvol store fail_count += self.c.destroy_lvol_store(uuid_store) # destroy malloc bdev + fail_count += self.c.delete_malloc_bdev(base_name) # Expected result: # - calls successful, return code = 0 # - no other operation fails @@ -1201,8 +1178,7 @@ class TestCases(object): self.block_size) # construct lvol store on malloc bdev uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) lvs = self.c.get_lvol_stores(self.lvs_name)[0] @@ -1225,6 +1201,7 @@ class TestCases(object): # destroy lvol store fail_count += self.c.destroy_lvol_store(uuid_store) # destroy malloc bdev + fail_count += self.c.delete_malloc_bdev(base_name) # Expected result: # - calls successful, return code = 0 # - verification ends with success @@ -1275,8 +1252,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) # construct lvol store on malloc bdev - uuid_store = self.c.construct_lvol_store(base_name, self.lvs_name, - self.cluster_size) + uuid_store = self.c.construct_lvol_store(base_name, self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) lvs = self.c.get_lvol_stores(self.lvs_name)[0] @@ -1329,6 +1305,7 @@ class TestCases(object): # destroy lvol store fail_count += self.c.destroy_lvol_store(uuid_store) # destroy malloc bdev + fail_count += self.c.delete_malloc_bdev(base_name) # Expected result: # - calls successful, return code = 0 # - no other operation fails @@ -1346,8 +1323,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) # construct lvol store on malloc bdev - uuid_store = self.c.construct_lvol_store(base_name, self.lvs_name, - self.cluster_size) + uuid_store = self.c.construct_lvol_store(base_name, self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) lvs = self.c.get_lvol_stores(self.lvs_name)[0] @@ -1387,6 +1363,7 @@ class TestCases(object): # destroy lvol store fail_count += self.c.destroy_lvol_store(uuid_store) # destroy malloc bdev + fail_count += self.c.delete_malloc_bdev(base_name) # Expected result: # - calls successful, return code = 0 # - no other operation fails @@ -1416,8 +1393,7 @@ class TestCases(object): # create lvol store, create 5 bdevs # save info of all lvs and lvol bdevs uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) @@ -1490,8 +1466,7 @@ class TestCases(object): # Create lvol store on NVMe bdev, create ten lvol bdevs on lvol store and # verify all configuration call results uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) @@ -1519,8 +1494,7 @@ class TestCases(object): base_name = "Nvme0n1p0" # construct lvol store on NVMe bdev uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) traddr = self._find_traddress_for_nvme("Nvme0") @@ -1557,8 +1531,7 @@ class TestCases(object): self.block_size) # Construct lvol store on malloc bdev uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) @@ -1612,8 +1585,7 @@ class TestCases(object): self.block_size) # Construct lvol store uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) size = self.get_lvol_bdev_split_size(6) @@ -1688,8 +1660,7 @@ class TestCases(object): self.block_size) # Construct lvol store uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) # Create thin provisioned lvol bdev with size equal to 50% of lvs space @@ -1744,8 +1715,7 @@ class TestCases(object): self.block_size) # Construct lvol store uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) # Create thick provisioned lvol bdev @@ -1792,8 +1762,7 @@ class TestCases(object): self.block_size) # Construct lvol store uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) lvs = self.c.get_lvol_stores() @@ -1856,8 +1825,7 @@ class TestCases(object): self.block_size) # Create lvol store uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) size = self.get_lvol_bdev_split_size(6) @@ -1930,8 +1898,7 @@ class TestCases(object): self.block_size) # Create lvol store uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) size = self.get_lvol_bdev_split_size(6) @@ -2021,8 +1988,7 @@ class TestCases(object): # Create lvol store uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) size = self.get_lvol_bdev_split_size(4) @@ -2113,8 +2079,7 @@ class TestCases(object): # Create lvol store uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) size = self.get_lvol_bdev_split_size(4) @@ -2191,8 +2156,7 @@ class TestCases(object): # Create lvol store uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size) lvs = self.c.get_lvol_stores() @@ -2293,8 +2257,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) lvs_uuid = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_name, lvs_uuid, self.cluster_size, @@ -2382,15 +2345,13 @@ class TestCases(object): # Create lvol store on each malloc bdev lvs_uuid_1 = self.c.construct_lvol_store(base_bdev_1, - lvs_name_1, - self.cluster_size) + lvs_name_1) fail_count += self.c.check_get_lvol_stores(base_bdev_1, lvs_uuid_1, self.cluster_size, lvs_name_1) lvs_uuid_2 = self.c.construct_lvol_store(base_bdev_2, - lvs_name_2, - self.cluster_size) + lvs_name_2) fail_count += self.c.check_get_lvol_stores(base_bdev_2, lvs_uuid_2, self.cluster_size, @@ -2463,8 +2424,7 @@ class TestCases(object): base_bdev = self.c.construct_malloc_bdev(self.total_size, self.block_size) lvs_uuid = self.c.construct_lvol_store(base_bdev, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count += self.c.check_get_lvol_stores(base_bdev, lvs_uuid, self.cluster_size, @@ -2501,8 +2461,7 @@ class TestCases(object): base_name = self.c.construct_malloc_bdev(self.total_size, self.block_size) uuid_store = self.c.construct_lvol_store(base_name, - self.lvs_name, - self.cluster_size) + self.lvs_name) fail_count = self.c.check_get_lvol_stores(base_name, uuid_store, self.cluster_size)