]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/test/iscsi_tgt/rbd/rbd.sh
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / spdk / test / iscsi_tgt / rbd / rbd.sh
1 #!/usr/bin/env bash
2
3 testdir=$(readlink -f $(dirname $0))
4 rootdir=$(readlink -f $testdir/../../..)
5 source $rootdir/scripts/autotest_common.sh
6
7 if [ ! -d $CEPH_DIR ]; then
8 echo "Ceph directory not detected on this system; skipping RBD tests"
9 exit 0
10 fi
11
12 if [ -z "$TARGET_IP" ]; then
13 echo "TARGET_IP not defined in environment"
14 exit 1
15 fi
16
17 if [ -z "$INITIATOR_IP" ]; then
18 echo "INITIATOR_IP not defined in environment"
19 exit 1
20 fi
21
22 timing_enter rbd
23
24 # iSCSI target configuration
25 PORT=3260
26 RPC_PORT=5260
27 INITIATOR_TAG=2
28 INITIATOR_NAME=ALL
29 NETMASK=$INITIATOR_IP/32
30
31 rpc_py="python $rootdir/scripts/rpc.py"
32 fio_py="python $rootdir/scripts/fio.py"
33
34 $rootdir/app/iscsi_tgt/iscsi_tgt -c $testdir/iscsi.conf &
35 pid=$!
36
37 trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
38
39 waitforlisten $pid ${RPC_PORT}
40 echo "iscsi_tgt is listening. Running tests..."
41
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
50 sleep 1
51
52 iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$PORT
53 iscsiadm -m node --login -p $TARGET_IP:$PORT
54
55 trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
56
57 sleep 1
58 $fio_py 4096 1 randrw 1 verify
59 $fio_py 131072 32 randrw 1 verify
60
61 rm -f ./local-job0-0-verify.state
62
63 trap - SIGINT SIGTERM EXIT
64
65 iscsicleanup
66 killprocess $pid
67
68 timing_exit rbd