]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/test/iscsi_tgt/bdev_io_wait/bdev_io_wait.sh
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / spdk / test / iscsi_tgt / bdev_io_wait / bdev_io_wait.sh
1 #!/usr/bin/env bash
2
3 testdir=$(readlink -f $(dirname $0))
4 rootdir=$(readlink -f $testdir/../../..)
5 source $rootdir/test/common/autotest_common.sh
6 source $rootdir/test/iscsi_tgt/common.sh
7
8 timing_enter bdev_io_wait
9
10 MALLOC_BDEV_SIZE=64
11 MALLOC_BLOCK_SIZE=512
12
13 rpc_py="$rootdir/scripts/rpc.py"
14
15 timing_enter start_iscsi_tgt
16
17 # Start the iSCSI target without using stub
18 # Reason: Two SPDK processes will be started
19 $ISCSI_APP -m 0x2 -p 1 -s 512 --wait-for-rpc &
20 pid=$!
21 echo "iSCSI target launched. pid: $pid"
22 trap "killprocess $pid;exit 1" SIGINT SIGTERM EXIT
23 waitforlisten $pid
24 $rpc_py set_iscsi_options -o 30 -a 4
25 # Minimal number of bdev io pool (5) and cache (1)
26 $rpc_py set_bdev_options -p 5 -c 1
27 $rpc_py start_subsystem_init
28 echo "iscsi_tgt is listening. Running tests..."
29
30 timing_exit start_iscsi_tgt
31
32 $rpc_py add_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT
33 $rpc_py add_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
34 $rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE
35 # "Malloc0:0" ==> use Malloc0 blockdev for LUN0
36 # "1:2" ==> map PortalGroup1 to InitiatorGroup2
37 # "64" ==> iSCSI queue depth 64
38 # "-d" ==> disable CHAP authentication
39 $rpc_py construct_target_node disk1 disk1_alias 'Malloc0:0' $PORTAL_TAG:$INITIATOR_TAG 256 -d
40 sleep 1
41 trap "killprocess $pid; rm -f $testdir/bdev.conf; exit 1" SIGINT SIGTERM EXIT
42
43 # Prepare config file for iSCSI initiator
44 echo "[iSCSI_Initiator]" > $testdir/bdev.conf
45 echo " URL iscsi://$TARGET_IP/iqn.2016-06.io.spdk:disk1/0 iSCSI0" >> $testdir/bdev.conf
46 $rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdev.conf -q 128 -o 4096 -w write -t 1
47 $rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdev.conf -q 128 -o 4096 -w read -t 1
48 $rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdev.conf -q 128 -o 4096 -w flush -t 1
49 $rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdev.conf -q 128 -o 4096 -w unmap -t 1
50 rm -f $testdir/bdev.conf
51
52 trap - SIGINT SIGTERM EXIT
53
54 killprocess $pid
55
56 report_test_completion "bdev_io_wait"
57 timing_exit bdev_io_wait