2016-12-12 07:42:43 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
2017-04-04 23:20:16 +00:00
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
2016-12-12 07:42:43 +00:00
|
|
|
source $rootdir/scripts/autotest_common.sh
|
|
|
|
|
source $rootdir/test/nvmf/common.sh
|
2017-05-24 23:29:24 +00:00
|
|
|
source $rootdir/test/iscsi_tgt/common.sh
|
2016-12-12 07:42:43 +00:00
|
|
|
|
|
|
|
|
if ! rdma_nic_available; then
|
|
|
|
|
echo "no NIC for nvmf test"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
rpc_py="python $rootdir/scripts/rpc.py"
|
|
|
|
|
fio_py="python $rootdir/scripts/fio.py"
|
|
|
|
|
|
|
|
|
|
ISCSI_PORT=3260
|
|
|
|
|
NVMF_PORT=4420
|
|
|
|
|
|
|
|
|
|
timing_enter nvme_remote
|
|
|
|
|
|
|
|
|
|
# Start the NVMf target
|
|
|
|
|
$rootdir/app/nvmf_tgt/nvmf_tgt -c $rootdir/test/nvmf/nvmf.conf -m 0x2 -p 1 -s 512 &
|
|
|
|
|
nvmfpid=$!
|
|
|
|
|
echo "NVMf target launched. pid: $nvmfpid"
|
|
|
|
|
trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
|
|
|
|
|
waitforlisten $nvmfpid 5260
|
|
|
|
|
echo "NVMf target has started."
|
|
|
|
|
bdevs=$($rpc_py construct_malloc_bdev 64 512)
|
2017-06-27 23:43:28 +00:00
|
|
|
$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode1 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs"
|
2016-12-12 07:42:43 +00:00
|
|
|
echo "NVMf subsystem created."
|
|
|
|
|
|
2017-05-25 20:06:51 +00:00
|
|
|
timing_enter start_iscsi_tgt
|
|
|
|
|
|
2016-12-12 07:42:43 +00:00
|
|
|
# Start the iSCSI target
|
2017-06-22 22:42:58 +00:00
|
|
|
$ISCSI_APP -c $testdir/iscsi.conf -m 0x1 -p 0 -s 512 &
|
2016-12-12 07:42:43 +00:00
|
|
|
iscsipid=$!
|
|
|
|
|
echo "iSCSI target launched. pid: $iscsipid"
|
2017-04-28 22:06:27 +00:00
|
|
|
trap "killprocess $iscsipid; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
|
2016-12-12 07:42:43 +00:00
|
|
|
# The configuration file for the iSCSI target told it to use port 5261 for RPC
|
|
|
|
|
waitforlisten $iscsipid 5261
|
|
|
|
|
echo "iSCSI target has started."
|
|
|
|
|
|
2017-05-25 20:06:51 +00:00
|
|
|
timing_exit start_iscsi_tgt
|
|
|
|
|
|
2016-12-12 07:42:43 +00:00
|
|
|
echo "Creating an iSCSI target node."
|
|
|
|
|
$rpc_py -p 5261 add_portal_group 1 $TARGET_IP:$ISCSI_PORT
|
|
|
|
|
$rpc_py -p 5261 add_initiator_group 1 ALL $INITIATOR_IP/32
|
2017-06-27 23:43:28 +00:00
|
|
|
$rpc_py -p 5261 construct_nvme_bdev -b "Nvme0" -t "rdma" -f "ipv4" -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT -n nqn.2016-06.io.spdk:cnode1
|
2016-12-12 07:42:43 +00:00
|
|
|
$rpc_py -p 5261 construct_target_node Target1 Target1_alias 'Nvme0n1:0' '1:1' 64 1 0 0 0
|
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
|
|
echo "Logging in to iSCSI target."
|
|
|
|
|
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
|
|
|
|
|
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
|
2017-04-28 22:06:27 +00:00
|
|
|
trap "iscsicleanup; killprocess $iscsipid; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
|
2016-12-12 07:42:43 +00:00
|
|
|
sleep 1
|
|
|
|
|
|
|
|
|
|
echo "Running FIO"
|
|
|
|
|
$fio_py 4096 1 randrw 1 verify
|
|
|
|
|
|
|
|
|
|
rm -f ./local-job0-0-verify.state
|
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
|
|
|
|
|
iscsicleanup
|
|
|
|
|
killprocess $iscsipid
|
|
|
|
|
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
|
|
|
|
|
killprocess $nvmfpid
|
|
|
|
|
|
|
|
|
|
timing_exit nvme_remote
|