test/lvol: Rewrite unregister_lvol_bdev to Bash
This test case covers unregistering of all bdevs by removing malloc device under the lvol store with snapshots|clones present (test case no. 553). Change-Id: I7e706230c5156b5a072e73c774da492597a53379 Signed-off-by: Michal Berger <michalx.berger@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/892 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:
parent
4605ac90b0
commit
e5497fd293
@ -149,6 +149,57 @@ function test_bdev_lvol_delete_lvstore_with_clones() {
|
||||
check_leftover_devices
|
||||
}
|
||||
|
||||
# Test for unregistering the lvol bdevs. Removing malloc bdev under an lvol
|
||||
# store triggers unregister of all lvol bdevs. Verify it with clones present.
|
||||
function test_unregister_lvol_bdev() {
|
||||
local snapshot_name1=snapshot1 snapshot_uuid1
|
||||
local snapshot_name2=snapshot2 snapshot_uuid2
|
||||
local clone_name=clone clone_uuid
|
||||
local lbd_name=lbd_test
|
||||
|
||||
local bdev_uuid
|
||||
local lvstore_name=lvs_name lvstore_uuid
|
||||
local malloc_dev
|
||||
|
||||
malloc_dev=$(rpc_cmd bdev_malloc_create 256 "$MALLOC_BS")
|
||||
lvstore_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc_dev" "$lvstore_name")
|
||||
|
||||
get_lvs_jq bdev_lvol_get_lvstores -u "$lvstore_uuid"
|
||||
[[ ${jq_out["uuid"]} == "$lvstore_uuid" ]]
|
||||
[[ ${jq_out["name"]} == "$lvstore_name" ]]
|
||||
[[ ${jq_out["base_bdev"]} == "$malloc_dev" ]]
|
||||
|
||||
size=$(( jq_out["free_clusters"] * jq_out["cluster_size"] / 4 / 1024**2 ))
|
||||
|
||||
bdev_uuid=$(rpc_cmd bdev_lvol_create -u "$lvstore_uuid" "$lbd_name" "$size")
|
||||
|
||||
get_bdev_jq bdev_get_bdevs -b "$bdev_uuid"
|
||||
|
||||
snapshot_uuid1=$(rpc_cmd bdev_lvol_snapshot "${jq_out["name"]}" "$snapshot_name1")
|
||||
|
||||
get_bdev_jq bdev_get_bdevs -b "$lvstore_name/$snapshot_name1"
|
||||
[[ ${jq_out["name"]} == "$snapshot_uuid1" ]]
|
||||
[[ ${jq_out["product_name"]} == "Logical Volume" ]]
|
||||
[[ ${jq_out["aliases[0]"]} == "$lvstore_name/$snapshot_name1" ]]
|
||||
|
||||
clone_uuid=$(rpc_cmd bdev_lvol_clone "$lvstore_name/$snapshot_name1" "$clone_name")
|
||||
|
||||
get_bdev_jq bdev_get_bdevs -b "$lvstore_name/$clone_name"
|
||||
[[ ${jq_out["name"]} == "$clone_uuid" ]]
|
||||
[[ ${jq_out["product_name"]} == "Logical Volume" ]]
|
||||
[[ ${jq_out["aliases[0]"]} == "$lvstore_name/$clone_name" ]]
|
||||
|
||||
snapshot_uuid2=$(rpc_cmd bdev_lvol_snapshot "${jq_out["name"]}" "$snapshot_name2")
|
||||
|
||||
get_bdev_jq bdev_get_bdevs -b "$lvstore_name/$snapshot_name2"
|
||||
[[ ${jq_out["name"]} == "$snapshot_uuid2" ]]
|
||||
[[ ${jq_out["product_name"]} == "Logical Volume" ]]
|
||||
[[ ${jq_out["aliases[0]"]} == "$lvstore_name/$snapshot_name2" ]]
|
||||
|
||||
rpc_cmd bdev_malloc_delete "$malloc_dev"
|
||||
check_leftover_devices
|
||||
}
|
||||
|
||||
$rootdir/app/spdk_tgt/spdk_tgt &
|
||||
spdk_pid=$!
|
||||
trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT
|
||||
@ -159,6 +210,7 @@ run_test "test_hotremove_lvol_store_multiple_lvols" test_hotremove_lvol_store_mu
|
||||
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
|
||||
run_test "test_bdev_lvol_delete_lvstore_with_clones" test_bdev_lvol_delete_lvstore_with_clones
|
||||
run_test "test_unregister_lvol_bdev" test_unregister_lvol_bdev
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
killprocess $spdk_pid
|
||||
|
@ -23,7 +23,6 @@ function usage() {
|
||||
echo " --test-cases= List test cases which will be run:
|
||||
350: 'nested_destroy_logical_volume_negative',
|
||||
400: 'nested_construct_logical_volume_positive',
|
||||
553: 'unregister_lvol_bdev',
|
||||
850: 'clear_method_none',
|
||||
851: 'clear_method_unmap',
|
||||
or
|
||||
|
@ -111,8 +111,6 @@ def test_counter():
|
||||
def case_message(func):
|
||||
def inner(*args, **kwargs):
|
||||
test_name = {
|
||||
# bdev_lvol_delete_lvstore - positive tests
|
||||
553: 'unregister_lvol_bdev',
|
||||
# logical volume clear_method test
|
||||
850: 'clear_method_none',
|
||||
851: 'clear_method_unmap',
|
||||
@ -248,59 +246,6 @@ class TestCases(object):
|
||||
lvs = self.c.bdev_lvol_get_lvstores(lvs_name)[0]
|
||||
return int(int(lvs['cluster_size']) / MEGABYTE)
|
||||
|
||||
@case_message
|
||||
def test_case553(self):
|
||||
"""
|
||||
unregister_lvol_bdev
|
||||
|
||||
Test for unregistering the lvol bdevs.
|
||||
Removing malloc bdev under an lvol store triggers unregister of
|
||||
all lvol bdevs. Verify it with clones present.
|
||||
"""
|
||||
|
||||
fail_count = 0
|
||||
snapshot_name = "snapshot"
|
||||
snapshot_name2 = "snapshot2"
|
||||
clone_name = "clone"
|
||||
|
||||
# Create malloc bdev
|
||||
base_name = self.c.bdev_malloc_create(self.total_size,
|
||||
self.block_size)
|
||||
# Construct_lvol_store on correct, exisitng malloc bdev
|
||||
uuid_store = self.c.bdev_lvol_create_lvstore(base_name,
|
||||
self.lvs_name,
|
||||
self.cluster_size)
|
||||
# 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)
|
||||
lvs = self.c.bdev_lvol_get_lvstores()
|
||||
size = int(int(lvs[0]['free_clusters'] * lvs[0]['cluster_size']) / 4 / MEGABYTE)
|
||||
|
||||
# Create lvol bdev, snapshot it, then clone it and then snapshot the clone
|
||||
uuid_bdev0 = self.c.bdev_lvol_create(uuid_store, self.lbd_name, size, thin=True)
|
||||
lvol_bdev = self.c.get_lvol_bdev_with_name(uuid_bdev0)
|
||||
|
||||
fail_count += self.c.bdev_lvol_snapshot(lvol_bdev['name'], snapshot_name)
|
||||
snapshot_bdev = self.c.get_lvol_bdev_with_name(self.lvs_name + "/" + snapshot_name)
|
||||
|
||||
fail_count += self.c.bdev_lvol_clone(self.lvs_name + "/" + snapshot_name, clone_name)
|
||||
clone_bdev = self.c.get_lvol_bdev_with_name(self.lvs_name + "/" + clone_name)
|
||||
|
||||
fail_count += self.c.bdev_lvol_snapshot(clone_bdev['name'], snapshot_name2)
|
||||
snapshot_bdev2 = self.c.get_lvol_bdev_with_name(self.lvs_name + "/" + snapshot_name2)
|
||||
|
||||
# Delete malloc bdev
|
||||
self.c.bdev_malloc_delete(base_name)
|
||||
|
||||
# Check response bdev_lvol_get_lvstores command
|
||||
if self.c.check_bdev_lvol_get_lvstores("", "", "") == 1:
|
||||
fail_count += 1
|
||||
|
||||
# Expected result:
|
||||
# - bdev_lvol_get_lvstores: response should be of no value after destroyed lvol store
|
||||
# - no other operation fails
|
||||
return fail_count
|
||||
|
||||
@case_message
|
||||
def test_case850(self):
|
||||
""""
|
||||
|
Loading…
x
Reference in New Issue
Block a user