3 testdir
=$
(readlink
-f $
(dirname $0))
4 rootdir
=$
(readlink
-f $testdir/..
/..
/..
)
5 source $rootdir/scripts
/autotest_common.sh
7 if [ ! -d $CEPH_DIR ]; then
8 echo "Ceph directory not detected on this system; skipping RBD tests"
12 if [ -z "$TARGET_IP" ]; then
13 echo "TARGET_IP not defined in environment"
17 if [ -z "$INITIATOR_IP" ]; then
18 echo "INITIATOR_IP not defined in environment"
24 # iSCSI target configuration
29 NETMASK
=$INITIATOR_IP/32
31 rpc_py
="python $rootdir/scripts/rpc.py"
32 fio_py
="python $rootdir/scripts/fio.py"
34 $rootdir/app
/iscsi_tgt
/iscsi_tgt
-c $testdir/iscsi.conf
&
37 trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
39 waitforlisten
$pid ${RPC_PORT}
40 echo "iscsi_tgt is listening. Running tests..."
42 $rpc_py add_portal_group
1 $TARGET_IP:$PORT
43 $rpc_py add_initiator_group
$INITIATOR_TAG $INITIATOR_NAME $NETMASK
44 $rpc_py construct_rbd_bdev
$RBD_POOL $RBD_NAME 4096
45 # "Ceph0:0" ==> use Ceph0 blockdev for LUN0
46 # "1:2" ==> map PortalGroup1 to InitiatorGroup2
47 # "64" ==> iSCSI queue depth 64
48 # "1 0 0 0" ==> disable CHAP authentication
49 $rpc_py construct_target_node Target3 Target3_alias
'Ceph0:0' '1:2' 64 1 0 0 0
52 iscsiadm
-m discovery
-t sendtargets
-p $TARGET_IP:$PORT
53 iscsiadm
-m node
--login -p $TARGET_IP:$PORT
55 trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
58 $fio_py 4096 1 randrw
1 verify
59 $fio_py 131072 32 randrw
1 verify
61 rm -f .
/local-job0-0-verify.state
63 trap - SIGINT SIGTERM EXIT