test/lvol: Check if lvol store is removed after vhost reboot

Fix: Add condition to some test cases
because there are more possible return values
in check_get_lvol_stores function.

Change-Id: Id035d1edc52252f009277c9afd5f07f8875e0dcc
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/388242
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Pawel Kaminski 2017-11-20 20:58:29 +01:00 committed by Jim Harris
parent 5c40019fcc
commit 08ff0eaa9e
4 changed files with 55 additions and 7 deletions

View File

@ -154,7 +154,7 @@ fi
if [ $SPDK_TEST_LVOL -eq 1 ]; then
timing_enter lvol
test_cases="1,50,51,52,53,100,101,102,250,251,252,253,"
test_cases="1,50,51,52,53,100,101,102,250,251,252,253,255,"
test_cases+="300,301,450,451,452,550,600,601,650,700"
run_test ./test/lvol/lvol.sh --test-cases=$test_cases
timing_exit lvol

View File

@ -80,6 +80,7 @@ class Commands_Rpc(object):
return 1
else:
print("INFO: Lvol store not exist")
return 2
return 0
def construct_malloc_bdev(self, total_size, block_size):

View File

@ -39,6 +39,7 @@ def header(num):
252: 'destroy_lvol_store_with_lvol_bdev_positive',
253: 'destroy_multi_logical_volumes_positive',
254: 'destroy_after_resize_lvol_bdev_positive',
255: 'delete_lvol_store_persistent_positive',
300: 'destroy_lvol_store_nonexistent_lvs_uuid',
301: 'delete_lvol_store_underlying_bdev',
350: 'nested_destroy_logical_volume_negative',
@ -151,7 +152,8 @@ class TestCases(object):
self.cluster_size)
self.c.destroy_lvol_store(uuid_store)
self.c.delete_bdev(base_name)
fail_count += self.c.check_get_lvol_stores("", "", "")
if self.c.check_get_lvol_stores("", "", "") == 1:
fail_count += 1
footer(1)
return fail_count
@ -397,7 +399,8 @@ class TestCases(object):
fail_count = self.c.check_get_lvol_stores(base_name, uuid_store,
self.cluster_size)
self.c.destroy_lvol_store(uuid_store)
fail_count += self.c.check_get_lvol_stores("", "", "")
if self.c.check_get_lvol_stores("", "", "") == 1:
fail_count += 1
self.c.delete_bdev(base_name)
footer(250)
return fail_count
@ -412,7 +415,8 @@ class TestCases(object):
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)
fail_count += self.c.check_get_lvol_stores("", "", "")
if self.c.check_get_lvol_stores("", "", "") == 1:
fail_count += 1
fail_count += self.c.delete_bdev(base_name)
footer(251)
return fail_count
@ -434,7 +438,8 @@ class TestCases(object):
if self.c.destroy_lvol_store(uuid_store) != 0:
fail_count += 1
fail_count += self.c.check_get_lvol_stores("", "", "")
if self.c.check_get_lvol_stores("", "", "") == 1:
fail_count += 1
self.c.delete_bdev(base_name)
footer(252)
return fail_count
@ -457,7 +462,8 @@ class TestCases(object):
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, size)
self.c.destroy_lvol_store(uuid_store)
fail_count += self.c.check_get_lvol_stores("", "", "")
if self.c.check_get_lvol_stores("", "", "") == 1:
fail_count += 1
self.c.delete_bdev(base_name)
footer(253)
return fail_count
@ -487,11 +493,40 @@ class TestCases(object):
fail_count += self.c.resize_lvol_bdev(uuid_bdev, 0)
self.c.destroy_lvol_store(uuid_store)
fail_count += self.c.check_get_lvol_stores("", "", "")
if self.c.check_get_lvol_stores("", "", "") == 1:
fail_count += 1
self.c.delete_bdev(base_name)
footer(254)
return fail_count
def test_case255(self):
header(255)
base_path = path.dirname(sys.argv[0])
vhost_path = path.join(self.app_path, 'vhost')
config_path = path.join(base_path, 'vhost.conf')
pid_path = path.join(base_path, 'vhost.pid')
base_name = "Nvme0n1"
self.c.destroy_lvol_store(self.lvs_name)
uuid_store = self.c.construct_lvol_store(base_name,
self.lvs_name,
self.cluster_size)
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:
fail_count += 1
fail_count += self._stop_vhost(pid_path)
remove(pid_path)
if self._start_vhost(vhost_path, config_path, pid_path) != 0:
fail_count += 1
footer(255)
return fail_count
ret_value = self.c.check_get_lvol_stores(base_name, uuid_store,
self.cluster_size)
if ret_value == 0:
fail_count += 1
footer(255)
return fail_count
def test_case300(self):
header(300)
fail_count = 0

View File

@ -336,6 +336,18 @@ Expected result:
- no other operation fails
- get_lvol_stores: response should be of no value after destroyed lvol store
#### TEST CASE 255 - Name: delete_lvol_store_persistent_positive
Positive test for removing lvol store persistently
Steps:
- construct_lvol_store on NVMe bdev
- destroy lvol store
- restart vhost
- check if destroyed lvol store does not exist on NVMe bdev
Expected result:
- get_lvol_stores should not report any existsing lvol stores in configuration after restarting Vhost instance
- no other operation fails
### destroy_lvol_store - negative tests
#### TEST CASE 300 - Name: destroy_lvol_store_nonexistent_lvs_uuid