test/lvol: rewrite delete_lvol_store_underlying_bdev to bash

This test case is about hotremoving a malloc with
an empty lvolstore on top. We rewrite it to bash,
but also introduce one more similar test case but
with a single lvol in the lvs.

Change-Id: Iea9666080fe5e73befd97ec5e0b2898d8b30ecd6
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462467
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-07-18 12:02:25 +02:00 committed by Jim Harris
parent 9751011fa9
commit 0fa664624c
3 changed files with 38 additions and 36 deletions

View File

@ -61,6 +61,42 @@ function test_hotremove_lvol_store_multiple_lvols() {
check_leftover_devices
}
# create an lvs on malloc, then remove just the malloc
function test_hotremove_lvol_store_base() {
# create lvs + lvol on top
malloc_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)
lvs_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc_name" lvs_test)
# clean up
rpc_cmd bdev_malloc_delete "$malloc_name"
# make sure the lvs is gone
rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid" && false
# make sure we can't delete the lvs again
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid" && false
check_leftover_devices
}
# create an lvs on malloc, then an lvol, then remove just the malloc
function test_hotremove_lvol_store_base_with_lvols() {
# create lvs + lvol on top
malloc_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)
lvs_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc_name" lvs_test)
lvol_uuid=$(rpc_cmd bdev_lvol_create -u "$lvs_uuid" lvol_test "$LVS_DEFAULT_CAPACITY_MB")
rpc_cmd bdev_get_bdevs -b "$lvol_uuid"
# clean up
rpc_cmd bdev_malloc_delete "$malloc_name"
# make sure the lvol is gone
rpc_cmd bdev_get_bdevs -b "$lvol_uuid" && false
# make sure the lvs is gone as well
rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid" && false
# make sure we can't delete the lvs again
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid" && false
check_leftover_devices
}
$rootdir/app/spdk_tgt/spdk_tgt &
spdk_pid=$!
trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT
@ -68,6 +104,8 @@ waitforlisten $spdk_pid
run_test "test_hotremove_lvol_store" test_hotremove_lvol_store
run_test "test_hotremove_lvol_store_multiple_lvols" test_hotremove_lvol_store_multiple_lvols
run_test "test_hotremove_lvol_store_base" test_hotremove_lvol_store_base
run_test "test_hotremove_lvol_store_base_with_lvols" test_hotremove_lvol_store_base_with_lvols
trap - SIGINT SIGTERM EXIT
killprocess $spdk_pid

View File

@ -24,7 +24,6 @@ function usage() {
254: 'destroy_after_bdev_lvol_resize_positive',
255: 'delete_lvol_store_persistent_positive',
300: 'bdev_lvol_delete_lvstore_nonexistent_lvs_uuid',
301: 'delete_lvol_store_underlying_bdev',
350: 'nested_destroy_logical_volume_negative',
400: 'nested_construct_logical_volume_positive',
550: 'delete_bdev_positive',

View File

@ -116,7 +116,6 @@ def case_message(func):
255: 'delete_lvol_store_persistent_positive',
# bdev_lvol_delete_lvstore - negative tests
300: 'bdev_lvol_delete_lvstore_nonexistent_lvs_uuid',
301: 'delete_lvol_store_underlying_bdev',
550: 'delete_bdev_positive',
551: 'delete_lvol_bdev',
552: 'bdev_lvol_delete_lvstore_with_clones',
@ -417,40 +416,6 @@ class TestCases(object):
# - Error code response printed to stdout
return fail_count
@case_message
def test_case301(self):
"""
delete_lvol_store_underlying_bdev
Call bdev_lvol_delete_lvstore after deleting it's base bdev.
Lvol store should be automatically removed on deleting underlying bdev.
"""
# Create malloc bdev
base_name = self.c.bdev_malloc_create(self.total_size,
self.block_size)
# Construct lvol store on created malloc bdev
uuid_store = self.c.bdev_lvol_create_lvstore(base_name,
self.lvs_name)
# Check correct uuid values in response bdev_lvol_get_lvstores command
fail_count = self.c.check_bdev_lvol_get_lvstores(base_name, uuid_store,
self.cluster_size)
# Delete malloc bdev
if self.c.bdev_malloc_delete(base_name) != 0:
fail_count += 1
# Try to destroy lvol store. This call should fail as lvol store
# is no longer present
if self.c.bdev_lvol_delete_lvstore(uuid_store) == 0:
fail_count += 1
# Expected result:
# - bdev_lvol_delete_lvstore return code != 0
# - Error code: ENODEV ("No such device") response printed to stdout
# - no other operation fails
return fail_count
# negative tests
@case_message
def test_case550(self):
"""