3 testdir
=$
(readlink
-f $
(dirname $0))
4 rootdir
=$
(readlink
-f $testdir/..
/..
/..
)
5 source $rootdir/test
/common
/autotest_common.sh
6 source $rootdir/test
/nvmf
/common.sh
11 rpc_py
="python $rootdir/scripts/rpc.py"
15 # pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
16 # e.g. sudo ./nmic.sh iso
19 RDMA_IP_LIST
=$
(get_available_rdma_ips
)
20 NVMF_FIRST_TARGET_IP
=$
(echo "$RDMA_IP_LIST" |
head -n 1)
21 NVMF_SECOND_TARGET_IP
=$
(echo "$RDMA_IP_LIST" |
sed -n 2p
)
22 if [ -z $NVMF_FIRST_TARGET_IP ]; then
23 echo "no NIC for nvmf test"
28 timing_enter start_nvmf_tgt
29 # Start up the NVMf target in another process
33 trap "killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
36 $rpc_py nvmf_create_transport
-t RDMA
-u 8192 -p 4
37 timing_exit start_nvmf_tgt
40 bdevs
="$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"
41 $rpc_py nvmf_subsystem_create nqn
.2016-06.io.spdk
:cnode1
-a -s SPDK1
42 for bdev
in $bdevs; do
43 $rpc_py nvmf_subsystem_add_ns nqn
.2016-06.io.spdk
:cnode1
$bdev
45 $rpc_py nvmf_subsystem_add_listener nqn
.2016-06.io.spdk
:cnode1
-t RDMA
-a $NVMF_FIRST_TARGET_IP -s "$NVMF_PORT"
47 echo "test case1: single bdev can't be used in multiple subsystems"
49 $rpc_py nvmf_subsystem_create nqn
.2016-06.io.spdk
:cnode2
-a -s SPDK2
50 $rpc_py nvmf_subsystem_add_listener nqn
.2016-06.io.spdk
:cnode2
-t RDMA
-a $NVMF_FIRST_TARGET_IP -s "$NVMF_PORT"
51 for bdev
in $bdevs; do
52 $rpc_py nvmf_subsystem_add_ns nqn
.2016-06.io.spdk
:cnode2
$bdev
55 if [ $nmic_status -eq 0 ]; then
56 echo " Adding namespace passed - failure expected."
60 echo " Adding namespace failed - expected result."
67 echo "test case2: host connect to nvmf target in multiple paths"
68 if [ ! -z $NVMF_SECOND_TARGET_IP ]; then
69 $rpc_py nvmf_subsystem_add_listener nqn
.2016-06.io.spdk
:cnode1
-t RDMA
-a $NVMF_SECOND_TARGET_IP -s $NVMF_PORT
71 nvme connect
-t rdma
-n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
72 nvme connect
-t rdma
-n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_SECOND_TARGET_IP" -s "$NVMF_PORT"
76 $testdir/..
/fio
/nvmf_fio.py
4096 1 write 1 verify
79 nvme disconnect
-n "nqn.2016-06.io.spdk:cnode1" || true
81 trap - SIGINT SIGTERM EXIT