From aa749442cb1676e8631cb8a95bada724ac9b30dd Mon Sep 17 00:00:00 2001 From: Liang Yan Date: Mon, 9 Apr 2018 10:19:56 +0800 Subject: [PATCH] test/iscsi_tgt: merge the two steps of running fio_remote_nvme.sh Change-Id: Icb98e4628962591da32d169853d0ff14400e1e50 Signed-off-by: Liang Yan Reviewed-on: https://review.gerrithub.io/406922 Reviewed-by: Daniel Verkamp Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker --- test/iscsi_tgt/iscsi_tgt.sh | 6 +- test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh | 72 +++++++++++-------- 2 files changed, 46 insertions(+), 32 deletions(-) diff --git a/test/iscsi_tgt/iscsi_tgt.sh b/test/iscsi_tgt/iscsi_tgt.sh index eec35de376..fdfd9c4a13 100755 --- a/test/iscsi_tgt/iscsi_tgt.sh +++ b/test/iscsi_tgt/iscsi_tgt.sh @@ -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 diff --git a/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh b/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh index 6614da6464..dcd224de8f 100755 --- a/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh +++ b/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh @@ -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