Spdk/test/iscsi_tgt/lvol/iscsi_lvol.sh
Shuhei Matsumoto eee268fea8 iscsi: Replace "ALL" by "ANY" for access control
In the accessibility control of iSCSI target, "ALL" is used to allow
ANY IP address-port pair or iSCSI name of initiators. However iSCSI
targets cannot know ALL initiators beforehand.

Hence "ANY" will be better than "ALL" and will avoid misunderstanding.

Comments and iscsi_tgt test code are also changed and UT code is added.

Change-Id: Id004d819df6e9ee89f6c1db2e4b4c149be062733
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/385168
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-04 11:28:52 -05:00

71 lines
1.7 KiB
Bash
Executable File

#!/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
INITIATOR_TAG=2
INITIATOR_NAME=ANY
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
echo "iscsi_tgt is listening. Running tests..."
timing_exit start_iscsi_tgt
timing_enter setup
$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 lvs_$i -c 1048576)
LUNs=""
for j in `seq 0 9`; do
lb_name=$($rpc_py construct_lvol_bdev -u $ls_guid lbd_$j 10)
LUNs+="$lb_name:$j "
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
$fio_py 131072 8 randwrite 10 verify
timing_exit fio
rm -f ./local-job0-0-verify.state
trap - SIGINT SIGTERM EXIT
rm -f ./local-job*
iscsicleanup
killprocess $pid
timing_exit iscsi_lvol