bdevperf application is utilized in multiple test scenarios and most prominently in SPDK performance reports. Similar to perf and fio_plugins, it is used to measure performance. It is intended to represent the expected behavior of users application that use SPDK bdev layer. Applications under --enable-tests are intended for specific test scenarios and user interaction is usually via a test scripts. Meanwhile --enable-examples are used more broadly to teach and show usage of SPDK libraries. As an added benefit with this patch, its possible to compile bdevperf without need to satisfy additional requirements to compile all the test applications. Change-Id: I9aaec1f9d729a1cdee89b5fdc365d61c19b03f82 Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14558 Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot
106 lines
4.8 KiB
Bash
Executable File
106 lines
4.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
rootdir=$(readlink -f $testdir/../../..)
|
|
source $rootdir/test/common/autotest_common.sh
|
|
source $rootdir/test/nvmf/common.sh
|
|
|
|
MALLOC_BDEV_SIZE=64
|
|
MALLOC_BLOCK_SIZE=512
|
|
NVMF_HOST_FIRST_PORT="60000"
|
|
NVMF_HOST_SECOND_PORT="60001"
|
|
|
|
bdevperf_rpc_sock=/var/tmp/bdevperf.sock
|
|
|
|
if [ "$TEST_TRANSPORT" == "rdma" ]; then
|
|
echo "Skipping tests on RDMA because the rdma stack fails to configure the same IP for host and target."
|
|
exit 0
|
|
fi
|
|
|
|
nvmftestinit
|
|
|
|
nvmfappstart -m 0xE
|
|
|
|
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
|
|
|
|
$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc0
|
|
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
|
|
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc0
|
|
|
|
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
|
|
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_SECOND_PORT
|
|
|
|
$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc1
|
|
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode2 -a -s SPDK00000000000002
|
|
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode2 Malloc1
|
|
|
|
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode2 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
|
|
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode2 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_SECOND_PORT
|
|
|
|
$rootdir/build/examples/bdevperf -z -r $bdevperf_rpc_sock -q 128 -o 4096 -w write -t 1 -f &> $testdir/try.txt &
|
|
bdevperf_pid=$!
|
|
|
|
trap 'process_shm --id $NVMF_APP_SHM_ID; pap "$testdir/try.txt"; killprocess $bdevperf_pid; nvmftestfini; exit 1' SIGINT SIGTERM EXIT
|
|
waitforlisten $bdevperf_pid $bdevperf_rpc_sock
|
|
|
|
# Create a controller from the first IP/Port combination.
|
|
$rpc_py -s $bdevperf_rpc_sock bdev_nvme_attach_controller -b NVMe0 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP \
|
|
-s $NVMF_PORT -f ipv4 -n nqn.2016-06.io.spdk:cnode1 -i $NVMF_FIRST_TARGET_IP -c $NVMF_HOST_FIRST_PORT
|
|
|
|
# wait for the first controller to show up.
|
|
while ! $rpc_py -s $bdevperf_rpc_sock bdev_nvme_get_controllers | grep -c NVMe; do
|
|
((++bdev_nvme_get_controllers_timeout <= 10))
|
|
sleep 1s
|
|
done
|
|
|
|
# try to attach with same controller name but different hostnqn. Should fail.
|
|
NOT $rpc_py -s $bdevperf_rpc_sock bdev_nvme_attach_controller -b NVMe0 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP \
|
|
-s $NVMF_PORT -f ipv4 -n nqn.2016-06.io.spdk:cnode1 -i $NVMF_FIRST_TARGET_IP -c $NVMF_HOST_FIRST_PORT \
|
|
-q nqn.2021-09-7.io.spdk:00001
|
|
|
|
# try to attach with same controller name but different subnqn. Should fail.
|
|
NOT $rpc_py -s $bdevperf_rpc_sock bdev_nvme_attach_controller -b NVMe0 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP \
|
|
-s $NVMF_PORT -f ipv4 -n nqn.2016-06.io.spdk:cnode2 -i $NVMF_FIRST_TARGET_IP -c $NVMF_HOST_FIRST_PORT
|
|
|
|
# try to attach with the same controller name and multipathing disabled. Should fail
|
|
NOT $rpc_py -s $bdevperf_rpc_sock bdev_nvme_attach_controller -b NVMe0 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP \
|
|
-s $NVMF_PORT -f ipv4 -n nqn.2016-06.io.spdk:cnode1 -i $NVMF_FIRST_TARGET_IP -c $NVMF_HOST_FIRST_PORT \
|
|
-x disable
|
|
|
|
# Attempt to add an identical path as a failover path. Should fail.
|
|
NOT $rpc_py -s $bdevperf_rpc_sock bdev_nvme_attach_controller -b NVMe0 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP \
|
|
-s $NVMF_PORT -f ipv4 -n nqn.2016-06.io.spdk:cnode1 -i $NVMF_FIRST_TARGET_IP -c $NVMF_HOST_FIRST_PORT \
|
|
-x failover
|
|
|
|
# Add a second path without specifying the host information. Should pass.
|
|
$rpc_py -s $bdevperf_rpc_sock bdev_nvme_attach_controller -b NVMe0 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP \
|
|
-s $NVMF_SECOND_PORT -f ipv4 -n nqn.2016-06.io.spdk:cnode1
|
|
|
|
# Remove the second path
|
|
$rpc_py -s $bdevperf_rpc_sock bdev_nvme_detach_controller NVMe0 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP \
|
|
-s $NVMF_SECOND_PORT -f ipv4 -n nqn.2016-06.io.spdk:cnode1
|
|
|
|
# Add a second controller by attaching to the same subsystem with a different controller name
|
|
$rpc_py -s $bdevperf_rpc_sock bdev_nvme_attach_controller -b NVMe1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP \
|
|
-s $NVMF_SECOND_PORT -f ipv4 -n nqn.2016-06.io.spdk:cnode1 -i $NVMF_FIRST_TARGET_IP -c $NVMF_HOST_FIRST_PORT
|
|
|
|
if [ "$($rpc_py -s $bdevperf_rpc_sock bdev_nvme_get_controllers | grep -c NVMe)" != "2" ]; then
|
|
echo "actual number of controllers is not equal to expected count."
|
|
exit 1
|
|
fi
|
|
|
|
$rootdir/examples/bdev/bdevperf/bdevperf.py -s $bdevperf_rpc_sock perform_tests
|
|
|
|
# Remove the second controller
|
|
$rpc_py -s $bdevperf_rpc_sock bdev_nvme_detach_controller NVMe1
|
|
|
|
killprocess $bdevperf_pid
|
|
|
|
$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1
|
|
$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode2
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
pap "$testdir/try.txt"
|
|
nvmftestfini
|