2017-09-12 06:36:30 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
2018-02-27 22:14:08 +00:00
|
|
|
source $rootdir/test/common/autotest_common.sh
|
2017-09-12 06:36:30 +00:00
|
|
|
source $rootdir/test/iscsi_tgt/common.sh
|
|
|
|
|
|
|
|
timing_enter iscsi_lvol
|
|
|
|
|
|
|
|
MALLOC_BDEV_SIZE=128
|
|
|
|
MALLOC_BLOCK_SIZE=512
|
2017-12-15 17:40:36 +00:00
|
|
|
if [ $RUN_NIGHTLY -eq 1 ]; then
|
2018-08-22 05:44:46 +00:00
|
|
|
NUM_LVS=10
|
2017-12-15 17:40:36 +00:00
|
|
|
NUM_LVOL=10
|
|
|
|
else
|
2018-08-22 05:44:46 +00:00
|
|
|
NUM_LVS=2
|
2017-12-15 17:40:36 +00:00
|
|
|
NUM_LVOL=2
|
|
|
|
fi
|
2017-09-12 06:36:30 +00:00
|
|
|
|
2018-09-11 13:26:14 +00:00
|
|
|
rpc_py="$rootdir/scripts/rpc.py"
|
|
|
|
fio_py="$rootdir/scripts/fio.py"
|
2017-09-12 06:36:30 +00:00
|
|
|
|
|
|
|
timing_enter start_iscsi_tgt
|
|
|
|
|
2018-08-10 10:20:25 +00:00
|
|
|
$ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
|
2017-09-12 06:36:30 +00:00
|
|
|
pid=$!
|
|
|
|
echo "Process pid: $pid"
|
|
|
|
|
|
|
|
trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
|
|
|
|
|
2017-11-09 23:33:29 +00:00
|
|
|
waitforlisten $pid
|
2018-07-12 19:26:27 +00:00
|
|
|
$rpc_py set_iscsi_options -o 30 -a 16
|
|
|
|
$rpc_py start_subsystem_init
|
2017-09-12 06:36:30 +00:00
|
|
|
echo "iscsi_tgt is listening. Running tests..."
|
|
|
|
|
|
|
|
timing_exit start_iscsi_tgt
|
|
|
|
|
2017-10-17 23:38:36 +00:00
|
|
|
timing_enter setup
|
2018-03-27 13:56:16 +00:00
|
|
|
$rpc_py add_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT
|
2018-08-22 05:44:46 +00:00
|
|
|
# Create the first LVS from a Raid-0 bdev, which is created from two malloc bdevs
|
|
|
|
# Create remaining LVSs from a malloc bdev, respectively
|
|
|
|
for i in $(seq 1 $NUM_LVS); do
|
2018-04-18 08:36:46 +00:00
|
|
|
INITIATOR_TAG=$((i + 2))
|
|
|
|
$rpc_py add_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
|
2018-08-22 05:44:46 +00:00
|
|
|
if [ $i -eq 1 ]; then
|
|
|
|
# construct RAID bdev and put its name in $bdev
|
|
|
|
malloc_bdevs="$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE) "
|
|
|
|
malloc_bdevs+="$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"
|
|
|
|
$rpc_py construct_raid_bdev -n raid0 -s 64 -r 0 -b "$malloc_bdevs"
|
|
|
|
bdev="raid0"
|
|
|
|
else
|
|
|
|
# construct malloc bdev and put its name in $bdev
|
|
|
|
bdev=$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)
|
|
|
|
fi
|
2018-04-18 08:36:46 +00:00
|
|
|
ls_guid=$($rpc_py construct_lvol_store $bdev lvs_$i -c 1048576)
|
|
|
|
LUNs=""
|
|
|
|
for j in $(seq 1 $NUM_LVOL); do
|
|
|
|
lb_name=$($rpc_py construct_lvol_bdev -u $ls_guid lbd_$j 10)
|
|
|
|
LUNs+="$lb_name:$((j - 1)) "
|
|
|
|
done
|
|
|
|
$rpc_py construct_target_node Target$i Target${i}_alias "$LUNs" "1:$INITIATOR_TAG" 256 -d
|
2017-09-12 06:36:30 +00:00
|
|
|
done
|
2017-10-17 23:38:36 +00:00
|
|
|
timing_exit setup
|
|
|
|
|
2017-09-12 06:36:30 +00:00
|
|
|
sleep 1
|
|
|
|
|
2017-10-17 23:38:36 +00:00
|
|
|
timing_enter discovery
|
2018-03-27 13:39:38 +00:00
|
|
|
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
|
|
|
|
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
|
2017-10-17 23:38:36 +00:00
|
|
|
timing_exit discovery
|
2017-09-12 06:36:30 +00:00
|
|
|
|
2017-10-17 23:38:36 +00:00
|
|
|
timing_enter fio
|
2017-10-06 06:58:42 +00:00
|
|
|
$fio_py 131072 8 randwrite 10 verify
|
2017-10-17 23:38:36 +00:00
|
|
|
timing_exit fio
|
2017-09-12 06:36:30 +00:00
|
|
|
|
|
|
|
rm -f ./local-job0-0-verify.state
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
|
|
|
rm -f ./local-job*
|
|
|
|
iscsicleanup
|
|
|
|
killprocess $pid
|
|
|
|
timing_exit iscsi_lvol
|