test/iscsi: Add iscsi_tgt with lvol backend test

Test using multiple iscsi target nodes with LUNs backed by
logical volume bdevs

Change-Id: If87ed19dbef84fdc79d5758e063fc11d047e790e
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/378034
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Karol Latecki 2017-09-12 08:36:30 +02:00 committed by Daniel Verkamp
parent c783caabc7
commit 6264dfa956
3 changed files with 79 additions and 0 deletions

View File

@ -31,6 +31,7 @@ run_test ./test/iscsi_tgt/filesystem/filesystem.sh
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 [ $RUN_NIGHTLY -eq 1 ]; then
run_test ./test/iscsi_tgt/ip_migration/ip_migration.sh
fi

View File

@ -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

View File

@ -0,0 +1,65 @@
#!/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
timing_enter iscsi_lvol
# iSCSI target configuration
PORT=3260
RPC_PORT=5260
INITIATOR_TAG=2
INITIATOR_NAME=ALL
NETMASK=$INITIATOR_IP/32
MALLOC_BDEV_SIZE=128
MALLOC_BLOCK_SIZE=512
rpc_py="python $rootdir/scripts/rpc.py"
fio_py="python $rootdir/scripts/fio.py"
timing_enter start_iscsi_tgt
$ISCSI_APP -c $testdir/iscsi.conf -m $ISCSI_TEST_CORE_MASK &
pid=$!
echo "Process pid: $pid"
trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid ${RPC_PORT}
echo "iscsi_tgt is listening. Running tests..."
timing_exit start_iscsi_tgt
$rpc_py add_portal_group 1 $TARGET_IP:$PORT
for i in `seq 0 9`; do
INITIATOR_TAG=$((i+2))
$rpc_py add_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
bdev=$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)
ls_guid=$($rpc_py construct_lvol_store $bdev)
LUNs=""
for j in `seq 0 0`; do
lb_guid=$($rpc_py construct_lvol_bdev $ls_guid 10)
LUNs+="$lb_guid:$j "
done
sleep 0.1
$rpc_py construct_target_node Target$i Target${i}_alias "$LUNs" "1:$INITIATOR_TAG" 256 1 0 0 0
done
sleep 1
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$PORT
iscsiadm -m node --login -p $TARGET_IP:$PORT
$fio_py 1048576 64 randwrite 10 verify
rm -f ./local-job0-0-verify.state
trap - SIGINT SIGTERM EXIT
rm -f ./local-job*
iscsicleanup
killprocess $pid
timing_exit iscsi_lvol