]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/test/iscsi_tgt/idle_migration/idle_migration.sh
bump version to 12.2.12-pve1
[ceph.git] / ceph / src / spdk / test / iscsi_tgt / idle_migration / idle_migration.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 [ -z "$TARGET_IP" ]; then
8 echo "TARGET_IP not defined in environment"
9 exit 1
10 fi
11
12 if [ -z "$INITIATOR_IP" ]; then
13 echo "INITIATOR_IP not defined in environment"
14 exit 1
15 fi
16
17 timing_enter idle_migration
18
19 # iSCSI target configuration
20 PORT=3260
21 RPC_PORT=5260
22
23 fio_py="python $rootdir/scripts/fio.py"
24
25 ./app/iscsi_tgt/iscsi_tgt -c $testdir/iscsi.conf &
26 pid=$!
27 echo "Process pid: $pid"
28
29 trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
30
31 waitforlisten $pid ${RPC_PORT}
32 echo "iscsi_tgt is listening. Running tests..."
33
34 $testdir/build_configuration.sh
35
36 sleep 1
37
38 iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$PORT
39 iscsiadm -m node --login -p $TARGET_IP:$PORT
40
41 trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
42
43 sleep 5
44
45 # verify that ids has connections in idle state
46 python $testdir/connection_status.py idle
47
48 # start fio in background - while it is running, verify that connections are active
49 $fio_py 4096 16 randrw 15 &
50 fiopid=$!
51 sleep 5
52 python $testdir/connection_status.py active
53 kill $fiopid
54 wait $fiopid || true
55 sleep 1
56
57 # verify again that ids has connections in idle state
58 python $testdir/connection_status.py idle
59
60 trap - SIGINT SIGTERM EXIT
61
62 iscsicleanup
63 killprocess $pid
64 timing_exit idle_migration