2017-01-09 14:24:37 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
2018-02-27 22:14:08 +00:00
|
|
|
source $rootdir/test/common/autotest_common.sh
|
2017-01-09 14:24:37 +00:00
|
|
|
source $rootdir/test/nvmf/common.sh
|
|
|
|
|
|
|
|
MALLOC_BDEV_SIZE=128
|
|
|
|
MALLOC_BLOCK_SIZE=512
|
2017-12-19 14:01:11 +00:00
|
|
|
NVMF_SUBSYS=11
|
2017-01-09 14:24:37 +00:00
|
|
|
|
2018-09-11 13:26:14 +00:00
|
|
|
rpc_py="$rootdir/scripts/rpc.py"
|
2017-01-09 14:24:37 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2018-08-14 18:05:15 +00:00
|
|
|
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
|
|
|
|
# e.g. sudo ./multiconnection.sh iso
|
|
|
|
nvmftestinit $1
|
|
|
|
|
2017-07-25 15:39:51 +00:00
|
|
|
RDMA_IP_LIST=$(get_available_rdma_ips)
|
|
|
|
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
|
|
|
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
2017-01-09 14:24:37 +00:00
|
|
|
echo "no NIC for nvmf test"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2017-12-19 14:01:11 +00:00
|
|
|
# SoftRoce does not have enough queues available for
|
|
|
|
# multiconnection tests. Detect if we're using software RDMA.
|
|
|
|
# If so - lower the number of subsystems for test.
|
|
|
|
if check_ip_is_soft_roce $NVMF_FIRST_TARGET_IP; then
|
|
|
|
echo "Using software RDMA, lowering number of NVMeOF subsystems."
|
|
|
|
NVMF_SUBSYS=1
|
|
|
|
fi
|
|
|
|
|
2017-01-09 14:24:37 +00:00
|
|
|
timing_enter multiconnection
|
2017-05-27 00:13:55 +00:00
|
|
|
timing_enter start_nvmf_tgt
|
2017-01-09 14:24:37 +00:00
|
|
|
# Start up the NVMf target in another process
|
2018-10-18 22:22:58 +00:00
|
|
|
$NVMF_APP -m 0xF &
|
2017-01-09 14:24:37 +00:00
|
|
|
pid=$!
|
|
|
|
|
2018-09-10 07:32:09 +00:00
|
|
|
trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
|
2017-01-09 14:24:37 +00:00
|
|
|
|
2017-11-09 23:33:29 +00:00
|
|
|
waitforlisten $pid
|
2018-10-11 18:23:54 +00:00
|
|
|
$rpc_py nvmf_create_transport -t RDMA -u 8192 -p 4
|
2017-05-27 00:13:55 +00:00
|
|
|
timing_exit start_nvmf_tgt
|
2017-01-09 14:24:37 +00:00
|
|
|
|
|
|
|
modprobe -v nvme-rdma
|
|
|
|
|
2017-12-19 14:01:11 +00:00
|
|
|
for i in `seq 1 $NVMF_SUBSYS`
|
2017-01-09 14:24:37 +00:00
|
|
|
do
|
|
|
|
bdevs="$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"
|
2018-09-10 19:04:31 +00:00
|
|
|
$rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode$i -a -s SPDK$i
|
|
|
|
for bdev in $bdevs; 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
|
2017-01-09 14:24:37 +00:00
|
|
|
done
|
|
|
|
|
2017-12-19 14:01:11 +00:00
|
|
|
for i in `seq 1 $NVMF_SUBSYS`; do
|
2018-04-16 20:28:16 +00:00
|
|
|
k=$[$i-1]
|
2017-01-09 14:24:37 +00:00
|
|
|
nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode${i}" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
|
2018-04-16 20:28:16 +00:00
|
|
|
|
2018-05-31 07:19:15 +00:00
|
|
|
waitforblk "nvme${k}n1"
|
2017-01-09 14:24:37 +00:00
|
|
|
done
|
|
|
|
|
2019-03-21 16:57:37 +00:00
|
|
|
$rootdir/scripts/fio.py nvmf 262144 64 read 10
|
|
|
|
$rootdir/scripts/fio.py nvmf 262144 64 randwrite 10
|
2017-01-09 14:24:37 +00:00
|
|
|
|
|
|
|
sync
|
2017-12-19 14:01:11 +00:00
|
|
|
for i in `seq 1 $NVMF_SUBSYS`; do
|
2017-03-03 23:53:59 +00:00
|
|
|
nvme disconnect -n "nqn.2016-06.io.spdk:cnode${i}" || true
|
2017-01-09 14:24:37 +00:00
|
|
|
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode${i}
|
|
|
|
done
|
|
|
|
|
|
|
|
rm -f ./local-job0-0-verify.state
|
|
|
|
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
|
|
|
nvmfcleanup
|
|
|
|
killprocess $pid
|
2018-08-14 18:05:15 +00:00
|
|
|
nvmftestfini $1
|
2017-01-09 14:24:37 +00:00
|
|
|
timing_exit multiconnection
|