test/iscsi_tgt: merge the two steps of running fio_remote_nvme.sh

Change-Id: Icb98e4628962591da32d169853d0ff14400e1e50
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
Reviewed-on: https://review.gerrithub.io/406922
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Liang Yan 2018-04-09 10:19:56 +08:00 committed by Daniel Verkamp
parent 208748b423
commit aa749442cb
2 changed files with 46 additions and 32 deletions

View File

@ -49,10 +49,8 @@ kill_stub
if [ $SPDK_TEST_NVMF -eq 1 ]; then
# TODO: enable remote NVMe controllers with multi-process so that
# we can use the stub for this test
# Test configure remote NVMe device from rpc
run_test ./test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh 0
# Test configure remote NVMe device from conf file
run_test ./test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh 1
# Test configure remote NVMe device from rpc and conf file
run_test ./test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh
fi
if [ $RUN_NIGHTLY -eq 1 ]; then

View File

@ -20,6 +20,39 @@ fio_py="python $rootdir/scripts/fio.py"
NVMF_PORT=4420
function run_nvme_remote() {
echo "now use $1 method to run iscsi tgt."
cp $testdir/iscsi.conf $testdir/iscsi.conf.tmp
if [ "$1" = "remote" ]; then
echo "[NVMe]" >> $testdir/iscsi.conf.tmp
echo " TransportID \"trtype:RDMA adrfam:ipv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420 subnqn:nqn.2016-06.io.spdk:cnode1\" Nvme0" >> $testdir/iscsi.conf.tmp
fi
# Start the iSCSI target without using stub
iscsi_rpc_addr="/var/tmp/spdk-iscsi.sock"
$rootdir/app/iscsi_tgt/iscsi_tgt -r "$iscsi_rpc_addr" -c $testdir/iscsi.conf.tmp -m 0x1 -p 0 -s 512 &
iscsipid=$!
echo "iSCSI target launched. pid: $iscsipid"
trap "killprocess $iscsipid; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
waitforlisten $iscsipid "$iscsi_rpc_addr"
echo "iSCSI target has started."
timing_exit start_iscsi_tgt
echo "Creating an iSCSI target node."
$rpc_py -s "$iscsi_rpc_addr" add_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT
$rpc_py -s "$iscsi_rpc_addr" add_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
if [ "$1" = "local" ]; then
$rpc_py -s "$iscsi_rpc_addr" construct_nvme_bdev -b "Nvme0" -t "rdma" -f "ipv4" -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT -n nqn.2016-06.io.spdk:cnode1
fi
$rpc_py -s "$iscsi_rpc_addr" construct_target_node Target1 Target1_alias 'Nvme0n1:0' $PORTAL_TAG:$INITIATOR_TAG 64 -d
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
}
timing_enter nvme_remote
# Start the NVMf target
@ -35,41 +68,24 @@ echo "NVMf subsystem created."
timing_enter start_iscsi_tgt
cp $testdir/iscsi.conf $testdir/iscsi.conf.tmp
run_nvme_remote "local"
if [ $1 -eq 1 ]; then
echo "[NVMe]" >> $testdir/iscsi.conf.tmp
echo " TransportID \"trtype:RDMA adrfam:ipv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420 subnqn:nqn.2016-06.io.spdk:cnode1\" Nvme0" >> $testdir/iscsi.conf.tmp
fi
# Start the iSCSI target without using stub
iscsi_rpc_addr="/var/tmp/spdk-iscsi.sock"
$rootdir/app/iscsi_tgt/iscsi_tgt -r "$iscsi_rpc_addr" -c $testdir/iscsi.conf.tmp -m 0x1 -p 0 -s 512 &
iscsipid=$!
echo "iSCSI target launched. pid: $iscsipid"
trap "killprocess $iscsipid; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
waitforlisten $iscsipid "$iscsi_rpc_addr"
echo "iSCSI target has started."
timing_exit start_iscsi_tgt
echo "Creating an iSCSI target node."
$rpc_py -s "$iscsi_rpc_addr" add_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT
$rpc_py -s "$iscsi_rpc_addr" add_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
if [ $1 -eq 0 ]; then
$rpc_py -s "$iscsi_rpc_addr" construct_nvme_bdev -b "Nvme0" -t "rdma" -f "ipv4" -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT -n nqn.2016-06.io.spdk:cnode1
fi
$rpc_py -s "$iscsi_rpc_addr" construct_target_node Target1 Target1_alias 'Nvme0n1:0' $PORTAL_TAG:$INITIATOR_TAG 64 -d
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
trap "iscsicleanup; killprocess $iscsipid; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
sleep 1
echo "Running FIO"
$fio_py 4096 1 randrw 1 verify
rm -f ./local-job0-0-verify.state
iscsicleanup
killprocess $iscsipid
rm -f $testdir/iscsi.conf.tmp
run_nvme_remote "remote"
echo "Running FIO"
$fio_py 4096 1 randrw 1 verify
rm -f ./local-job0-0-verify.state
trap - SIGINT SIGTERM EXIT