test/lvol: rewrite construct_lvol_bdev_on_full_lvol_store to bash

Change-Id: I789c13f6613180b0d9becca035ea4055fa3ee321
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/+/459675
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-06-27 19:32:18 +02:00 committed by Tomasz Zawadzki
parent ba43a0b3ce
commit c997d12694
3 changed files with 20 additions and 46 deletions

View File

@ -198,6 +198,25 @@ function test_construct_lvol_inexistent_lvs() {
check_leftover_devices
}
# try to create lvol on full lvs
function test_construct_lvol_full_lvs() {
# create an lvol store
malloc_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)
lvs_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc_name" lvs_test)
# create valid lvol
lvol1_uuid=$(rpc_cmd bdev_lvol_create -l lvs_test lvol_test1 "$LVS_DEFAULT_CAPACITY_MB")
lvol1=$(rpc_cmd bdev_get_bdevs -b "$lvol1_uuid")
# try to create an lvol on lvs without enough free clusters
rpc_cmd bdev_lvol_create -l lvs_test lvol_test2 1 && false
# clean up
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid"
rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid" && false
rpc_cmd bdev_malloc_delete "$malloc_name"
check_leftover_devices
}
$rootdir/app/spdk_tgt/spdk_tgt &
spdk_pid=$!
@ -209,6 +228,7 @@ run_test "test_construct_lvol" test_construct_lvol
run_test "test_construct_multi_lvols" test_construct_multi_lvols
run_test "test_construct_lvols_conflict_alias" test_construct_lvols_conflict_alias
run_test "test_construct_lvol_inexistent_lvs" test_construct_lvol_inexistent_lvs
run_test "test_construct_lvol_full_lvs" test_construct_lvol_full_lvs
trap - SIGINT SIGTERM EXIT
killprocess $spdk_pid

View File

@ -21,7 +21,6 @@ function usage() {
echo " --block-size Block size for this bdev"
echo "-x set -x for script debug"
echo " --test-cases= List test cases which will be run:
101: 'bdev_lvol_create_on_full_lvol_store',
102: 'bdev_lvol_create_name_twice',
150: 'bdev_lvol_resize_positive',
200: 'resize_logical_volume_nonexistent_logical_volume',

View File

@ -111,7 +111,6 @@ def case_message(func):
def inner(*args, **kwargs):
test_name = {
# bdev_lvol_create - negative tests
101: 'bdev_lvol_create_on_full_lvol_store',
102: 'bdev_lvol_create_name_twice',
# resize_lvol_store - positive tests
150: 'bdev_lvol_resize_positive',
@ -306,50 +305,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_case101(self):
"""
bdev_lvol_create_on_full_lvol_store
Negative test for constructing a new lvol bdev.
Call bdev_lvol_create on a full lvol store.
"""
# Create malloc bdev
base_name = self.c.bdev_malloc_create(self.total_size,
self.block_size)
# Create logical volume store on malloc bdev
uuid_store = self.c.bdev_lvol_create_lvstore(base_name,
self.lvs_name)
# Check correct uuid values in response from bdev_lvol_get_lvstores command
fail_count = self.c.check_bdev_lvol_get_lvstores(base_name, uuid_store,
self.cluster_size)
lvs_size = self.get_lvs_size()
# Construct lvol bdev on correct lvs_uuid
uuid_bdev = self.c.bdev_lvol_create(uuid_store,
self.lbd_name,
lvs_size)
# Verify if lvol bdev was correctly created
fail_count += self.c.check_bdev_get_bdevs_methods(uuid_bdev,
lvs_size)
# Try construct lvol bdev on the same lvs_uuid as in last step
# This call should fail as lvol store space is taken by previously
# created bdev
if self.c.bdev_lvol_create(uuid_store,
self.lbd_name + "_1",
lvs_size) == 0:
fail_count += 1
self.c.bdev_lvol_delete(uuid_bdev)
self.c.bdev_lvol_delete_lvstore(uuid_store)
self.c.bdev_malloc_delete(base_name)
# Expected result:
# - first call successful
# - second bdev_lvol_create call return code != 0
# - EEXIST response printed to stdout
# - no other operation fails
return fail_count
@case_message
def test_case102(self):
"""