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:
parent
bf1a82cf5a
commit
edb693c58d
@ -43,6 +43,9 @@ if check_ip_is_soft_roce "$NVMF_FIRST_TARGET_IP"; then
|
|||||||
num_subsystems=2
|
num_subsystems=2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
touch $testdir/bdevperf.conf
|
||||||
|
echo "[Nvme]" > $testdir/bdevperf.conf
|
||||||
|
|
||||||
# Create subsystems
|
# Create subsystems
|
||||||
for i in `seq 1 $num_subsystems`
|
for i in `seq 1 $num_subsystems`
|
||||||
do
|
do
|
||||||
@ -52,37 +55,47 @@ do
|
|||||||
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$i $bdev
|
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$i $bdev
|
||||||
done
|
done
|
||||||
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode$i -t rdma -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
|
$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
|
done
|
||||||
|
|
||||||
modprobe -v nvme-rdma
|
# Test 1: Kill initiator unexpectedly
|
||||||
modprobe -v nvme-fabrics
|
|
||||||
|
|
||||||
# Repeatedly connect and disconnect
|
# Run bdevperf
|
||||||
for ((x=0; x<2;x++)); do
|
$rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdevperf.conf -q 64 -o 65536 -w verify -t 20 &
|
||||||
# Connect kernel host to subsystems
|
perfpid=$!
|
||||||
for i in `seq 1 $num_subsystems`; do
|
sleep 10
|
||||||
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
|
|
||||||
|
|
||||||
# Start a series of connects right before disconnecting
|
# Kill bdevperf half way through
|
||||||
for i in `seq 1 $num_subsystems`; do
|
killprocess $perfpid
|
||||||
nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode${i}" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
|
|
||||||
done
|
|
||||||
|
|
||||||
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
|
# Test 2: Kill the target unexpectedly
|
||||||
rm -f ./local-job0-0-verify.state
|
|
||||||
|
|
||||||
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
|
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
|
nvmfcleanup
|
||||||
nvmftestfini $1
|
nvmftestfini $1
|
||||||
timing_exit shutdown
|
timing_exit shutdown
|
||||||
|
Loading…
Reference in New Issue
Block a user