2016-12-12 07:42:43 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
2017-04-04 23:20:16 +00:00
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
2018-02-27 22:14:08 +00:00
|
|
|
source $rootdir/test/common/autotest_common.sh
|
2016-12-12 07:42:43 +00:00
|
|
|
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
|
|
|
|
2019-05-13 19:11:00 +00:00
|
|
|
nvmftestinit
|
2020-08-11 10:36:11 +00:00
|
|
|
iscsitestinit
|
2019-05-06 22:46:30 +00:00
|
|
|
|
2018-09-11 13:26:14 +00:00
|
|
|
rpc_py="$rootdir/scripts/rpc.py"
|
|
|
|
fio_py="$rootdir/scripts/fio.py"
|
2016-12-12 07:42:43 +00:00
|
|
|
|
2018-04-25 16:16:08 +00:00
|
|
|
# Namespaces are NOT used here on purpose. Rxe_cfg utilility used for NVMf tests do not support namespaces.
|
|
|
|
TARGET_IP=127.0.0.1
|
|
|
|
INITIATOR_IP=127.0.0.1
|
|
|
|
NETMASK=$INITIATOR_IP/32
|
|
|
|
|
2018-04-09 02:19:56 +00:00
|
|
|
function run_nvme_remote() {
|
|
|
|
echo "now use $1 method to run iscsi tgt."
|
|
|
|
|
|
|
|
iscsi_rpc_addr="/var/tmp/spdk-iscsi.sock"
|
2020-02-20 10:24:53 +00:00
|
|
|
"${ISCSI_APP[@]}" -r "$iscsi_rpc_addr" -m 0x1 -p 0 -s 512 --wait-for-rpc &
|
2018-04-09 02:19:56 +00:00
|
|
|
iscsipid=$!
|
|
|
|
echo "iSCSI target launched. pid: $iscsipid"
|
2020-08-11 10:36:11 +00:00
|
|
|
trap 'killprocess $iscsipid; iscsitestfini; nvmftestfini; exit 1' SIGINT SIGTERM EXIT
|
2018-04-09 02:19:56 +00:00
|
|
|
waitforlisten $iscsipid "$iscsi_rpc_addr"
|
2019-09-11 11:15:34 +00:00
|
|
|
$rpc_py -s "$iscsi_rpc_addr" iscsi_set_options -o 30 -a 16
|
2019-09-11 13:30:14 +00:00
|
|
|
$rpc_py -s "$iscsi_rpc_addr" framework_start_init
|
2018-07-12 19:26:27 +00:00
|
|
|
if [ "$1" = "remote" ]; then
|
2019-08-23 13:50:51 +00:00
|
|
|
$rpc_py -s $iscsi_rpc_addr bdev_nvme_attach_controller -b "Nvme0" -t "rdma" -f "ipv4" -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT -n nqn.2016-06.io.spdk:cnode1
|
2018-07-12 19:26:27 +00:00
|
|
|
fi
|
|
|
|
|
2018-04-09 02:19:56 +00:00
|
|
|
echo "iSCSI target has started."
|
|
|
|
|
|
|
|
timing_exit start_iscsi_tgt
|
|
|
|
|
|
|
|
echo "Creating an iSCSI target node."
|
2019-09-09 10:35:30 +00:00
|
|
|
$rpc_py -s "$iscsi_rpc_addr" iscsi_create_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT
|
2019-09-03 08:53:37 +00:00
|
|
|
$rpc_py -s "$iscsi_rpc_addr" iscsi_create_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
|
2018-04-09 02:19:56 +00:00
|
|
|
if [ "$1" = "local" ]; then
|
2019-08-23 13:50:51 +00:00
|
|
|
$rpc_py -s "$iscsi_rpc_addr" bdev_nvme_attach_controller -b "Nvme0" -t "rdma" -f "ipv4" -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT -n nqn.2016-06.io.spdk:cnode1
|
2018-04-09 02:19:56 +00:00
|
|
|
fi
|
2019-09-05 10:35:18 +00:00
|
|
|
$rpc_py -s "$iscsi_rpc_addr" iscsi_create_target_node Target1 Target1_alias 'Nvme0n1:0' $PORTAL_TAG:$INITIATOR_TAG 64 -d
|
2018-04-09 02:19:56 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2016-12-12 07:42:43 +00:00
|
|
|
# Start the NVMf target
|
2020-02-20 10:24:53 +00:00
|
|
|
"${NVMF_APP[@]}" -m 0x2 -p 1 -s 512 --wait-for-rpc &
|
2016-12-12 07:42:43 +00:00
|
|
|
nvmfpid=$!
|
|
|
|
echo "NVMf target launched. pid: $nvmfpid"
|
2020-08-11 10:36:11 +00:00
|
|
|
trap 'iscsitestfini; nvmftestfini; exit 1' SIGINT SIGTERM EXIT
|
2017-11-09 23:33:29 +00:00
|
|
|
waitforlisten $nvmfpid
|
2019-09-11 13:30:14 +00:00
|
|
|
$rpc_py framework_start_init
|
2019-05-16 21:39:52 +00:00
|
|
|
$rpc_py nvmf_create_transport -t RDMA -u 8192
|
2016-12-12 07:42:43 +00:00
|
|
|
echo "NVMf target has started."
|
2019-08-09 11:15:35 +00:00
|
|
|
bdevs=$($rpc_py bdev_malloc_create 64 512)
|
2019-09-20 10:22:44 +00:00
|
|
|
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
|
2019-06-03 16:15:25 +00:00
|
|
|
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t rdma -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
|
2018-09-10 19:04:31 +00:00
|
|
|
for bdev in $bdevs; do
|
|
|
|
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 $bdev
|
|
|
|
done
|
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
|
|
|
|
|
2018-04-09 02:19:56 +00:00
|
|
|
run_nvme_remote "local"
|
2017-06-22 23:56:37 +00:00
|
|
|
|
2019-09-16 09:23:41 +00:00
|
|
|
trap 'iscsicleanup; killprocess $iscsipid;
|
2020-08-11 10:36:11 +00:00
|
|
|
rm -f ./local-job0-0-verify.state; iscsitestfini; nvmftestfini; exit 1' SIGINT SIGTERM EXIT
|
2016-12-12 07:42:43 +00:00
|
|
|
|
|
|
|
echo "Running FIO"
|
2019-05-24 22:58:19 +00:00
|
|
|
$fio_py -p iscsi -i 4096 -d 1 -t randrw -r 1 -v
|
2016-12-12 07:42:43 +00:00
|
|
|
|
2018-04-09 02:19:56 +00:00
|
|
|
rm -f ./local-job0-0-verify.state
|
|
|
|
iscsicleanup
|
|
|
|
killprocess $iscsipid
|
|
|
|
|
|
|
|
run_nvme_remote "remote"
|
|
|
|
|
|
|
|
echo "Running FIO"
|
2019-05-24 22:58:19 +00:00
|
|
|
$fio_py -p iscsi -i 4096 -d 1 -t randrw -r 1 -v
|
2018-04-09 02:19:56 +00:00
|
|
|
|
2016-12-12 07:42:43 +00:00
|
|
|
rm -f ./local-job0-0-verify.state
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
|
|
|
iscsicleanup
|
|
|
|
killprocess $iscsipid
|
2019-09-23 10:17:30 +00:00
|
|
|
$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1
|
2016-12-12 07:42:43 +00:00
|
|
|
|
2020-08-11 10:36:11 +00:00
|
|
|
iscsitestfini
|
2019-05-13 19:11:00 +00:00
|
|
|
nvmftestfini
|