test/lvol: add tasting with different lvol store cluster sizes

Added new test case 702 for tasting lvol stores, similar to tc700
but with different lvol store cluster sizes.

Change-Id: Id33fc6ff9520ed21219f49f161bd41c4f6b71848
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/420758
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Pawel Niedzwiecki 2018-07-30 17:42:37 +02:00 committed by Jim Harris
parent 96ed6f24ba
commit 1b85cdad64
3 changed files with 126 additions and 4 deletions

View File

@ -206,7 +206,7 @@ if [ $SPDK_TEST_LVOL -eq 1 ]; then
test_cases="1,50,51,52,53,100,101,102,150,200,201,250,251,252,253,254,255,"
test_cases+="300,301,450,451,452,550,551,552,553,"
test_cases+="600,601,650,651,652,654,655,"
test_cases+="700,701,750,751,752,753,754,755,756,757,758,759,"
test_cases+="700,701,702,750,751,752,753,754,755,756,757,758,759,"
test_cases+="800,801,802,803,804,10000"
run_test ./test/lvol/lvol.sh --test-cases=$test_cases
report_test_completion "lvol"

View File

@ -124,12 +124,12 @@ function vhost_kill()
rmmod nbd || true
}
trap "vhost_kill; rm -f $BASE_DIR/aio_bdev_0; exit 1" SIGINT SIGTERM EXIT
trap "vhost_kill; rm -f $BASE_DIR/aio_bdev_0 $BASE_DIR/aio_bdev_1; exit 1" SIGINT SIGTERM EXIT
truncate -s 400M $BASE_DIR/aio_bdev_0
truncate -s 400M $BASE_DIR/aio_bdev_0 $BASE_DIR/aio_bdev_1
vhost_start
$BASE_DIR/lvol_test.py $rpc_py $total_size $block_size $BASE_DIR $TEST_DIR/app/vhost "${test_cases[@]}"
vhost_kill
rm -rf $BASE_DIR/aio_bdev_0
rm -rf $BASE_DIR/aio_bdev_0 $BASE_DIR/aio_bdev_1
trap - SIGINT SIGTERM EXIT

View File

@ -130,6 +130,7 @@ def case_message(func):
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
700: 'tasting_positive',
701: 'tasting_lvol_store_positive',
702: 'tasting_positive_with_different_lvol_store_cluster_size',
750: 'snapshot_readonly',
751: 'snapshot_compare_with_lvol_bdev',
752: 'snapshot_during_io_traffic',
@ -1513,6 +1514,127 @@ class TestCases(object):
self.c.delete_aio_bdev(base_name)
return fail_count
@case_message
def test_case702(self):
"""
tasting_positive_with_different_lvol_store_cluster_size
Positive test for tasting a multi lvol bdev configuration.
Create two lvol stores with different cluster sizes with some lvol bdevs on aio
drive and restart vhost app.
After restarting configuration should be automatically loaded and should be exactly
the same as before restarting.
"""
fail_count = 0
uuid_bdevs = []
cluster_size_1M = MEGABYTE
cluster_size_32M = 32 * MEGABYTE
base_name_1M = "aio_bdev0"
base_name_32M = "aio_bdev1"
base_path = path.dirname(sys.argv[0])
vhost_path = path.join(self.app_path, 'vhost')
pid_path = path.join(base_path, 'vhost.pid')
aio_bdev0 = path.join(base_path, 'aio_bdev_0')
aio_bdev1 = path.join(base_path, 'aio_bdev_1')
self.c.construct_aio_bdev(aio_bdev0, base_name_1M, 4096)
self.c.construct_aio_bdev(aio_bdev1, base_name_32M, 4096)
# Create initial configuration on running vhost instance
# create lvol store, create 5 bdevs
# save info of all lvs and lvol bdevs
uuid_store_1M = self.c.construct_lvol_store(base_name_1M,
self.lvs_name + "_1M",
cluster_size_1M)
fail_count += self.c.check_get_lvol_stores(base_name_1M,
uuid_store_1M,
cluster_size_1M)
uuid_store_32M = self.c.construct_lvol_store(base_name_32M,
self.lvs_name + "_32M",
cluster_size_32M)
fail_count += self.c.check_get_lvol_stores(base_name_32M,
uuid_store_32M,
cluster_size_32M)
# size = approx 20% of total aio bdev size
size_1M = self.get_lvs_divided_size(5, self.lvs_name + "_1M")
size_32M = self.get_lvs_divided_size(5, self.lvs_name + "_32M")
for i in range(5):
uuid_bdev = self.c.construct_lvol_bdev(uuid_store_1M,
self.lbd_name + str(i) + "_1M",
size_1M)
uuid_bdevs.append(uuid_bdev)
# Using get_bdevs command verify lvol bdevs were correctly created
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, size_1M)
for i in range(5):
uuid_bdev = self.c.construct_lvol_bdev(uuid_store_32M,
self.lbd_name + str(i) + "_32M",
size_32M)
uuid_bdevs.append(uuid_bdev)
# Using get_bdevs command verify lvol bdevs were correctly created
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, size_32M)
old_bdevs = sorted(self.c.get_lvol_bdevs(), key=lambda x: x["name"])
old_stores = sorted(self.c.get_lvol_stores(), key=lambda x: x["name"])
# Shut down vhost instance and restart with new instance
fail_count += self._stop_vhost(pid_path)
remove(pid_path)
if self._start_vhost(vhost_path, pid_path) != 0:
fail_count += 1
return fail_count
self.c.construct_aio_bdev(aio_bdev0, base_name_1M, 4096)
self.c.construct_aio_bdev(aio_bdev1, base_name_32M, 4096)
# Check if configuration was properly loaded after tasting
# get all info all lvs and lvol bdevs, compare with previous info
new_bdevs = sorted(self.c.get_lvol_bdevs(), key=lambda x: x["name"])
new_stores = sorted(self.c.get_lvol_stores(), key=lambda x: x["name"])
if old_stores != new_stores:
fail_count += 1
print("ERROR: old and loaded lvol store is not the same")
print("DIFF:")
print(old_stores)
print(new_stores)
if len(old_bdevs) != len(new_bdevs):
fail_count += 1
print("ERROR: old and loaded lvol bdev list count is not equal")
for o, n in zip(old_bdevs, new_bdevs):
if o != n:
fail_count += 1
print("ERROR: old and loaded lvol bdev is not the same")
print("DIFF:")
pprint.pprint([o, n])
if fail_count != 0:
self.c.delete_aio_bdev(base_name_1M)
self.c.delete_aio_bdev(base_name_32M)
return fail_count
for uuid_bdev in uuid_bdevs:
self.c.destroy_lvol_bdev(uuid_bdev)
if self.c.destroy_lvol_store(uuid_store_1M) != 0:
fail_count += 1
if self.c.destroy_lvol_store(uuid_store_32M) != 0:
fail_count += 1
self.c.delete_aio_bdev(base_name_1M)
self.c.delete_aio_bdev(base_name_32M)
return fail_count
@case_message
def test_case750(self):
"""