test/iscsi: enable iso testing.

This paradigm has made it so much easier to test NVMe-oF locally. Extend
it to the iscsi tests as much as possible.

There are a few exceptions to the rule right now. Namely, the calsoft,
perf, pmem, and rpc tests which need to be slightly refactored before
they are ready for isolation running.

Change-Id: I3e92bd340c6a499dc77a56eb67bc7b074604746c
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453476
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2019-05-06 15:46:30 -07:00 committed by Jim Harris
parent 743081c22b
commit 03b9841dd9
16 changed files with 126 additions and 24 deletions

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
timing_enter bdev_io_wait
MALLOC_BDEV_SIZE=64
@ -17,7 +21,7 @@ timing_enter start_iscsi_tgt
$ISCSI_APP -m 0x2 -p 1 -s 512 --wait-for-rpc &
pid=$!
echo "iSCSI target launched. pid: $pid"
trap "killprocess $pid;exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py set_iscsi_options -o 30 -a 4
# Minimal number of bdev io pool (5) and cache (1)
@ -36,7 +40,7 @@ $rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE
# "-d" ==> disable CHAP authentication
$rpc_py construct_target_node disk1 disk1_alias 'Malloc0:0' $PORTAL_TAG:$INITIATOR_TAG 256 -d
sleep 1
trap "killprocess $pid; rm -f $testdir/bdev.conf; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; rm -f $testdir/bdev.conf; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
# Prepare config file for iSCSI initiator
echo "[iSCSI_Initiator]" > $testdir/bdev.conf
@ -51,5 +55,6 @@ trap - SIGINT SIGTERM EXIT
killprocess $pid
iscsitestfini $1 $2
report_test_completion "bdev_io_wait"
timing_exit bdev_io_wait

View File

@ -51,3 +51,27 @@ function cleanup_veth_interfaces() {
ip link delete $INITIATOR_INTERFACE
ip netns del $TARGET_NAMESPACE
}
function iscsitestinit() {
if [ "$1" == "iso" ]; then
$rootdir/scripts/setup.sh
if [ ! -z "$2" ]; then
create_veth_interfaces $2
else
# default to posix
create_veth_interfaces "posix"
fi
fi
}
function iscsitestfini() {
if [ "$1" == "iso" ]; then
if [ ! -z "$2" ]; then
cleanup_veth_interfaces $2
else
# default to posix
cleanup_veth_interfaces "posix"
fi
$rootdir/scripts/setup.sh reset
fi
}

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
function node_login_fio_logout() {
for arg in "$@"; do
iscsiadm -m node -p $TARGET_IP:$ISCSI_PORT -o update -n node.conn[0].iscsi.$arg
@ -67,7 +71,7 @@ $ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$!
echo "Process pid: $pid"
trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py set_iscsi_options -o 30 -a 16
@ -101,4 +105,5 @@ trap - SIGINT SIGTERM EXIT
iscsicleanup
killprocess $pid
iscsitestfini $1 $2
timing_exit digests

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
timing_enter ext4test
rpc_py="$rootdir/scripts/rpc.py"
@ -16,7 +20,7 @@ $ISCSI_APP --wait-for-rpc &
pid=$!
echo "Process pid: $pid"
trap "$rpc_py destruct_split_vbdev Name0n1 || true; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "$rpc_py destruct_split_vbdev Name0n1 || true; killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py set_iscsi_options -o 30 -a 4 -b $node_base
@ -40,7 +44,7 @@ iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
trap 'for new_dir in `dir -d /mnt/*dir`; do umount $new_dir; rm -rf $new_dir; done; \
iscsicleanup; killprocess $pid; exit 1' SIGINT SIGTERM EXIT
iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT
sleep 1
@ -121,5 +125,6 @@ if [ -z "$NO_NVME" ]; then
fi
killprocess $pid
iscsitestfini $1 $2
report_test_completion "nightly_iscsi_ext4test"
timing_exit ext4test

View File

@ -6,6 +6,10 @@ source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
source $rootdir/scripts/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
timing_enter filesystem
rpc_py="$rootdir/scripts/rpc.py"
@ -29,7 +33,7 @@ $ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$!
echo "Process pid: $pid"
trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py set_iscsi_options -o 30 -a 16
@ -61,7 +65,7 @@ sleep 1
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
trap "remove_backends; umount /mnt/device; rm -rf /mnt/device; iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "remove_backends; umount /mnt/device; rm -rf /mnt/device; iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
sleep 1
@ -133,4 +137,5 @@ trap - SIGINT SIGTERM EXIT
iscsicleanup
remove_backends
killprocess $pid
iscsitestfini $1 $2
timing_exit filesystem

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
delete_tmp_files() {
rm -f $testdir/iscsi2.json
rm -f ./local-job0-0-verify.state
@ -89,7 +93,7 @@ sleep 1
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
trap "iscsicleanup; killprocess $pid; delete_tmp_files; exit 1" SIGINT SIGTERM EXIT
trap "iscsicleanup; killprocess $pid; iscsitestfini $1 $2; delete_tmp_files; exit 1" SIGINT SIGTERM EXIT
sleep 1
$fio_py iscsi 4096 1 randrw 1 1 verify
@ -139,4 +143,6 @@ trap - SIGINT SIGTERM EXIT
killprocess $pid
iscsitestfini $1 $2
timing_exit fio

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
timing_enter initiator
MALLOC_BDEV_SIZE=64
@ -34,7 +38,7 @@ $rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE
# "-d" ==> disable CHAP authentication
$rpc_py construct_target_node disk1 disk1_alias 'Malloc0:0' $PORTAL_TAG:$INITIATOR_TAG 256 -d
sleep 1
trap "killprocess $pid; rm -f $testdir/bdev.conf; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; rm -f $testdir/bdev.conf; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
# Prepare config file for iSCSI initiator
echo "[iSCSI_Initiator]" > $testdir/bdev.conf
@ -51,5 +55,6 @@ trap - SIGINT SIGTERM EXIT
killprocess $pid
iscsitestfini $1 $2
report_test_completion "iscsi_initiator"
timing_exit initiator

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
rpc_py="$rootdir/scripts/rpc.py"
fio_py="$rootdir/scripts/fio.py"
@ -57,7 +61,7 @@ for ((i = 0; i < 2; i++)); do
timing_exit start_iscsi_tgt_$i
rpc_config $rpc_addr $NETMASK
trap "kill_all_iscsi_target; exit 1" \
trap "kill_all_iscsi_target; iscsitestfini $1 $2; exit 1" \
SIGINT SIGTERM EXIT
done
@ -87,5 +91,6 @@ trap - SIGINT SIGTERM EXIT
iscsicleanup
$rpc_py -s $rpc_second_addr kill_instance SIGTERM
iscsitestfini $1 $2
report_test_completion "iscsi_ip_migration"
timing_exit ip_migration

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
timing_enter iscsi_lvol
MALLOC_BDEV_SIZE=128
@ -26,7 +30,7 @@ $ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$!
echo "Process pid: $pid"
trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py set_iscsi_options -o 30 -a 16
@ -79,4 +83,5 @@ trap - SIGINT SIGTERM EXIT
rm -f ./local-job*
iscsicleanup
killprocess $pid
iscsitestfini $1 $2
timing_exit iscsi_lvol

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
rpc_py="$rootdir/scripts/rpc.py"
fio_py="$rootdir/scripts/fio.py"
@ -37,7 +41,7 @@ timing_enter start_iscsi_tgt
$ISCSI_APP --wait-for-rpc &
iscsipid=$!
echo "iSCSI target launched. pid: $iscsipid"
trap "remove_backends; iscsicleanup; killprocess $iscsipid; exit 1" SIGINT SIGTERM EXIT
trap "remove_backends; iscsicleanup; killprocess $iscsipid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $iscsipid
$rpc_py set_iscsi_options -o 30 -a 128
@ -80,4 +84,5 @@ rm -f ./local-job*
iscsicleanup
remove_backends
killprocess $iscsipid
iscsitestfini $1 $2
timing_exit multiconnection

View File

@ -8,6 +8,11 @@ source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
nvmftestinit $1
iscsitestinit $1 $2
RDMA_IP_LIST=$(get_available_rdma_ips)
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
if [ -z $NVMF_FIRST_TARGET_IP ]; then
@ -33,7 +38,7 @@ function run_nvme_remote() {
$ISCSI_APP -r "$iscsi_rpc_addr" -m 0x1 -p 0 -s 512 --wait-for-rpc &
iscsipid=$!
echo "iSCSI target launched. pid: $iscsipid"
trap "killprocess $iscsipid; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $iscsipid; killprocess $nvmfpid; iscsitestfini $1 $2; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
waitforlisten $iscsipid "$iscsi_rpc_addr"
$rpc_py -s "$iscsi_rpc_addr" set_iscsi_options -o 30 -a 16
$rpc_py -s "$iscsi_rpc_addr" start_subsystem_init
@ -66,7 +71,7 @@ NVMF_APP="$rootdir/app/nvmf_tgt/nvmf_tgt"
$NVMF_APP -m 0x2 -p 1 -s 512 --wait-for-rpc &
nvmfpid=$!
echo "NVMf target launched. pid: $nvmfpid"
trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $nvmfpid; iscsitestfini $1 $2; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
waitforlisten $nvmfpid
$rpc_py start_subsystem_init
$rpc_py nvmf_create_transport -t RDMA -u 8192 -p 4
@ -84,7 +89,7 @@ timing_enter start_iscsi_tgt
run_nvme_remote "local"
trap "iscsicleanup; killprocess $iscsipid; killprocess $nvmfpid; \
rm -f ./local-job0-0-verify.state; exit 1" SIGINT SIGTERM EXIT
rm -f ./local-job0-0-verify.state; iscsitestfini $1 $2; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
sleep 1
echo "Running FIO"
@ -108,4 +113,6 @@ $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
killprocess $nvmfpid
report_test_completion "iscsi_nvme_remote"
iscsitestfini $1 $2
nvmftestfini $1
timing_exit nvme_remote

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
function check_qos_works_well() {
local enable_limit=$1
local qos_limit=$2
@ -80,7 +84,7 @@ timing_enter start_iscsi_tgt
$ISCSI_APP &
pid=$!
echo "Process pid: $pid"
trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
echo "iscsi_tgt is listening. Running tests..."
@ -99,7 +103,7 @@ sleep 1
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
# Check whether to enable the QoS testing.
check_qos_works_well false $IOPS_LIMIT Malloc0 true
@ -140,4 +144,5 @@ rm -f ./local-job0-0-verify.state
trap - SIGINT SIGTERM EXIT
killprocess $pid
iscsitestfini $1 $2
timing_exit qos

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
if ! hash ceph; then
echo "Ceph not detected on this system; skipping RBD tests"
exit 0
@ -25,7 +29,7 @@ timing_enter start_iscsi_tgt
$ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$!
trap "killprocess $pid; rbd_cleanup; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; rbd_cleanup; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py set_iscsi_options -o 30 -a 16
@ -63,5 +67,6 @@ $rpc_py delete_rbd_bdev $rbd_bdev
killprocess $pid
rbd_cleanup
iscsitestfini $1 $2
report_test_completion "iscsi_rbd"
timing_exit rbd

View File

@ -7,6 +7,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
timing_enter reset
MALLOC_BDEV_SIZE=64
@ -54,7 +58,7 @@ $fio_py iscsi 512 1 read 60 1 &
fiopid=$!
echo "FIO pid: $fiopid"
trap "iscsicleanup; killprocess $pid; killprocess $fiopid; exit 1" SIGINT SIGTERM EXIT
trap "iscsicleanup; killprocess $pid; killprocess $fiopid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
# Do 3 resets while making sure iscsi_tgt and fio are still running
for i in 1 2 3; do
@ -74,4 +78,5 @@ trap - SIGINT SIGTERM EXIT
iscsicleanup
killprocess $pid
iscsitestfini $1 $2
timing_exit reset

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
HELLO_SOCK_APP="$TARGET_NS_CMD $rootdir/examples/sock/hello_world/hello_sock"
SOCAT_APP="socat"
@ -16,7 +20,7 @@ echo "Testing client path"
# start echo server using socat
$SOCAT_APP tcp-l:$ISCSI_PORT,fork,bind=$INITIATOR_IP exec:'/bin/cat' & server_pid=$!
trap "killprocess $server_pid;exit 1" SIGINT SIGTERM EXIT
trap "killprocess $server_pid;iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $server_pid $INITIATOR_IP:$ISCSI_PORT
@ -43,7 +47,7 @@ timing_enter sock_server
# start echo server using hello_sock echo server
$HELLO_SOCK_APP -H $TARGET_IP -P $ISCSI_PORT -S & server_pid=$!
trap "killprocess $server_pid;exit 1" SIGINT SIGTERM EXIT
trap "killprocess $server_pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $server_pid
# send message to server using socat
@ -58,5 +62,6 @@ trap - SIGINT SIGTERM EXIT
killprocess $server_pid
iscsitestfini $1 $2
report_test_completion "sock_server"
timing_exit sock_server

View File

@ -5,6 +5,10 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
TRACE_TMP_FOLDER=./tmp-trace
TRACE_RECORD_OUTPUT=${TRACE_TMP_FOLDER}/record.trace
TRACE_RECORD_NOTICE_LOG=${TRACE_TMP_FOLDER}/record.notice
@ -40,7 +44,7 @@ $ISCSI_APP -m 0xf --num-trace-entries $NUM_TRACE_ENTRIES --tpoint-group-mask 0xf
iscsi_pid=$!
echo "Process pid: $iscsi_pid"
trap "killprocess $iscsi_pid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $iscsi_pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $iscsi_pid
@ -68,7 +72,7 @@ mkdir -p ${TRACE_TMP_FOLDER}
record_pid=$!
echo "Trace record pid: $record_pid"
trap "iscsicleanup; killprocess $iscsi_pid; killprocess $record_pid; delete_tmp_files; exit 1" SIGINT SIGTERM EXIT
trap "iscsicleanup; killprocess $iscsi_pid; killprocess $record_pid; delete_tmp_files; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
echo "Running FIO"
$fio_py iscsi 131072 32 randrw 1 1
@ -80,7 +84,7 @@ for i in $(seq 0 $CONNECTION_NUMBER); do
$rpc_py delete_malloc_bdev Malloc${i}
done
trap "delete_tmp_files; exit 1" SIGINT SIGTERM EXIT
trap "delete_tmp_files; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
killprocess $iscsi_pid
killprocess $record_pid
@ -124,4 +128,5 @@ fi
done
trap - SIGINT SIGTERM EXIT
iscsitestfini $1 $2
timing_exit trace_record