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 ./crt_trprt.sh iso
20 echo "nvme command not found; skipping create transport test"
24 RDMA_IP_LIST
=$
(get_available_rdma_ips
)
25 NVMF_FIRST_TARGET_IP
=$
(echo "$RDMA_IP_LIST" |
head -n 1)
26 if [ -z $NVMF_FIRST_TARGET_IP ]; then
27 echo "no NIC for nvmf test"
32 timing_enter start_nvmf_tgt
33 # Start up the NVMf target in another process
37 trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
39 waitforlisten
$nvmfpid
40 # Use nvmf_create_transport call to create transport
41 $rpc_py nvmf_create_transport
-t RDMA
-u 8192 -p 4
42 timing_exit start_nvmf_tgt
44 null_bdevs
="$($rpc_py construct_null_bdev Null0 $NULL_BDEV_SIZE $NULL_BLOCK_SIZE) "
45 null_bdevs
+="$($rpc_py construct_null_bdev Null1 $NULL_BDEV_SIZE $NULL_BLOCK_SIZE)"
49 $rpc_py nvmf_subsystem_create nqn
.2016-06.io.spdk
:cnode1
-a -s SPDK00000000000001
50 for null_bdev
in $null_bdevs; do
51 $rpc_py nvmf_subsystem_add_ns nqn
.2016-06.io.spdk
:cnode1
$null_bdev
53 $rpc_py nvmf_subsystem_add_listener nqn
.2016-06.io.spdk
:cnode1
-t rdma
-a $NVMF_FIRST_TARGET_IP -s 4420
55 nvme discover
-t rdma
-a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
57 echo "Perform nvmf subsystem discovery via RPC"
58 $rpc_py get_nvmf_subsystems
60 $rpc_py delete_nvmf_subsystem nqn
.2016-06.io.spdk
:cnode1
62 for null_bdev
in $null_bdevs; do
63 $rpc_py delete_null_bdev
$null_bdev
66 check_bdevs
=$
($rpc_py get_bdevs | jq
-r '.[].name')
67 if [ -n "$check_bdevs" ]; then
72 trap - SIGINT SIGTERM EXIT