From 4df57e999aed93f5ed3a8f5b79ca545bb9c46b1f Mon Sep 17 00:00:00 2001 From: lgalkax Date: Wed, 20 Sep 2017 15:57:36 +0200 Subject: [PATCH] test/iscsi: Add iscsi_tgt with NVML backend test Add test script to use SPDK iscsi with NVML backends and run FIO read/write traffic with verify flag enabled Change-Id: I72c95154591034583400116b7c0f05413f35f9ee Signed-off-by: lgalkax Signed-off-by: Karol Latecki Reviewed-on: https://review.gerrithub.io/379349 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp --- test/iscsi_tgt/iscsi_tgt.sh | 9 ++++ test/iscsi_tgt/pmem/iscsi.conf | 13 +++++ test/iscsi_tgt/pmem/iscsi_pmem.sh | 84 +++++++++++++++++++++++++++++++ test/iscsi_tgt/test_plan.md | 41 +++++++++++++++ 4 files changed, 147 insertions(+) create mode 100644 test/iscsi_tgt/pmem/iscsi.conf create mode 100755 test/iscsi_tgt/pmem/iscsi_pmem.sh create mode 100644 test/iscsi_tgt/test_plan.md diff --git a/test/iscsi_tgt/iscsi_tgt.sh b/test/iscsi_tgt/iscsi_tgt.sh index 05eccd9a2..d862a1810 100755 --- a/test/iscsi_tgt/iscsi_tgt.sh +++ b/test/iscsi_tgt/iscsi_tgt.sh @@ -32,6 +32,15 @@ run_test ./test/iscsi_tgt/reset/reset.sh run_test ./test/iscsi_tgt/rpc_config/rpc_config.sh run_test ./test/iscsi_tgt/idle_migration/idle_migration.sh run_test ./test/iscsi_tgt/lvol/iscsi_lvol.sh + +if [ $SPDK_TEST_NVML -eq 1 ]; then + run_test ./test/iscsi_tgt/pmem/iscsi_pmem.sh 4096 10 +fi + +if [ $RUN_NIGHTLY -eq 1 ] && [ $SPDK_TEST_NVML -eq 1 ]; then + run_test ./test/iscsi_tgt/pmem/iscsi_pmem.sh 131072 600 +fi + if [ $RUN_NIGHTLY -eq 1 ]; then run_test ./test/iscsi_tgt/ip_migration/ip_migration.sh fi diff --git a/test/iscsi_tgt/pmem/iscsi.conf b/test/iscsi_tgt/pmem/iscsi.conf new file mode 100644 index 000000000..fde6fbf6c --- /dev/null +++ b/test/iscsi_tgt/pmem/iscsi.conf @@ -0,0 +1,13 @@ +[Global] + +[iSCSI] + NodeBase "iqn.2016-06.io.spdk" + AuthFile /usr/local/etc/spdk/auth.conf + Timeout 30 + DiscoveryAuthMethod Auto + MaxSessions 16 + ImmediateData Yes + ErrorRecoveryLevel 0 + +[Rpc] + Enable Yes diff --git a/test/iscsi_tgt/pmem/iscsi_pmem.sh b/test/iscsi_tgt/pmem/iscsi_pmem.sh new file mode 100755 index 000000000..16045dde0 --- /dev/null +++ b/test/iscsi_tgt/pmem/iscsi_pmem.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +export TARGET_IP=127.0.0.1 +export INITIATOR_IP=127.0.0.1 + +testdir=$(readlink -f $(dirname $0)) +rootdir=$(readlink -f $testdir/../../..) +source $rootdir/scripts/autotest_common.sh +source $rootdir/test/iscsi_tgt/common.sh + +# iSCSI target configuration +BLOCKSIZE=$1 +RUNTIME=$2 +PMEM_BDEVS="" +PORT=3260 +RPC_PORT=5260 +INITIATOR_TAG=2 +INITIATOR_NAME=ALL +NETMASK=$INITIATOR_IP/32 +PMEM_SIZE=128 +PMEM_BLOCK_SIZE=512 +TGT_NR=10 +PMEM_PER_TGT=1 +rpc_py="python $rootdir/scripts/rpc.py" +fio_py="python $rootdir/scripts/fio.py" + +timing_enter iscsi_pmem + +timing_enter start_iscsi_target +$ISCSI_APP -c $testdir/iscsi.conf -m $ISCSI_TEST_CORE_MASK & +pid=$! +echo "Process pid: $pid" + +trap "iscsicleanup; killprocess $pid; rm -f /tmp/pool_file*; exit 1" SIGINT SIGTERM EXIT + +waitforlisten $pid ${RPC_PORT} +echo "iscsi_tgt is listening. Running tests..." +timing_exit start_iscsi_target + +timing_enter setup +$rpc_py add_portal_group 1 $TARGET_IP:$PORT +for i in `seq 1 $TGT_NR`; do + INITIATOR_TAG=$((i+1)) + $rpc_py add_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK + + luns="" + for j in `seq 1 $PMEM_PER_TGT`; do + $rpc_py create_pmem_pool /tmp/pool_file${i}_${j} $PMEM_SIZE $PMEM_BLOCK_SIZE + bdevs_name="$($rpc_py construct_pmem_bdev /tmp/pool_file${i}_${j})" + PMEM_BDEVS+="$bdevs_name " + luns+="$bdevs_name:$((j-1)) " + done + $rpc_py construct_target_node Target$i Target${i}_alias "$luns" "1:$INITIATOR_TAG " 256 1 0 0 0 +done +timing_exit setup +sleep 1 + +timing_enter discovery +iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$PORT +iscsiadm -m node --login -p $TARGET_IP:$PORT +timing_exit discovery + +timing_enter fio_test +$fio_py $BLOCKSIZE 64 randwrite $RUNTIME verify +timing_exit fio_test + +iscsicleanup + +for pmem in $PMEM_BDEVS; do + $rpc_py delete_bdev $pmem +done + +for i in `seq 1 $TGT_NR`; do + for c in `seq 1 $PMEM_PER_TGT`; do + $rpc_py delete_pmem_pool /tmp/pool_file${i}_${c} + done +done + +trap - SIGINT SIGTERM EXIT + +rm -f ./local-job* +rm -f /tmp/pool_file* +killprocess $pid +timing_exit iscsi_pmem diff --git a/test/iscsi_tgt/test_plan.md b/test/iscsi_tgt/test_plan.md new file mode 100644 index 000000000..4afad1621 --- /dev/null +++ b/test/iscsi_tgt/test_plan.md @@ -0,0 +1,41 @@ +# SPDK iscsi_tgt test plan + +## Objective +The purpose of these tests is to verify correct behavior of SPDK iSCSI target +feature. +These tests are run either per-commit or as nightly tests. + +## Configuration +All tests share the same basic configuration file for SPDK iscsi_tgt to run. +Static configuration from config file consists of setting number of per session +queues and enabling RPC for further configuration via RPC calls. +RPC calls used for dynamic configuration consist: +- creating Malloc backend devices +- creating Null Block backend devices +- creating Pmem backend devices +- constructing iSCSI subsystems +- deleting iSCSI subsystems + +### Tests + +#### Test 1: iSCSI namespace on a Pmem device +This test configures a SPDK iSCSI subsystem backed by pmem +devices and uses FIO to generate I/Os that target those subsystems. +Test steps: +- Step 1: Start SPDK iscsi_tgt application. +- Step 2: Create 10 pmem pools. +- Step 3: Create pmem bdevs on pmem pools. +- Step 4: Create iSCSI subsystems with 10 pmem bdevs namespaces. +- Step 5: Connect to iSCSI susbsystems with kernel initiator. +- Step 6: Run FIO with workload parameters: blocksize=4096, iodepth=64, + workload=randwrite; varify flag is enabled so that + FIO reads and verifies the data written to the pmem device. + The run time is 10 seconds for a quick test an 10 minutes + for longer nightly test. +- Step 7: Run FIO with workload parameters: blocksize=128kB, iodepth=4, + workload=randwrite; varify flag is enabled so that + FIO reads and verifies the data written to the pmem device. + The run time is 10 seconds for a quick test an 10 minutes + for longer nightly test. +- Step 8: Disconnect kernel initiator from iSCSI subsystems. +- Step 9: Delete iSCSI subsystems from configuration.