]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/test/iscsi_tgt/rpc_config/rpc_config.sh
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / test / iscsi_tgt / rpc_config / rpc_config.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 # $1 = test type posix or vpp.
9 # $2 = "iso" - triggers isolation mode (setting up required environment).
10 iscsitestinit $2 $1
11
12 if [ "$1" == "posix" ] || [ "$1" == "vpp" ]; then
13 TEST_TYPE=$1
14 else
15 echo "No iSCSI test type specified"
16 exit 1
17 fi
18
19 MALLOC_BDEV_SIZE=64
20
21 rpc_py=$rootdir/scripts/rpc.py
22 rpc_config_py="$testdir/rpc_config.py"
23
24 timing_enter start_iscsi_tgt
25
26 "${ISCSI_APP[@]}" --wait-for-rpc &
27 pid=$!
28 echo "Process pid: $pid"
29
30 trap 'killprocess $pid; exit 1' SIGINT SIGTERM EXIT
31
32 waitforlisten $pid
33 $rpc_py framework_wait_init &
34 rpc_wait_pid=$!
35 $rpc_py iscsi_set_options -o 30 -a 16
36
37 # RPC framework_wait_init should be blocked, so its process must be existed
38 ps $rpc_wait_pid
39
40 $rpc_py framework_start_init
41 echo "iscsi_tgt is listening. Running tests..."
42
43 # RPC framework_wait_init should be already returned, so its process must be non-existed
44 ! ps $rpc_wait_pid
45
46 # RPC framework_wait_init will directly returned after subsystem initialized.
47 $rpc_py framework_wait_init &
48 rpc_wait_pid=$!
49 sleep 1
50 ! ps $rpc_wait_pid
51
52 timing_exit start_iscsi_tgt
53
54 $rpc_config_py $rpc_py $TARGET_IP $INITIATOR_IP $ISCSI_PORT $NETMASK $TARGET_NAMESPACE $TEST_TYPE
55
56 $rpc_py bdev_get_bdevs
57
58 trap - SIGINT SIGTERM EXIT
59
60 iscsicleanup
61 killprocess $pid
62
63 iscsitestfini $2 $1