test/bdev: add raid1 tests

Change-Id: Ib7c8f8818be9da24e829a4d4470671cd39234543
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
This commit is contained in:
Artur Paszkiewicz 2022-12-30 14:29:05 +01:00 committed by David Ko
parent 3728239ab5
commit cb56a42775
2 changed files with 28 additions and 8 deletions

View File

@ -180,7 +180,15 @@ function raid_state_function_test() {
local base_bdev1="Non_Existed_Base_1" local base_bdev1="Non_Existed_Base_1"
local base_bdev2="Non_Existed_Base_2" local base_bdev2="Non_Existed_Base_2"
local raid_bdev_name="Existed_Raid" local raid_bdev_name="Existed_Raid"
local strip_size=64 local strip_size
local strip_size_create_arg
if [ $raid_level != "raid1" ]; then
strip_size=64
strip_size_create_arg="-z $strip_size"
else
strip_size=0
fi
$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 -L bdev_raid & $rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 -L bdev_raid &
raid_pid=$! raid_pid=$!
@ -189,7 +197,7 @@ function raid_state_function_test() {
# Step1: create a RAID bdev with no base bdevs # Step1: create a RAID bdev with no base bdevs
# Expect state: CONFIGURING # Expect state: CONFIGURING
$rpc_py bdev_raid_create -z $strip_size -r $raid_level -b "$base_bdev1 $base_bdev2" -n $raid_bdev_name $rpc_py bdev_raid_create $strip_size_create_arg -r $raid_level -b "$base_bdev1 $base_bdev2" -n $raid_bdev_name
if ! verify_raid_bdev_state $raid_bdev_name "configuring" $raid_level $strip_size; then if ! verify_raid_bdev_state $raid_bdev_name "configuring" $raid_level $strip_size; then
return 1 return 1
fi fi
@ -197,7 +205,7 @@ function raid_state_function_test() {
# Step2: create one base bdev and add to the RAID bdev # Step2: create one base bdev and add to the RAID bdev
# Expect state: CONFIGURING # Expect state: CONFIGURING
$rpc_py bdev_raid_create -z $strip_size -r $raid_level -b "$base_bdev1 $base_bdev2" -n $raid_bdev_name $rpc_py bdev_raid_create $strip_size_create_arg -r $raid_level -b "$base_bdev1 $base_bdev2" -n $raid_bdev_name
$rpc_py bdev_malloc_create 32 512 -b $base_bdev1 $rpc_py bdev_malloc_create 32 512 -b $base_bdev1
waitforbdev $base_bdev1 waitforbdev $base_bdev1
if ! verify_raid_bdev_state $raid_bdev_name "configuring" $raid_level $strip_size; then if ! verify_raid_bdev_state $raid_bdev_name "configuring" $raid_level $strip_size; then
@ -207,7 +215,7 @@ function raid_state_function_test() {
# Step3: create another base bdev and add to the RAID bdev # Step3: create another base bdev and add to the RAID bdev
# Expect state: ONLINE # Expect state: ONLINE
$rpc_py bdev_raid_create -z $strip_size -r $raid_level -b "$base_bdev1 $base_bdev2" -n $raid_bdev_name $rpc_py bdev_raid_create $strip_size_create_arg -r $raid_level -b "$base_bdev1 $base_bdev2" -n $raid_bdev_name
$rpc_py bdev_malloc_create 32 512 -b $base_bdev2 $rpc_py bdev_malloc_create 32 512 -b $base_bdev2
waitforbdev $base_bdev2 waitforbdev $base_bdev2
if ! verify_raid_bdev_state $raid_bdev_name "online" $raid_level $strip_size; then if ! verify_raid_bdev_state $raid_bdev_name "online" $raid_level $strip_size; then
@ -215,9 +223,14 @@ function raid_state_function_test() {
fi fi
# Step4: delete one base bdev from the RAID bdev # Step4: delete one base bdev from the RAID bdev
# Expect state: OFFLINE
$rpc_py bdev_malloc_delete $base_bdev2 $rpc_py bdev_malloc_delete $base_bdev2
if ! verify_raid_bdev_state $raid_bdev_name "offline" $raid_level $strip_size; then local expected_state
if [ $raid_level != "raid1" ]; then
expected_state="offline"
else
expected_state="online"
fi
if ! verify_raid_bdev_state $raid_bdev_name $expected_state $raid_level $strip_size; then
return 1 return 1
fi fi
@ -286,6 +299,7 @@ raid_function_test raid0
raid_function_test concat raid_function_test concat
raid_state_function_test raid0 raid_state_function_test raid0
raid_state_function_test concat raid_state_function_test concat
raid_state_function_test raid1
raid0_resize_test raid0_resize_test
rm -f $tmp_file rm -f $tmp_file

View File

@ -55,6 +55,8 @@ function start_spdk_tgt() {
function setup_bdev_conf() { function setup_bdev_conf() {
"$rpc_py" <<- RPC "$rpc_py" <<- RPC
iobuf_set_options --small-pool-count 10000 --large-pool-count 1100
framework_start_init
bdev_split_create Malloc1 2 bdev_split_create Malloc1 2
bdev_split_create -s 4 Malloc2 8 bdev_split_create -s 4 Malloc2 8
bdev_malloc_create -b Malloc0 32 512 bdev_malloc_create -b Malloc0 32 512
@ -65,9 +67,12 @@ function setup_bdev_conf() {
bdev_malloc_create -b Malloc5 32 512 bdev_malloc_create -b Malloc5 32 512
bdev_malloc_create -b Malloc6 32 512 bdev_malloc_create -b Malloc6 32 512
bdev_malloc_create -b Malloc7 32 512 bdev_malloc_create -b Malloc7 32 512
bdev_malloc_create -b Malloc8 32 512
bdev_malloc_create -b Malloc9 32 512
bdev_passthru_create -p TestPT -b Malloc3 bdev_passthru_create -p TestPT -b Malloc3
bdev_raid_create -n raid0 -z 64 -r 0 -b "Malloc4 Malloc5" bdev_raid_create -n raid0 -z 64 -r 0 -b "Malloc4 Malloc5"
bdev_raid_create -n concat0 -z 64 -r concat -b "Malloc6 Malloc7" bdev_raid_create -n concat0 -z 64 -r concat -b "Malloc6 Malloc7"
bdev_raid_create -n raid1 -r 1 -b "Malloc8 Malloc9"
bdev_set_qos_limit --rw_mbytes_per_sec 100 Malloc3 bdev_set_qos_limit --rw_mbytes_per_sec 100 Malloc3
bdev_set_qos_limit --rw_ios_per_sec 20000 Malloc0 bdev_set_qos_limit --rw_ios_per_sec 20000 Malloc0
RPC RPC
@ -668,7 +673,7 @@ if [ -n "$crypto_device" ] && [ -n "$wcs_file" ]; then
exit 1 exit 1
fi fi
fi fi
if [[ $test_type == crypto_* ]]; then if [[ $test_type == bdev || $test_type == crypto_* ]]; then
wait_for_rpc="--wait-for-rpc" wait_for_rpc="--wait-for-rpc"
fi fi
start_spdk_tgt start_spdk_tgt
@ -721,7 +726,8 @@ esac
cat <<- CONF > "$conf_file" cat <<- CONF > "$conf_file"
{"subsystems":[ {"subsystems":[
$("$rpc_py" save_subsystem_config -n accel), $("$rpc_py" save_subsystem_config -n accel),
$("$rpc_py" save_subsystem_config -n bdev) $("$rpc_py" save_subsystem_config -n bdev),
$("$rpc_py" save_subsystem_config -n iobuf)
]} ]}
CONF CONF