nvmf: Use bdevperf for the shutdown test

Rewrite the shutdown test to use bdevperf. This has a few advantages:

1) We avoid any kernel bugs in the NVMe-oF initiator which is not
designed to be connected/disconnect quickly.
2) It is much faster
3) It is much less variable in behavior.

Change-Id: I410ade64677ec14a7b0851a674650a145555f4ed
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/432356
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Ben Walker 2018-11-07 11:00:28 -07:00
parent bf1a82cf5a
commit edb693c58d

View File

@ -43,6 +43,9 @@ if check_ip_is_soft_roce "$NVMF_FIRST_TARGET_IP"; then
num_subsystems=2
fi
touch $testdir/bdevperf.conf
echo "[Nvme]" > $testdir/bdevperf.conf
# Create subsystems
for i in `seq 1 $num_subsystems`
do
@ -52,37 +55,47 @@ do
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$i $bdev
done
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode$i -t rdma -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
echo " TransportID \"trtype:RDMA adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode$i traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT\" Nvme$i" >> $testdir/bdevperf.conf
done
modprobe -v nvme-rdma
modprobe -v nvme-fabrics
# Test 1: Kill initiator unexpectedly
# Repeatedly connect and disconnect
for ((x=0; x<2;x++)); do
# Connect kernel host to subsystems
for i in `seq 1 $num_subsystems`; do
nvme_connect -t rdma -n "nqn.2016-06.io.spdk:cnode${i}" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
done
# Disconnect the subsystems in reverse order
for i in `seq $num_subsystems -1 1`; do
nvme disconnect -n nqn.2016-06.io.spdk:cnode${i}
done
done
# Run bdevperf
$rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdevperf.conf -q 64 -o 65536 -w verify -t 20 &
perfpid=$!
sleep 10
# Start a series of connects right before disconnecting
for i in `seq 1 $num_subsystems`; do
nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode${i}" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
done
# Kill bdevperf half way through
killprocess $perfpid
waitforblk "nvme0n1"
# Verify the target stays up
sleep 1
kill -0 $pid
# Kill nvmf tgt without removing any subsystem to check whether it can shutdown correctly
rm -f ./local-job0-0-verify.state
# Test 2: Kill the target unexpectedly
trap - SIGINT SIGTERM EXIT
# Run bdevperf
$rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdevperf.conf -q 64 -o 65536 -w verify -t 20 &
perfpid=$!
# Expand the trap to clean up bdevperf if something goes wrong
trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $pid; kill -9 $perfpid; nvmfcleanup; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
# Kill the target half way through
sleep 10
killprocess $pid
# Verify bdevperf exits successfully
sleep 1
# TODO: Right now the NVMe-oF initiator will not correctly detect broken connections
# and so it will never shut down. Just kill it.
kill -9 $perfpid
rm -f ./local-job0-0-verify.state
rm -rf $testdir/bdevperf.conf
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini $1
timing_exit shutdown