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
|
|
|
|
2017-08-09 00:21:24 +00:00
|
|
|
if ! hash ceph; then
|
|
|
|
echo "Ceph not detected on this system; skipping RBD tests"
|
2016-10-17 02:15:21 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
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
|
2018-04-16 13:12:23 +00:00
|
|
|
trap "rbd_cleanup; exit 1" SIGINT SIGTERM EXIT
|
|
|
|
timing_exit rbd_setup
|
2016-10-17 02:15:21 +00:00
|
|
|
|
2018-04-16 13:12:23 +00:00
|
|
|
timing_enter rbd
|
2016-10-17 02:15:21 +00:00
|
|
|
|
2018-09-11 13:26:14 +00:00
|
|
|
rpc_py="$rootdir/scripts/rpc.py"
|
|
|
|
fio_py="$rootdir/scripts/fio.py"
|
2016-10-17 02:15:21 +00:00
|
|
|
|
2017-05-25 20:06:51 +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 &
|
2016-10-17 02:15:21 +00:00
|
|
|
pid=$!
|
|
|
|
|
2018-04-16 13:12:23 +00:00
|
|
|
trap "killprocess $pid; rbd_cleanup; exit 1" SIGINT SIGTERM EXIT
|
2016-10-17 02:15:21 +00:00
|
|
|
|
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
|
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
|
|
|
|
|
2018-03-27 13:56:16 +00:00
|
|
|
$rpc_py add_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT
|
2016-10-17 02:15:21 +00:00
|
|
|
$rpc_py add_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
|
2018-06-22 11:51:35 +00:00
|
|
|
rbd_bdev="$($rpc_py construct_rbd_bdev $RBD_POOL $RBD_NAME 4096)"
|
2017-08-09 00:54:26 +00:00
|
|
|
$rpc_py get_bdevs
|
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
|
2018-03-28 13:13:58 +00:00
|
|
|
$rpc_py construct_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
|
2016-10-17 02:15:21 +00:00
|
|
|
|
2018-04-16 13:12:23 +00:00
|
|
|
trap "iscsicleanup; killprocess $pid; rbd_cleanup; exit 1" SIGINT SIGTERM EXIT
|
2016-10-17 02:15:21 +00:00
|
|
|
|
|
|
|
sleep 1
|
2019-04-22 18:37:52 +00:00
|
|
|
$fio_py iscsi 4096 1 randrw 1 1 verify
|
|
|
|
$fio_py iscsi 131072 32 randrw 1 1 verify
|
2016-10-17 02:15:21 +00:00
|
|
|
|
|
|
|
rm -f ./local-job0-0-verify.state
|
|
|
|
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
|
|
|
iscsicleanup
|
2018-06-22 11:51:35 +00:00
|
|
|
$rpc_py delete_rbd_bdev $rbd_bdev
|
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
|
|
|
|
2017-12-18 21:20:41 +00:00
|
|
|
report_test_completion "iscsi_rbd"
|
2016-10-17 02:15:21 +00:00
|
|
|
timing_exit rbd
|