Commit bc1bd85e authored by Artur Paszkiewicz's avatar Artur Paszkiewicz Committed by Jim Harris
Browse files

test/bdev: add raid1 tests



Change-Id: Ib7c8f8818be9da24e829a4d4470671cd39234543
Signed-off-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16160


Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Reviewed-by: default avatarJim Harris <jim.harris@gmail.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 8ffc55ae
Loading
Loading
Loading
Loading
+20 −6
Original line number Diff line number Diff line
@@ -180,7 +180,15 @@ function raid_state_function_test() {
	local base_bdev1="Non_Existed_Base_1"
	local base_bdev2="Non_Existed_Base_2"
	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 &
	raid_pid=$!
@@ -189,7 +197,7 @@ function raid_state_function_test() {

	# Step1: create a RAID bdev with no base bdevs
	# 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
		return 1
	fi
@@ -197,7 +205,7 @@ function raid_state_function_test() {

	# Step2: create one base bdev and add to the RAID bdev
	# 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
	waitforbdev $base_bdev1
	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
	# 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
	waitforbdev $base_bdev2
	if ! verify_raid_bdev_state $raid_bdev_name "online" $raid_level $strip_size; then
@@ -215,9 +223,14 @@ function raid_state_function_test() {
	fi

	# Step4: delete one base bdev from the RAID bdev
	# Expect state: OFFLINE
	$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
	fi

@@ -286,6 +299,7 @@ raid_function_test raid0
raid_function_test concat
raid_state_function_test raid0
raid_state_function_test concat
raid_state_function_test raid1
raid0_resize_test

rm -f $tmp_file
+8 −2
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ function start_spdk_tgt() {

function setup_bdev_conf() {
	"$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 -s 4 Malloc2 8
		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 Malloc6 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_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 raid1 -r 1 -b "Malloc8 Malloc9"
		bdev_set_qos_limit --rw_mbytes_per_sec 100 Malloc3
		bdev_set_qos_limit --rw_ios_per_sec 20000 Malloc0
	RPC
@@ -686,7 +691,7 @@ wait_for_rpc=""
if [ -n "$crypto_device" ]; then
	env_ctx="--env-context=--allow=$crypto_device,class=crypto"
fi
if [[ $test_type == crypto_* ]]; then
if [[ $test_type == bdev || $test_type == crypto_* ]]; then
	wait_for_rpc="--wait-for-rpc"
fi
start_spdk_tgt
@@ -739,7 +744,8 @@ esac
cat <<- CONF > "$conf_file"
	        {"subsystems":[
	        $("$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