5 testdir
=$
(readlink
-f $
(dirname $0))
6 rootdir
=$
(readlink
-f $testdir/..
/..
/..
)
7 source $rootdir/scripts
/autotest_common.sh
8 source $rootdir/test
/nvmf
/common.sh
10 if [ -z "$TARGET_IP" ]; then
11 echo "TARGET_IP not defined in environment"
15 if [ -z "$INITIATOR_IP" ]; then
16 echo "INITIATOR_IP not defined in environment"
20 if ! rdma_nic_available
; then
21 echo "no NIC for nvmf test"
25 rpc_py
="python $rootdir/scripts/rpc.py"
26 fio_py
="python $rootdir/scripts/fio.py"
31 timing_enter nvme_remote
33 # Start the NVMf target
34 $rootdir/app
/nvmf_tgt
/nvmf_tgt
-c $rootdir/test
/nvmf
/nvmf.conf
-m 0x2 -p 1 -s 512 &
36 echo "NVMf target launched. pid: $nvmfpid"
37 trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
38 waitforlisten
$nvmfpid 5260
39 echo "NVMf target has started."
40 bdevs
=$
($rpc_py construct_malloc_bdev
64 512)
41 $rpc_py construct_nvmf_subsystem Virtual nqn
.2016-06.io.spdk
:cnode1
'transport:RDMA traddr:192.168.100.8 trsvcid:4420' '' -s SPDK00000000000001
-n "$bdevs"
42 echo "NVMf subsystem created."
44 # Start the iSCSI target
45 $rootdir/app
/iscsi_tgt
/iscsi_tgt
-c $testdir/iscsi.conf
-m 0x1 -p 0 -s 512 &
47 echo "iSCSI target launched. pid: $iscsipid"
48 trap "process_core; killprocess $iscsipid; exit 1" SIGINT SIGTERM EXIT
49 # The configuration file for the iSCSI target told it to use port 5261 for RPC
50 waitforlisten
$iscsipid 5261
51 echo "iSCSI target has started."
53 echo "Creating an iSCSI target node."
54 $rpc_py -p 5261 add_portal_group
1 $TARGET_IP:$ISCSI_PORT
55 $rpc_py -p 5261 add_initiator_group
1 ALL
$INITIATOR_IP/32
56 $rpc_py -p 5261 construct_nvme_bdev
-b "Nvme0" -t "rdma" -f "ipv4" -a 192.168.100.8 -s $NVMF_PORT -n nqn
.2016-06.io.spdk
:cnode1
57 $rpc_py -p 5261 construct_target_node Target1 Target1_alias
'Nvme0n1:0' '1:1' 64 1 0 0 0
60 echo "Logging in to iSCSI target."
61 iscsiadm
-m discovery
-t sendtargets
-p $TARGET_IP:$ISCSI_PORT
62 iscsiadm
-m node
--login -p $TARGET_IP:$ISCSI_PORT
63 trap "iscsicleanup; process_core; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
67 $fio_py 4096 1 randrw
1 verify
69 rm -f .
/local-job0-0-verify.state
70 trap - SIGINT SIGTERM EXIT
74 $rpc_py delete_nvmf_subsystem nqn
.2016-06.io.spdk
:cnode1
77 timing_exit nvme_remote