1#!/usr/bin/env bash 2 3testdir=$(readlink -f $(dirname $0)) 4rootdir=$(readlink -f $testdir/../../..) 5source $rootdir/test/common/autotest_common.sh 6source $rootdir/test/nvmf/common.sh 7 8rpc_py="$rootdir/scripts/rpc.py" 9 10nvmftestinit 11nvmfappstart -m 0x3 12 13$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192 14$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001 -m 10 15$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT 16$rpc_py bdev_null_create NULL1 1000 512 17# Subsystem destruction process waits for all controllers to be destroyed which in turn wait 18# for all qpairs to be deleted. A qpair can only be deleted when all outstaind requests are completed 19# bdev_delay is used in this test to make a situation when qpair has outstanding requests when disconnect 20# starts. It allows to trigger async qpair/controller/subsystem destruction path 21$rpc_py bdev_delay_create -b NULL1 -d Delay0 -r 1000000 -t 1000000 -w 1000000 -n 1000000 22$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Delay0 23 24$SPDK_EXAMPLE_DIR/perf -c 0xC -r "trtype:$TEST_TRANSPORT adrfam:IPv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT" \ 25 -t 5 -q 128 -w randrw -M 70 -o 512 -P 4 & 26perf_pid=$! 27 28sleep 2 29 30$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1 31 32delay=0 33while kill -0 $perf_pid; do 34 sleep 0.5 35 #wait 15 seconds max 36 if ((delay++ > 30)); then 37 echo "perf is still running, failing the test" 38 false 39 fi 40done 41 42#check that traffic goes when a new subsystem is created 43$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001 -m 10 44$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT 45$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Delay0 46 47$SPDK_EXAMPLE_DIR/perf -c 0xC -r "trtype:$TEST_TRANSPORT adrfam:IPv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT" \ 48 -t 3 -q 128 -w randrw -M 70 -o 512 -P 4 & 49perf_pid=$! 50 51delay=0 52while kill -0 $perf_pid; do 53 sleep 0.5 54 #wait 10 seconds max 55 if ((delay++ > 20)); then 56 echo "perf didn't finish on time" 57 false 58 fi 59done 60 61trap - SIGINT SIGTERM EXIT 62 63nvmftestfini 64