2016-10-17 02:15:21 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
2017-04-04 23:20:16 +00:00
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
2018-02-27 22:14:08 +00:00
|
|
|
source $rootdir/test/common/autotest_common.sh
|
2017-05-24 23:29:24 +00:00
|
|
|
source $rootdir/test/iscsi_tgt/common.sh
|
2016-10-17 02:15:21 +00:00
|
|
|
|
2020-08-11 10:36:11 +00:00
|
|
|
iscsitestinit
|
2019-05-06 22:46:30 +00:00
|
|
|
|
2018-04-16 13:12:23 +00:00
|
|
|
timing_enter rbd_setup
|
2018-04-25 16:16:08 +00:00
|
|
|
rbd_setup $TARGET_IP $TARGET_NAMESPACE
|
2019-08-09 08:46:01 +00:00
|
|
|
trap 'rbd_cleanup; exit 1' SIGINT SIGTERM EXIT
|
2018-04-16 13:12:23 +00:00
|
|
|
timing_exit rbd_setup
|
2016-10-17 02:15:21 +00:00
|
|
|
|
2021-04-29 13:29:46 +00:00
|
|
|
fio_py="$rootdir/scripts/fio-wrapper"
|
2016-10-17 02:15:21 +00:00
|
|
|
|
2017-05-25 20:06:51 +00:00
|
|
|
timing_enter start_iscsi_tgt
|
|
|
|
|
2020-02-20 10:24:53 +00:00
|
|
|
"${ISCSI_APP[@]}" -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
|
2016-10-17 02:15:21 +00:00
|
|
|
pid=$!
|
|
|
|
|
2020-08-11 10:36:11 +00:00
|
|
|
trap 'killprocess $pid; rbd_cleanup; iscsitestfini; exit 1' SIGINT SIGTERM EXIT
|
2016-10-17 02:15:21 +00:00
|
|
|
|
2017-11-09 23:33:29 +00:00
|
|
|
waitforlisten $pid
|
2019-09-11 11:15:34 +00:00
|
|
|
$rpc_py iscsi_set_options -o 30 -a 16
|
2019-09-11 13:30:14 +00:00
|
|
|
$rpc_py framework_start_init
|
2016-10-17 02:15:21 +00:00
|
|
|
echo "iscsi_tgt is listening. Running tests..."
|
|
|
|
|
2017-05-25 20:06:51 +00:00
|
|
|
timing_exit start_iscsi_tgt
|
|
|
|
|
2019-09-09 10:35:30 +00:00
|
|
|
$rpc_py iscsi_create_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT
|
2019-09-03 08:53:37 +00:00
|
|
|
$rpc_py iscsi_create_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
|
2022-01-14 14:31:26 +00:00
|
|
|
rbd_cluster_name="$($rpc_py bdev_rbd_register_cluster iscsi_rbd_cluster --key-file /etc/ceph/ceph.client.admin.keyring --config-file /etc/ceph/ceph.conf)"
|
2021-05-21 11:24:44 +00:00
|
|
|
$rpc_py bdev_rbd_get_clusters_info -b $rbd_cluster_name
|
2021-04-22 13:51:42 +00:00
|
|
|
rbd_bdev="$($rpc_py bdev_rbd_create $RBD_POOL $RBD_NAME 4096 -c $rbd_cluster_name)"
|
2019-09-11 09:29:55 +00:00
|
|
|
$rpc_py bdev_get_bdevs
|
2020-04-08 06:45:55 +00:00
|
|
|
|
|
|
|
$rpc_py bdev_rbd_resize $rbd_bdev 2000
|
2020-05-07 11:27:06 +00:00
|
|
|
num_block=$($rpc_py bdev_get_bdevs | grep num_blocks | sed 's/[^[:digit:]]//g')
|
2020-04-08 06:45:55 +00:00
|
|
|
# get the bdev size in MiB.
|
2020-05-07 11:27:06 +00:00
|
|
|
total_size=$((num_block * 4096 / 1048576))
|
|
|
|
if [ $total_size != 2000 ]; then
|
2020-04-08 06:45:55 +00:00
|
|
|
echo "resize failed."
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-10-17 02:15:21 +00:00
|
|
|
# "Ceph0:0" ==> use Ceph0 blockdev for LUN0
|
|
|
|
# "1:2" ==> map PortalGroup1 to InitiatorGroup2
|
|
|
|
# "64" ==> iSCSI queue depth 64
|
2018-03-12 04:41:21 +00:00
|
|
|
# "-d" ==> disable CHAP authentication
|
2019-09-05 10:35:18 +00:00
|
|
|
$rpc_py iscsi_create_target_node Target3 Target3_alias 'Ceph0:0' $PORTAL_TAG:$INITIATOR_TAG 64 -d
|
2016-10-17 02:15:21 +00:00
|
|
|
sleep 1
|
|
|
|
|
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
|
2020-03-12 15:03:39 +00:00
|
|
|
waitforiscsidevices 1
|
2016-10-17 02:15:21 +00:00
|
|
|
|
2019-08-09 08:46:01 +00:00
|
|
|
trap 'iscsicleanup; killprocess $pid; rbd_cleanup; exit 1' SIGINT SIGTERM EXIT
|
2016-10-17 02:15:21 +00:00
|
|
|
|
2019-05-24 22:58:19 +00:00
|
|
|
$fio_py -p iscsi -i 4096 -d 1 -t randrw -r 1 -v
|
|
|
|
$fio_py -p iscsi -i 131072 -d 32 -t randrw -r 1 -v
|
2016-10-17 02:15:21 +00:00
|
|
|
|
|
|
|
rm -f ./local-job0-0-verify.state
|
|
|
|
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
|
|
|
iscsicleanup
|
2019-09-11 08:00:10 +00:00
|
|
|
$rpc_py bdev_rbd_delete $rbd_bdev
|
2021-04-22 13:51:42 +00:00
|
|
|
$rpc_py bdev_rbd_unregister_cluster $rbd_cluster_name
|
2016-10-17 02:15:21 +00:00
|
|
|
killprocess $pid
|
2018-04-16 13:12:23 +00:00
|
|
|
rbd_cleanup
|
2016-10-17 02:15:21 +00:00
|
|
|
|
2020-08-11 10:36:11 +00:00
|
|
|
iscsitestfini
|