test/lvol: rewrite construct_lvs_with_cluster_size_min/max to bash

Change-Id: Ifa772d238fd0cbee1d8c9c2bdee67dd6839eaeab
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/+/461881
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: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-07-15 13:21:58 +02:00 committed by Jim Harris
parent c6e1399118
commit 67ab15d6e7
3 changed files with 44 additions and 54 deletions

View File

@ -76,6 +76,49 @@ function test_construct_lvs_conflict_alias() {
check_leftover_devices check_leftover_devices
} }
# call bdev_lvol_create_lvstore with cluster size equals to malloc bdev size + 1B
# call bdev_lvol_create_lvstore with cluster size smaller than minimal value of 8192
function test_construct_lvs_different_cluster_size() {
# create the first lvs
malloc1_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)
lvs1_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc1_name" lvs_test)
# make sure we've got 1 lvs
lvol_stores=$(rpc_cmd bdev_lvol_get_lvstores)
[ "$(jq length <<< "$lvol_stores")" == "1" ]
# use the second malloc for some more lvs creation negative tests
malloc2_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)
# capacity bigger than malloc's
rpc_cmd bdev_lvol_create_lvstore "$malloc2_name" lvs2_test -c $(( MALLOC_SIZE + 1 )) && false
# capacity equal to malloc's (no space left for metadata)
rpc_cmd bdev_lvol_create_lvstore "$malloc2_name" lvs2_test -c $MALLOC_SIZE && false
# capacity smaller than malloc's, but still no space left for metadata
rpc_cmd bdev_lvol_create_lvstore "$malloc2_name" lvs2_test -c $(( MALLOC_SIZE - 1 )) && false
# cluster size smaller than the minimum (8192)
rpc_cmd bdev_lvol_create_lvstore "$malloc2_name" lvs2_test -c 8191 && false
# no additional lvol stores should have been created
lvol_stores=$(rpc_cmd bdev_lvol_get_lvstores)
[ "$(jq length <<< "$lvol_stores")" == "1" ]
# this one should be fine
lvs2_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc2_name" lvs2_test -c 8192)
# we should have one more lvs
lvol_stores=$(rpc_cmd bdev_lvol_get_lvstores)
[ "$(jq length <<< "$lvol_stores")" == "2" ]
# clean up
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs1_uuid"
rpc_cmd bdev_lvol_get_lvstores -u "$lvs1_uuid" && false
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs2_uuid"
rpc_cmd bdev_lvol_get_lvstores -u "$lvs2_uuid" && false
rpc_cmd bdev_malloc_delete "$malloc1_name"
rpc_cmd bdev_malloc_delete "$malloc2_name"
check_leftover_devices
}
# create lvs + lvol on top, verify lvol's parameters # create lvs + lvol on top, verify lvol's parameters
function test_construct_lvol() { function test_construct_lvol() {
# create an lvol store # create an lvol store
@ -335,6 +378,7 @@ run_test "test_construct_lvs" test_construct_lvs
run_test "test_construct_lvs_nonexistent_bdev" test_construct_lvs_nonexistent_bdev run_test "test_construct_lvs_nonexistent_bdev" test_construct_lvs_nonexistent_bdev
run_test "test_construct_two_lvs_on_the_same_bdev" test_construct_two_lvs_on_the_same_bdev run_test "test_construct_two_lvs_on_the_same_bdev" test_construct_two_lvs_on_the_same_bdev
run_test "test_construct_lvs_conflict_alias" test_construct_lvs_conflict_alias run_test "test_construct_lvs_conflict_alias" test_construct_lvs_conflict_alias
run_test "test_construct_lvs_different_cluster_size" test_construct_lvs_different_cluster_size
run_test "test_construct_lvol" test_construct_lvol run_test "test_construct_lvol" test_construct_lvol
run_test "test_construct_multi_lvols" test_construct_multi_lvols 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_lvols_conflict_alias" test_construct_lvols_conflict_alias

View File

@ -38,8 +38,6 @@ function usage() {
551: 'delete_lvol_bdev', 551: 'delete_lvol_bdev',
552: 'bdev_lvol_delete_lvstore_with_clones', 552: 'bdev_lvol_delete_lvstore_with_clones',
553: 'unregister_lvol_bdev', 553: 'unregister_lvol_bdev',
600: 'bdev_lvol_create_lvstore_with_cluster_size_max',
601: 'bdev_lvol_create_lvstore_with_cluster_size_min',
602: 'bdev_lvol_create_lvstore_with_all_clear_methods', 602: 'bdev_lvol_create_lvstore_with_all_clear_methods',
650: 'thin_provisioning_check_space', 650: 'thin_provisioning_check_space',
651: 'thin_provisioning_read_empty_bdev', 651: 'thin_provisioning_read_empty_bdev',

View File

@ -130,8 +130,6 @@ def case_message(func):
551: 'delete_lvol_bdev', 551: 'delete_lvol_bdev',
552: 'bdev_lvol_delete_lvstore_with_clones', 552: 'bdev_lvol_delete_lvstore_with_clones',
553: 'unregister_lvol_bdev', 553: 'unregister_lvol_bdev',
600: 'bdev_lvol_create_lvstore_with_cluster_size_max',
601: 'bdev_lvol_create_lvstore_with_cluster_size_min',
602: 'bdev_lvol_create_lvstore_with_all_clear_methods', 602: 'bdev_lvol_create_lvstore_with_all_clear_methods',
# Provisioning # Provisioning
650: 'thin_provisioning_check_space', 650: 'thin_provisioning_check_space',
@ -926,56 +924,6 @@ class TestCases(object):
# - no other operation fails # - no other operation fails
return fail_count return fail_count
@case_message
def test_case600(self):
"""
bdev_lvol_create_lvstore_with_cluster_size_max
Negative test for constructing a new lvol store.
Call bdev_lvol_create_lvstore with cluster size is equal malloc bdev size + 1B.
"""
fail_count = 0
# Create malloc bdev
base_name = self.c.bdev_malloc_create(self.total_size,
self.block_size)
# Construct_lvol_store on correct, exisitng malloc bdev and cluster size equal
# malloc bdev size in bytes + 1B
lvol_uuid = self.c.bdev_lvol_create_lvstore(base_name,
self.lvs_name,
(self.total_size * 1024 * 1024) + 1) == 0
if self.c.check_bdev_lvol_get_lvstores(base_name, lvol_uuid) == 0:
fail_count += 1
fail_count += self.c.bdev_malloc_delete(base_name)
# Expected result:
# - return code != 0
# - Error code response printed to stdout
return fail_count
@case_message
def test_case601(self):
"""
bdev_lvol_create_lvstore_with_cluster_size_min
Negative test for constructing a new lvol store.
Call bdev_lvol_create_lvstore with cluster size smaller than minimal value of 8192.
"""
fail_count = 0
# Create malloc bdev
base_name = self.c.bdev_malloc_create(self.total_size,
self.block_size)
# Try construct lvol store on malloc bdev with cluster size 8191
lvol_uuid = self.c.bdev_lvol_create_lvstore(base_name, self.lvs_name, 8191)
# Verify that lvol store was not created
if self.c.check_bdev_lvol_get_lvstores(base_name, lvol_uuid) == 0:
fail_count += 1
fail_count += self.c.bdev_malloc_delete(base_name)
# Expected result:
# - construct lvol store return code != 0
# - Error code response printed to stdout
return fail_count
@case_message @case_message
def test_case602(self): def test_case602(self):
""" """