2016-07-20 18:16:23 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
2018-03-22 19:43:32 +00:00
|
|
|
rootdir=$(readlink -f $testdir/../..)
|
2019-06-10 07:16:46 +00:00
|
|
|
source $rootdir/test/common/autotest_common.sh
|
|
|
|
source $testdir/nbd_common.sh
|
|
|
|
|
2022-10-14 21:24:32 +00:00
|
|
|
shopt -s nullglob extglob
|
|
|
|
|
2021-03-26 13:14:30 +00:00
|
|
|
rpc_py=rpc_cmd
|
2020-02-26 11:49:40 +00:00
|
|
|
conf_file="$testdir/bdev.json"
|
2022-08-29 10:16:42 +00:00
|
|
|
nonenclosed_conf_file="$testdir/nonenclosed.json"
|
|
|
|
nonarray_conf_file="$testdir/nonarray.json"
|
|
|
|
|
2020-01-29 16:07:09 +00:00
|
|
|
# Make sure the configuration is clean
|
2020-05-07 11:27:06 +00:00
|
|
|
: > "$conf_file"
|
2020-01-29 16:07:09 +00:00
|
|
|
|
2020-03-02 20:48:33 +00:00
|
|
|
function cleanup() {
|
2020-05-10 20:07:54 +00:00
|
|
|
rm -f "$SPDK_TEST_STORAGE/aiofile"
|
|
|
|
rm -f "$SPDK_TEST_STORAGE/spdk-pmem-pool"
|
2020-03-02 20:48:33 +00:00
|
|
|
rm -f "$conf_file"
|
|
|
|
|
2020-03-02 20:46:14 +00:00
|
|
|
if [[ $test_type == rbd ]]; then
|
|
|
|
rbd_cleanup
|
|
|
|
fi
|
2021-08-25 10:30:57 +00:00
|
|
|
|
2022-03-08 23:55:01 +00:00
|
|
|
if [[ $test_type == daos ]]; then
|
|
|
|
daos_cleanup
|
|
|
|
fi
|
|
|
|
|
2021-08-25 10:30:57 +00:00
|
|
|
if [[ "$test_type" = "gpt" ]]; then
|
|
|
|
"$rootdir/scripts/setup.sh" reset
|
|
|
|
if [[ -b $gpt_nvme ]]; then
|
|
|
|
wipefs --all "$gpt_nvme"
|
|
|
|
fi
|
|
|
|
fi
|
2020-03-02 20:48:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-29 16:07:09 +00:00
|
|
|
function start_spdk_tgt() {
|
2022-01-21 12:58:06 +00:00
|
|
|
"$SPDK_BIN_DIR/spdk_tgt" "$env_ctx" &
|
2020-01-29 16:07:09 +00:00
|
|
|
spdk_tgt_pid=$!
|
|
|
|
trap 'killprocess "$spdk_tgt_pid"; exit 1' SIGINT SIGTERM EXIT
|
|
|
|
waitforlisten "$spdk_tgt_pid"
|
|
|
|
}
|
2019-12-17 18:29:06 +00:00
|
|
|
|
|
|
|
function setup_bdev_conf() {
|
2020-05-07 11:27:06 +00:00
|
|
|
"$rpc_py" <<- RPC
|
2020-03-04 14:43:32 +00:00
|
|
|
bdev_split_create Malloc1 2
|
|
|
|
bdev_split_create -s 4 Malloc2 8
|
|
|
|
bdev_malloc_create -b Malloc0 32 512
|
|
|
|
bdev_malloc_create -b Malloc1 32 512
|
|
|
|
bdev_malloc_create -b Malloc2 32 512
|
|
|
|
bdev_malloc_create -b Malloc3 32 512
|
|
|
|
bdev_malloc_create -b Malloc4 32 512
|
|
|
|
bdev_malloc_create -b Malloc5 32 512
|
2022-02-01 06:46:20 +00:00
|
|
|
bdev_malloc_create -b Malloc6 32 512
|
|
|
|
bdev_malloc_create -b Malloc7 32 512
|
2020-03-04 14:43:32 +00:00
|
|
|
bdev_passthru_create -p TestPT -b Malloc3
|
|
|
|
bdev_raid_create -n raid0 -z 64 -r 0 -b "Malloc4 Malloc5"
|
2022-02-01 06:46:20 +00:00
|
|
|
bdev_raid_create -n concat0 -z 64 -r concat -b "Malloc6 Malloc7"
|
2021-03-26 13:14:30 +00:00
|
|
|
bdev_set_qos_limit --rw_mbytes_per_sec 100 Malloc3
|
|
|
|
bdev_set_qos_limit --rw_ios_per_sec 20000 Malloc0
|
2020-03-04 14:43:32 +00:00
|
|
|
RPC
|
|
|
|
if [[ $(uname -s) != "FreeBSD" ]]; then
|
2020-05-10 20:07:54 +00:00
|
|
|
dd if=/dev/zero of="$SPDK_TEST_STORAGE/aiofile" bs=2048 count=5000
|
|
|
|
"$rpc_py" bdev_aio_create "$SPDK_TEST_STORAGE/aiofile" AIO0 2048
|
2020-03-04 14:43:32 +00:00
|
|
|
fi
|
2019-12-17 18:29:06 +00:00
|
|
|
}
|
2016-07-20 18:16:23 +00:00
|
|
|
|
2019-12-17 19:45:55 +00:00
|
|
|
function setup_nvme_conf() {
|
2021-03-26 13:14:30 +00:00
|
|
|
local json
|
|
|
|
mapfile -t json < <("$rootdir/scripts/gen_nvme.sh")
|
|
|
|
"$rpc_py" load_subsystem_config -j "'${json[*]}'"
|
2019-12-17 19:45:55 +00:00
|
|
|
}
|
|
|
|
|
2020-03-16 13:43:37 +00:00
|
|
|
function setup_gpt_conf() {
|
2021-08-25 10:30:57 +00:00
|
|
|
$rootdir/scripts/setup.sh reset
|
2021-08-13 09:39:27 +00:00
|
|
|
get_zoned_devs
|
2021-08-25 10:30:57 +00:00
|
|
|
# Get nvme devices by following drivers' links towards nvme class
|
|
|
|
local nvme_devs=(/sys/bus/pci/drivers/nvme/*/nvme/nvme*/nvme*n*) nvme_dev
|
|
|
|
gpt_nvme=""
|
|
|
|
# Pick first device which doesn't have any valid partition table
|
|
|
|
for nvme_dev in "${nvme_devs[@]}"; do
|
2021-08-13 09:39:27 +00:00
|
|
|
[[ -z ${zoned_devs["${nvme_dev##*/}"]} ]] || continue
|
2021-08-25 10:30:57 +00:00
|
|
|
dev=/dev/${nvme_dev##*/}
|
|
|
|
if ! pt=$(parted "$dev" -ms print 2>&1); then
|
|
|
|
[[ $pt == *"$dev: unrecognised disk label"* ]] || continue
|
|
|
|
gpt_nvme=$dev
|
|
|
|
break
|
2020-03-16 12:39:35 +00:00
|
|
|
fi
|
2021-08-25 10:30:57 +00:00
|
|
|
done
|
|
|
|
if [[ -n $gpt_nvme ]]; then
|
|
|
|
# Create gpt partition table
|
2022-01-24 15:36:34 +00:00
|
|
|
parted -s "$gpt_nvme" mklabel gpt mkpart SPDK_TEST_first '0%' '50%' mkpart SPDK_TEST_second '50%' '100%'
|
2021-08-25 10:30:57 +00:00
|
|
|
# change the GUID to SPDK GUID value
|
2021-08-26 07:28:37 +00:00
|
|
|
SPDK_GPT_GUID=$(get_spdk_gpt)
|
2021-08-25 10:30:57 +00:00
|
|
|
sgdisk -t "1:$SPDK_GPT_GUID" "$gpt_nvme"
|
|
|
|
sgdisk -t "2:$SPDK_GPT_GUID" "$gpt_nvme"
|
|
|
|
"$rootdir/scripts/setup.sh"
|
|
|
|
"$rpc_py" bdev_get_bdevs
|
|
|
|
setup_nvme_conf
|
2020-05-07 11:27:06 +00:00
|
|
|
else
|
2021-08-25 10:30:57 +00:00
|
|
|
printf 'Did not find any nvme block devices to work with, aborting the test\n' >&2
|
|
|
|
"$rootdir/scripts/setup.sh"
|
|
|
|
return 1
|
2019-12-17 19:45:55 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-02-26 11:35:23 +00:00
|
|
|
function setup_crypto_aesni_conf() {
|
|
|
|
# Malloc0 and Malloc1 use AESNI
|
2020-05-07 11:27:06 +00:00
|
|
|
"$rpc_py" <<- RPC
|
2020-02-26 11:35:23 +00:00
|
|
|
bdev_malloc_create -b Malloc0 16 512
|
|
|
|
bdev_malloc_create -b Malloc1 16 512
|
2022-03-11 12:15:57 +00:00
|
|
|
bdev_crypto_create Malloc0 crypto_ram crypto_aesni_mb 01234567891234560123456789123456
|
|
|
|
bdev_crypto_create Malloc1 crypto_ram2 crypto_aesni_mb 90123456789123459012345678912345
|
2020-02-26 11:35:23 +00:00
|
|
|
RPC
|
|
|
|
}
|
|
|
|
|
|
|
|
function setup_crypto_qat_conf() {
|
|
|
|
# Malloc0 will use QAT AES_CBC
|
|
|
|
# Malloc1 will use QAT AES_XTS
|
2020-05-07 11:27:06 +00:00
|
|
|
"$rpc_py" <<- RPC
|
2020-02-26 11:35:23 +00:00
|
|
|
bdev_malloc_create -b Malloc0 16 512
|
|
|
|
bdev_malloc_create -b Malloc1 16 512
|
2022-03-11 12:15:57 +00:00
|
|
|
bdev_crypto_create Malloc0 crypto_ram crypto_qat 01234567891234560123456789123456
|
|
|
|
bdev_crypto_create -c AES_XTS -k2 01234567891234560123456789123456 Malloc1 crypto_ram3 crypto_qat 01234567891234560123456789123456
|
2021-03-26 13:14:30 +00:00
|
|
|
bdev_get_bdevs -b Malloc1
|
2020-02-26 11:35:23 +00:00
|
|
|
RPC
|
2019-12-17 19:45:55 +00:00
|
|
|
}
|
|
|
|
|
2022-01-21 12:58:06 +00:00
|
|
|
function setup_crypto_mlx5_conf() {
|
|
|
|
local key=$1
|
|
|
|
local block_key
|
|
|
|
local tweak_key
|
|
|
|
if [ ${#key} == 96 ]; then
|
|
|
|
# 96 bytes is 64 + 32 - AES_XTS_256 in hexlified format
|
|
|
|
# Copy first 64 chars into the 'key'. This gives 32 in the
|
|
|
|
# binary or 256 bit.
|
|
|
|
block_key=${key:0:64}
|
|
|
|
# Copy the the rest of the key and pass it as the 'key2'.
|
|
|
|
tweak_key=${key:64:32}
|
|
|
|
elif [ ${#key} == 160 ]; then
|
|
|
|
# 160 bytes is 128 + 32 - AES_XTS_512 in hexlified format
|
|
|
|
# Copy first 128 chars into the 'key'. This gives 64 in the
|
|
|
|
# binary or 512 bit.
|
|
|
|
block_key=${key:0:128}
|
|
|
|
# Copy the the rest of the key and pass it as the 'key2'.
|
|
|
|
tweak_key=${key:128:32}
|
|
|
|
else
|
|
|
|
echo "ERROR: Invalid DEK size for MLX5 crypto setup: ${#key}"
|
|
|
|
echo "ERROR: Supported key sizes for MLX5: 96 bytes (AES_XTS_256) and 160 bytes (AES_XTS_512)."
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Malloc0 will use MLX5 AES_XTS
|
|
|
|
"$rpc_py" <<- RPC
|
|
|
|
bdev_malloc_create -b Malloc0 16 512
|
|
|
|
bdev_crypto_create -c AES_XTS -k2 $tweak_key Malloc0 crypto_ram4 mlx5_pci $block_key
|
|
|
|
bdev_get_bdevs -b Malloc0
|
|
|
|
RPC
|
|
|
|
}
|
|
|
|
|
2019-12-17 19:45:55 +00:00
|
|
|
function setup_pmem_conf() {
|
|
|
|
if hash pmempool; then
|
2020-05-10 20:07:54 +00:00
|
|
|
rm -f "$SPDK_TEST_STORAGE/spdk-pmem-pool"
|
|
|
|
pmempool create blk --size=32M 512 "$SPDK_TEST_STORAGE/spdk-pmem-pool"
|
|
|
|
"$rpc_py" bdev_pmem_create -n Pmem0 "$SPDK_TEST_STORAGE/spdk-pmem-pool"
|
2019-12-17 20:31:51 +00:00
|
|
|
else
|
|
|
|
return 1
|
2019-12-17 19:45:55 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function setup_rbd_conf() {
|
2019-12-17 20:31:51 +00:00
|
|
|
timing_enter rbd_setup
|
|
|
|
rbd_setup 127.0.0.1
|
|
|
|
timing_exit rbd_setup
|
2019-12-17 19:45:55 +00:00
|
|
|
|
2020-02-26 11:40:09 +00:00
|
|
|
"$rpc_py" bdev_rbd_create -b Ceph0 rbd foo 512
|
2019-12-17 19:45:55 +00:00
|
|
|
}
|
|
|
|
|
2022-03-08 23:55:01 +00:00
|
|
|
function setup_daos_conf() {
|
|
|
|
local pool=testpool
|
|
|
|
local cont=testcont
|
|
|
|
|
|
|
|
timing_enter daos_setup
|
|
|
|
daos_setup $pool $cont
|
|
|
|
timing_exit daos_setup
|
|
|
|
|
|
|
|
"$rpc_py" bdev_daos_create Daos0 $pool $cont 16 4096
|
|
|
|
}
|
|
|
|
|
2022-09-16 12:48:59 +00:00
|
|
|
function setup_raid5f_conf() {
|
|
|
|
"$rpc_py" <<- RPC
|
|
|
|
bdev_malloc_create -b Malloc0 32 512
|
|
|
|
bdev_malloc_create -b Malloc1 32 512
|
|
|
|
bdev_malloc_create -b Malloc2 32 512
|
|
|
|
bdev_raid_create -n raid5f -z 2 -r 5f -b "Malloc0 Malloc1 Malloc2"
|
|
|
|
RPC
|
|
|
|
}
|
|
|
|
|
2019-12-10 17:49:31 +00:00
|
|
|
function bdev_bounds() {
|
2022-01-21 12:58:06 +00:00
|
|
|
$testdir/bdevio/bdevio -w -s $PRE_RESERVED_MEM --json "$conf_file" "$env_ctx" &
|
2019-12-10 17:49:31 +00:00
|
|
|
bdevio_pid=$!
|
2021-08-25 10:30:57 +00:00
|
|
|
trap 'cleanup; killprocess $bdevio_pid; exit 1' SIGINT SIGTERM EXIT
|
2019-12-10 17:49:31 +00:00
|
|
|
echo "Process bdevio pid: $bdevio_pid"
|
|
|
|
waitforlisten $bdevio_pid
|
|
|
|
$testdir/bdevio/tests.py perform_tests
|
|
|
|
killprocess $bdevio_pid
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
}
|
|
|
|
|
2017-12-14 01:44:56 +00:00
|
|
|
function nbd_function_test() {
|
2022-10-14 21:24:32 +00:00
|
|
|
[[ $(uname -s) == Linux ]] || return 0
|
2017-12-14 01:44:56 +00:00
|
|
|
|
2022-10-14 21:24:32 +00:00
|
|
|
local rpc_server=/var/tmp/spdk-nbd.sock
|
|
|
|
local conf=$1
|
|
|
|
local bdev_all=($2)
|
|
|
|
local bdev_num=${#bdev_all[@]}
|
2017-12-14 01:44:56 +00:00
|
|
|
|
2022-10-14 21:24:32 +00:00
|
|
|
# FIXME: Centos7 in the CI is not shipped with a kernel supporting BLK_DEV_NBD
|
|
|
|
# so don't fail here for now.
|
|
|
|
[[ -e /sys/module/nbd ]] || modprobe -q nbd nbds_max=$bdev_num || return 0
|
2017-12-14 01:44:56 +00:00
|
|
|
|
2022-10-14 21:24:32 +00:00
|
|
|
local nbd_all=(/dev/nbd+([0-9]))
|
|
|
|
bdev_num=$((${#nbd_all[@]} < bdev_num ? ${#nbd_all[@]} : bdev_num))
|
2017-12-14 01:44:56 +00:00
|
|
|
|
2022-10-14 21:24:32 +00:00
|
|
|
local nbd_list=(${nbd_all[@]::bdev_num})
|
|
|
|
local bdev_list=(${bdev_all[@]::bdev_num})
|
|
|
|
|
|
|
|
$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 --json "$conf" "$env_ctx" &
|
|
|
|
nbd_pid=$!
|
|
|
|
trap 'cleanup; killprocess $nbd_pid' SIGINT SIGTERM EXIT
|
|
|
|
waitforlisten $nbd_pid $rpc_server
|
2017-12-14 01:44:56 +00:00
|
|
|
|
2022-10-14 21:24:32 +00:00
|
|
|
nbd_rpc_start_stop_verify $rpc_server "${bdev_list[*]}"
|
|
|
|
nbd_rpc_data_verify $rpc_server "${bdev_list[*]}" "${nbd_list[*]}"
|
|
|
|
nbd_with_lvol_verify $rpc_server "${nbd_list[*]}"
|
|
|
|
|
|
|
|
killprocess $nbd_pid
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
2017-12-14 01:44:56 +00:00
|
|
|
}
|
2016-07-20 18:16:23 +00:00
|
|
|
|
2019-12-05 17:16:24 +00:00
|
|
|
function fio_test_suite() {
|
2022-01-21 12:58:06 +00:00
|
|
|
local env_context
|
|
|
|
|
|
|
|
# Make sure that state files and anything else produced by fio test will
|
|
|
|
# stay at the testdir.
|
|
|
|
pushd $testdir
|
|
|
|
trap 'rm -f ./*.state; popd; exit 1' SIGINT SIGTERM EXIT
|
|
|
|
|
2019-12-05 17:16:24 +00:00
|
|
|
# Generate the fio config file given the list of all unclaimed bdevs
|
2022-01-21 12:58:06 +00:00
|
|
|
env_context=$(echo "$env_ctx" | sed 's/--env-context=//')
|
|
|
|
fio_config_gen $testdir/bdev.fio verify AIO "$env_context"
|
2019-12-05 17:16:24 +00:00
|
|
|
for b in $(echo $bdevs | jq -r '.name'); do
|
2020-03-16 14:26:05 +00:00
|
|
|
echo "[job_$b]" >> $testdir/bdev.fio
|
|
|
|
echo "filename=$b" >> $testdir/bdev.fio
|
2019-12-05 17:16:24 +00:00
|
|
|
done
|
|
|
|
|
2022-06-13 09:36:46 +00:00
|
|
|
local fio_params="--ioengine=spdk_bdev --iodepth=8 --bs=4k --runtime=10 $testdir/bdev.fio \
|
|
|
|
--verify_state_save=0 --spdk_json_conf=$conf_file"
|
2020-01-16 21:04:10 +00:00
|
|
|
|
2022-06-13 09:36:46 +00:00
|
|
|
run_test "bdev_fio_rw_verify" fio_bdev $fio_params --spdk_mem=$PRE_RESERVED_MEM --aux-path=$output_dir
|
2019-12-05 17:16:24 +00:00
|
|
|
rm -f ./*.state
|
|
|
|
rm -f $testdir/bdev.fio
|
|
|
|
|
|
|
|
# Generate the fio config file given the list of all unclaimed bdevs that support unmap
|
2022-01-21 12:58:06 +00:00
|
|
|
fio_config_gen $testdir/bdev.fio trim "" "$env_context"
|
2019-12-18 15:27:53 +00:00
|
|
|
if [ "$(echo $bdevs | jq -r 'select(.supported_io_types.unmap == true) | .name')" != "" ]; then
|
|
|
|
for b in $(echo $bdevs | jq -r 'select(.supported_io_types.unmap == true) | .name'); do
|
2020-03-16 14:26:05 +00:00
|
|
|
echo "[job_$b]" >> $testdir/bdev.fio
|
|
|
|
echo "filename=$b" >> $testdir/bdev.fio
|
2019-12-18 15:27:53 +00:00
|
|
|
done
|
|
|
|
else
|
|
|
|
rm -f $testdir/bdev.fio
|
2022-01-21 12:58:06 +00:00
|
|
|
popd
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
2019-12-18 15:27:53 +00:00
|
|
|
return 0
|
|
|
|
fi
|
2019-12-05 17:16:24 +00:00
|
|
|
|
2022-06-13 09:36:46 +00:00
|
|
|
run_test "bdev_fio_trim" fio_bdev $fio_params --verify_state_save=0 --aux-path=$output_dir
|
2019-12-05 17:16:24 +00:00
|
|
|
rm -f ./*.state
|
|
|
|
rm -f $testdir/bdev.fio
|
2022-01-21 12:58:06 +00:00
|
|
|
popd
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
2019-12-05 17:16:24 +00:00
|
|
|
}
|
|
|
|
|
2019-03-12 22:49:36 +00:00
|
|
|
function get_io_result() {
|
|
|
|
local limit_type=$1
|
2019-11-26 19:45:09 +00:00
|
|
|
local qos_dev=$2
|
2019-12-03 06:53:35 +00:00
|
|
|
local iostat_result
|
|
|
|
iostat_result=$($rootdir/scripts/iostat.py -d -i 1 -t $QOS_RUN_TIME | grep $qos_dev | tail -1)
|
2019-03-12 22:49:36 +00:00
|
|
|
if [ $limit_type = IOPS ]; then
|
2019-12-03 06:53:35 +00:00
|
|
|
iostat_result=$(awk '{print $2}' <<< $iostat_result)
|
|
|
|
elif [ $limit_type = BANDWIDTH ]; then
|
|
|
|
iostat_result=$(awk '{print $6}' <<< $iostat_result)
|
2019-03-12 22:49:36 +00:00
|
|
|
fi
|
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
echo ${iostat_result/.*/}
|
2019-03-12 22:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function run_qos_test() {
|
|
|
|
local qos_limit=$1
|
|
|
|
local qos_result=0
|
|
|
|
|
2019-11-26 19:45:09 +00:00
|
|
|
qos_result=$(get_io_result $2 $3)
|
2019-03-12 22:49:36 +00:00
|
|
|
if [ $2 = BANDWIDTH ]; then
|
2020-05-07 11:27:06 +00:00
|
|
|
qos_limit=$((qos_limit * 1024))
|
2019-03-12 22:49:36 +00:00
|
|
|
fi
|
2020-05-07 11:27:06 +00:00
|
|
|
lower_limit=$((qos_limit * 9 / 10))
|
|
|
|
upper_limit=$((qos_limit * 11 / 10))
|
2019-03-12 22:49:36 +00:00
|
|
|
|
2021-11-25 01:40:59 +00:00
|
|
|
# QoS realization is related with bytes transferred. It currently has some variation.
|
2019-03-12 22:49:36 +00:00
|
|
|
if [ $qos_result -lt $lower_limit ] || [ $qos_result -gt $upper_limit ]; then
|
|
|
|
echo "Failed to limit the io read rate of NULL bdev by qos"
|
2020-01-17 11:11:57 +00:00
|
|
|
$rpc_py bdev_malloc_delete $QOS_DEV_1
|
2019-11-26 19:45:09 +00:00
|
|
|
$rpc_py bdev_null_delete $QOS_DEV_2
|
2019-03-12 22:49:36 +00:00
|
|
|
killprocess $QOS_PID
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function qos_function_test() {
|
|
|
|
local qos_lower_iops_limit=1000
|
2019-11-26 19:45:09 +00:00
|
|
|
local qos_lower_bw_limit=2
|
2019-03-12 22:49:36 +00:00
|
|
|
local io_result=0
|
2019-11-26 19:45:09 +00:00
|
|
|
local iops_limit=0
|
|
|
|
local bw_limit=0
|
2019-03-12 22:49:36 +00:00
|
|
|
|
2019-11-26 19:45:09 +00:00
|
|
|
io_result=$(get_io_result IOPS $QOS_DEV_1)
|
2019-03-12 22:49:36 +00:00
|
|
|
# Set the IOPS limit as one quarter of the measured performance without QoS
|
2020-05-07 11:27:06 +00:00
|
|
|
iops_limit=$(((io_result / 4) / qos_lower_iops_limit * qos_lower_iops_limit))
|
2019-03-12 22:49:36 +00:00
|
|
|
if [ $iops_limit -gt $qos_lower_iops_limit ]; then
|
|
|
|
|
2019-11-26 19:45:09 +00:00
|
|
|
# Run bdevperf with IOPS rate limit on bdev 1
|
|
|
|
$rpc_py bdev_set_qos_limit --rw_ios_per_sec $iops_limit $QOS_DEV_1
|
2019-12-19 23:03:30 +00:00
|
|
|
run_test "bdev_qos_iops" run_qos_test $iops_limit IOPS $QOS_DEV_1
|
2019-03-12 22:49:36 +00:00
|
|
|
|
2019-11-26 19:45:09 +00:00
|
|
|
# Run bdevperf with bandwidth rate limit on bdev 2
|
|
|
|
# Set the bandwidth limit as 1/10 of the measure performance without QoS
|
|
|
|
bw_limit=$(get_io_result BANDWIDTH $QOS_DEV_2)
|
2020-05-07 11:27:06 +00:00
|
|
|
bw_limit=$((bw_limit / 1024 / 10))
|
2019-11-26 19:45:09 +00:00
|
|
|
if [ $bw_limit -lt $qos_lower_bw_limit ]; then
|
|
|
|
bw_limit=$qos_lower_bw_limit
|
|
|
|
fi
|
|
|
|
$rpc_py bdev_set_qos_limit --rw_mbytes_per_sec $bw_limit $QOS_DEV_2
|
2019-12-19 23:03:30 +00:00
|
|
|
run_test "bdev_qos_bw" run_qos_test $bw_limit BANDWIDTH $QOS_DEV_2
|
2019-03-12 22:49:36 +00:00
|
|
|
|
2019-11-26 19:45:09 +00:00
|
|
|
# Run bdevperf with additional read only bandwidth rate limit on bdev 1
|
|
|
|
$rpc_py bdev_set_qos_limit --r_mbytes_per_sec $qos_lower_bw_limit $QOS_DEV_1
|
2019-12-19 23:03:30 +00:00
|
|
|
run_test "bdev_qos_ro_bw" run_qos_test $qos_lower_bw_limit BANDWIDTH $QOS_DEV_1
|
2019-03-12 22:49:36 +00:00
|
|
|
else
|
|
|
|
echo "Actual IOPS without limiting is too low - exit testing"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-12-10 17:55:42 +00:00
|
|
|
function qos_test_suite() {
|
|
|
|
# Run bdevperf with QoS disabled first
|
2022-01-21 12:58:06 +00:00
|
|
|
"$testdir/bdevperf/bdevperf" -z -m 0x2 -q 256 -o 4096 -w randread -t 60 "$env_ctx" &
|
2019-12-10 17:55:42 +00:00
|
|
|
QOS_PID=$!
|
|
|
|
echo "Process qos testing pid: $QOS_PID"
|
2021-08-25 10:30:57 +00:00
|
|
|
trap 'cleanup; killprocess $QOS_PID; exit 1' SIGINT SIGTERM EXIT
|
2019-12-10 17:55:42 +00:00
|
|
|
waitforlisten $QOS_PID
|
|
|
|
|
2020-01-17 11:11:57 +00:00
|
|
|
$rpc_py bdev_malloc_create -b $QOS_DEV_1 128 512
|
2019-12-10 17:55:42 +00:00
|
|
|
waitforbdev $QOS_DEV_1
|
|
|
|
$rpc_py bdev_null_create $QOS_DEV_2 128 512
|
|
|
|
waitforbdev $QOS_DEV_2
|
|
|
|
|
|
|
|
$rootdir/test/bdev/bdevperf/bdevperf.py perform_tests &
|
|
|
|
qos_function_test
|
|
|
|
|
2020-01-17 11:11:57 +00:00
|
|
|
$rpc_py bdev_malloc_delete $QOS_DEV_1
|
2019-12-10 17:55:42 +00:00
|
|
|
$rpc_py bdev_null_delete $QOS_DEV_2
|
|
|
|
killprocess $QOS_PID
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
}
|
|
|
|
|
2022-06-29 11:24:51 +00:00
|
|
|
function error_test_suite() {
|
|
|
|
DEV_1="Dev_1"
|
|
|
|
DEV_2="Dev_2"
|
|
|
|
ERR_DEV="EE_Dev_1"
|
|
|
|
|
|
|
|
# Run bdevperf with 1 normal bdev and 1 error bdev, also continue on error
|
|
|
|
"$testdir/bdevperf/bdevperf" -z -m 0x2 -q 16 -o 4096 -w randread -t 5 -f "$env_ctx" &
|
|
|
|
ERR_PID=$!
|
|
|
|
echo "Process error testing pid: $ERR_PID"
|
|
|
|
waitforlisten $ERR_PID
|
|
|
|
|
|
|
|
$rpc_py bdev_malloc_create -b $DEV_1 128 512
|
|
|
|
waitforbdev $DEV_1
|
|
|
|
$rpc_py bdev_error_create $DEV_1
|
|
|
|
$rpc_py bdev_malloc_create -b $DEV_2 128 512
|
|
|
|
waitforbdev $DEV_2
|
|
|
|
$rpc_py bdev_error_inject_error $ERR_DEV 'all' 'failure' -n 5
|
|
|
|
|
|
|
|
$rootdir/test/bdev/bdevperf/bdevperf.py -t 1 perform_tests &
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# Bdevperf is expected to be there as the continue on error is set
|
|
|
|
if kill -0 $ERR_PID; then
|
|
|
|
echo "Process is existed as continue on error is set. Pid: $ERR_PID"
|
|
|
|
else
|
|
|
|
echo "Process exited unexpectedly. Pid: $ERR_PID"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Delete the error devices
|
|
|
|
$rpc_py bdev_error_delete $ERR_DEV
|
|
|
|
$rpc_py bdev_malloc_delete $DEV_1
|
|
|
|
sleep 5
|
|
|
|
# Expected to exit normally
|
|
|
|
killprocess $ERR_PID
|
|
|
|
|
|
|
|
# Run bdevperf with 1 normal bdev and 1 error bdev, and exit on error
|
|
|
|
"$testdir/bdevperf/bdevperf" -z -m 0x2 -q 16 -o 4096 -w randread -t 5 "$env_ctx" &
|
|
|
|
ERR_PID=$!
|
|
|
|
echo "Process error testing pid: $ERR_PID"
|
|
|
|
waitforlisten $ERR_PID
|
|
|
|
|
|
|
|
$rpc_py bdev_malloc_create -b $DEV_1 128 512
|
|
|
|
waitforbdev $DEV_1
|
|
|
|
$rpc_py bdev_error_create $DEV_1
|
|
|
|
$rpc_py bdev_malloc_create -b $DEV_2 128 512
|
|
|
|
waitforbdev $DEV_2
|
|
|
|
$rpc_py bdev_error_inject_error $ERR_DEV 'all' 'failure' -n 5
|
|
|
|
|
|
|
|
$rootdir/test/bdev/bdevperf/bdevperf.py -t 1 perform_tests &
|
2022-07-28 01:44:26 +00:00
|
|
|
NOT wait $ERR_PID
|
2022-06-29 11:24:51 +00:00
|
|
|
}
|
|
|
|
|
2022-06-11 07:05:07 +00:00
|
|
|
function qd_sampling_function_test() {
|
|
|
|
local bdev_name=$1
|
|
|
|
local sampling_period=10
|
|
|
|
local iostats
|
|
|
|
|
|
|
|
$rpc_py bdev_set_qd_sampling_period $bdev_name $sampling_period
|
|
|
|
|
|
|
|
iostats=$($rpc_py bdev_get_iostat -b $bdev_name)
|
|
|
|
|
|
|
|
qd_sampling_period=$(jq -r '.bdevs[0].queue_depth_polling_period' <<< "$iostats")
|
|
|
|
|
|
|
|
if [ $qd_sampling_period == null ] || [ $qd_sampling_period -ne $sampling_period ]; then
|
|
|
|
echo "Qeueue depth polling period is not right"
|
|
|
|
$rpc_py bdev_malloc_delete $QD_DEV
|
|
|
|
killprocess $QD_PID
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function qd_sampling_test_suite() {
|
|
|
|
QD_DEV="Malloc_QD"
|
|
|
|
|
|
|
|
"$testdir/bdevperf/bdevperf" -z -m 0x3 -q 256 -o 4096 -w randread -t 5 -C "$env_ctx" &
|
|
|
|
QD_PID=$!
|
|
|
|
echo "Process bdev QD sampling period testing pid: $QD_PID"
|
|
|
|
trap 'cleanup; killprocess $QD_PID; exit 1' SIGINT SIGTERM EXIT
|
|
|
|
waitforlisten $QD_PID
|
|
|
|
|
|
|
|
$rpc_py bdev_malloc_create -b $QD_DEV 128 512
|
|
|
|
waitforbdev $QD_DEV
|
|
|
|
|
|
|
|
$rootdir/test/bdev/bdevperf/bdevperf.py perform_tests &
|
|
|
|
sleep 2
|
|
|
|
qd_sampling_function_test $QD_DEV
|
|
|
|
|
|
|
|
$rpc_py bdev_malloc_delete $QD_DEV
|
|
|
|
killprocess $QD_PID
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
}
|
|
|
|
|
2019-12-05 16:51:08 +00:00
|
|
|
# Inital bdev creation and configuration
|
|
|
|
#-----------------------------------------------------
|
2020-01-17 11:11:57 +00:00
|
|
|
QOS_DEV_1="Malloc_0"
|
2019-12-05 16:51:08 +00:00
|
|
|
QOS_DEV_2="Null_1"
|
|
|
|
QOS_RUN_TIME=5
|
|
|
|
|
|
|
|
if [ $(uname -s) = Linux ]; then
|
|
|
|
# Test dynamic memory management. All hugepages will be reserved at runtime
|
|
|
|
PRE_RESERVED_MEM=0
|
|
|
|
else
|
|
|
|
# Dynamic memory management is not supported on BSD
|
|
|
|
PRE_RESERVED_MEM=2048
|
|
|
|
fi
|
|
|
|
|
2020-02-26 11:18:39 +00:00
|
|
|
test_type=${1:-bdev}
|
2022-01-21 12:58:06 +00:00
|
|
|
crypto_device=$2
|
|
|
|
wcs_file=$3
|
|
|
|
dek=$4
|
|
|
|
env_ctx=""
|
|
|
|
if [ -n "$crypto_device" ] && [ -n "$wcs_file" ]; then
|
|
|
|
# We need full path here since fio perf test does 'pushd' to the test dir
|
|
|
|
# and crypto login of fio plugin test can fail.
|
|
|
|
wcs_file=$(readlink -f $wcs_file)
|
|
|
|
if [ -f $wcs_file ]; then
|
|
|
|
env_ctx="--env-context=--allow=$crypto_device,class=crypto,wcs_file=$wcs_file"
|
|
|
|
else
|
|
|
|
echo "ERROR: Credentials file $3 is not found!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2020-02-26 11:49:40 +00:00
|
|
|
start_spdk_tgt
|
2020-02-26 11:18:39 +00:00
|
|
|
case "$test_type" in
|
2020-05-07 11:27:06 +00:00
|
|
|
bdev)
|
|
|
|
setup_bdev_conf
|
|
|
|
;;
|
|
|
|
nvme)
|
|
|
|
setup_nvme_conf
|
|
|
|
;;
|
|
|
|
gpt)
|
|
|
|
setup_gpt_conf
|
|
|
|
;;
|
|
|
|
crypto_aesni)
|
|
|
|
setup_crypto_aesni_conf
|
|
|
|
;;
|
|
|
|
crypto_qat)
|
|
|
|
setup_crypto_qat_conf
|
|
|
|
;;
|
2022-01-21 12:58:06 +00:00
|
|
|
crypto_mlx5)
|
|
|
|
setup_crypto_mlx5_conf $dek
|
|
|
|
;;
|
2020-05-07 11:27:06 +00:00
|
|
|
pmem)
|
|
|
|
setup_pmem_conf
|
|
|
|
;;
|
|
|
|
rbd)
|
|
|
|
setup_rbd_conf
|
|
|
|
;;
|
2022-03-08 23:55:01 +00:00
|
|
|
daos)
|
|
|
|
setup_daos_conf
|
|
|
|
;;
|
2022-09-16 12:48:59 +00:00
|
|
|
raid5f)
|
|
|
|
setup_raid5f_conf
|
|
|
|
;;
|
2020-05-07 11:27:06 +00:00
|
|
|
*)
|
2019-12-17 20:31:51 +00:00
|
|
|
echo "invalid test name"
|
|
|
|
exit 1
|
|
|
|
;;
|
2020-02-26 11:18:39 +00:00
|
|
|
esac
|
2019-12-05 16:51:08 +00:00
|
|
|
|
2020-12-08 11:13:05 +00:00
|
|
|
"$rpc_py" bdev_wait_for_examine
|
|
|
|
|
2020-02-26 11:49:40 +00:00
|
|
|
# Generate json config and use it throughout all the tests
|
2020-05-07 11:27:06 +00:00
|
|
|
cat <<- CONF > "$conf_file"
|
|
|
|
{"subsystems":[
|
|
|
|
$("$rpc_py" save_subsystem_config -n bdev)
|
|
|
|
]}
|
2020-01-29 16:07:09 +00:00
|
|
|
CONF
|
|
|
|
|
|
|
|
bdevs=$("$rpc_py" bdev_get_bdevs | jq -r '.[] | select(.claimed == false)')
|
2019-12-05 16:51:08 +00:00
|
|
|
bdevs_name=$(echo $bdevs | jq -r '.name')
|
2019-12-17 20:59:42 +00:00
|
|
|
bdev_list=($bdevs_name)
|
|
|
|
hello_world_bdev=${bdev_list[0]}
|
2020-01-29 16:07:09 +00:00
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
killprocess "$spdk_tgt_pid"
|
2019-12-05 16:51:08 +00:00
|
|
|
# End bdev configuration
|
|
|
|
#-----------------------------------------------------
|
|
|
|
|
2021-08-25 10:30:57 +00:00
|
|
|
trap "cleanup" SIGINT SIGTERM EXIT
|
|
|
|
|
2022-01-21 12:58:06 +00:00
|
|
|
run_test "bdev_hello_world" $SPDK_EXAMPLE_DIR/hello_bdev --json "$conf_file" -b "$hello_world_bdev" "$env_ctx"
|
|
|
|
run_test "bdev_bounds" bdev_bounds "$env_ctx"
|
|
|
|
run_test "bdev_nbd" nbd_function_test $conf_file "$bdevs_name" "$env_ctx"
|
2020-03-02 19:55:44 +00:00
|
|
|
if [[ $CONFIG_FIO_PLUGIN == y ]]; then
|
2020-05-07 11:27:06 +00:00
|
|
|
if [ "$test_type" = "nvme" ] || [ "$test_type" = "gpt" ]; then
|
|
|
|
# TODO: once we get real multi-ns drives, re-enable this test for NVMe.
|
|
|
|
echo "skipping fio tests on NVMe due to multi-ns failures."
|
|
|
|
else
|
2022-01-21 12:58:06 +00:00
|
|
|
run_test "bdev_fio" fio_test_suite "$env_ctx"
|
2020-05-07 11:27:06 +00:00
|
|
|
fi
|
2019-05-30 08:08:19 +00:00
|
|
|
else
|
|
|
|
echo "FIO not available"
|
|
|
|
exit 1
|
2017-07-14 23:31:43 +00:00
|
|
|
fi
|
|
|
|
|
2021-08-25 10:30:57 +00:00
|
|
|
trap "cleanup" SIGINT SIGTERM EXIT
|
|
|
|
|
2022-01-21 12:58:06 +00:00
|
|
|
run_test "bdev_verify" $testdir/bdevperf/bdevperf --json "$conf_file" -q 128 -o 4096 -w verify -t 5 -C -m 0x3 "$env_ctx"
|
|
|
|
run_test "bdev_write_zeroes" $testdir/bdevperf/bdevperf --json "$conf_file" -q 128 -o 4096 -w write_zeroes -t 1 "$env_ctx"
|
2019-12-17 20:31:51 +00:00
|
|
|
|
2022-08-29 10:16:42 +00:00
|
|
|
# test json config not enclosed with {}
|
|
|
|
run_test "bdev_json_nonenclosed" $testdir/bdevperf/bdevperf --json "$nonenclosed_conf_file" -q 128 -o 4096 -w write_zeroes -t 1 "$env_ctx" || true
|
|
|
|
|
|
|
|
# test json config "subsystems" not with array
|
|
|
|
run_test "bdev_json_nonarray" $testdir/bdevperf/bdevperf --json "$nonarray_conf_file" -q 128 -o 4096 -w write_zeroes -t 1 "$env_ctx" || true
|
|
|
|
|
2020-02-26 11:18:39 +00:00
|
|
|
if [[ $test_type == bdev ]]; then
|
2022-01-21 12:58:06 +00:00
|
|
|
run_test "bdev_qos" qos_test_suite "$env_ctx"
|
2022-06-11 07:05:07 +00:00
|
|
|
run_test "bdev_qd_sampling" qd_sampling_test_suite "$env_ctx"
|
2022-06-29 11:24:51 +00:00
|
|
|
run_test "bdev_error" error_test_suite "$env_ctx"
|
2019-12-17 20:31:51 +00:00
|
|
|
fi
|
2017-12-07 13:37:12 +00:00
|
|
|
|
2019-12-10 17:49:31 +00:00
|
|
|
# Temporarily disabled - infinite loop
|
|
|
|
# if [ $RUN_NIGHTLY -eq 1 ]; then
|
2022-01-21 12:58:06 +00:00
|
|
|
# run_test "bdev_reset" $testdir/bdevperf/bdevperf --json "$conf_file" -q 16 -w reset -o 4096 -t 60 "$env_ctx"
|
2019-12-10 17:49:31 +00:00
|
|
|
# fi
|
2016-07-20 18:16:23 +00:00
|
|
|
|
2019-12-05 17:16:24 +00:00
|
|
|
# Bdev and configuration cleanup below this line
|
|
|
|
#-----------------------------------------------------
|
2017-08-11 22:06:17 +00:00
|
|
|
|
2021-08-25 10:30:57 +00:00
|
|
|
trap - SIGINT SIGTERM EXIT
|
2020-03-02 20:48:33 +00:00
|
|
|
cleanup
|