]>
Commit | Line | Data |
---|---|---|
11fdf7f2 | 1 | #!/usr/bin/env bash |
11fdf7f2 | 2 | |
9f95a23c TL |
3 | testdir=$(readlink -f $(dirname $0)) |
4 | rootdir=$(readlink -f $testdir/../../..) | |
5 | source $rootdir/test/common/autotest_common.sh | |
6 | source $rootdir/test/vhost/common.sh | |
7 | source $rootdir/test/vhost/hotplug/common.sh | |
11fdf7f2 TL |
8 | |
9 | function prepare_fio_cmd_tc1() { | |
f67539c2 TL |
10 | print_test_fio_header |
11 | ||
12 | run_fio="$fio_bin --eta=never " | |
13 | for vm_num in $1; do | |
14 | cp $fio_job $tmp_attach_job | |
15 | vm_check_scsi_location $vm_num | |
16 | for disk in $SCSI_DISK; do | |
17 | echo "[nvme-host$disk]" >> $tmp_attach_job | |
18 | echo "filename=/dev/$disk" >> $tmp_attach_job | |
19 | done | |
20 | vm_scp $vm_num $tmp_attach_job 127.0.0.1:/root/default_integrity_discs.job | |
21 | run_fio+="--client=127.0.0.1,$(vm_fio_socket ${vm_num}) --remote-config /root/default_integrity_discs.job " | |
22 | rm $tmp_attach_job | |
23 | done | |
11fdf7f2 TL |
24 | } |
25 | ||
26 | # Check if fio test passes on device attached to first controller. | |
27 | function hotattach_tc1() { | |
f67539c2 | 28 | notice "Hotattach test case 1" |
11fdf7f2 | 29 | |
f67539c2 | 30 | $rpc_py vhost_scsi_controller_add_target naa.Nvme0n1p0.0 0 Nvme0n1p0 |
11fdf7f2 | 31 | |
f67539c2 TL |
32 | sleep 3 |
33 | prepare_fio_cmd_tc1 "0" | |
34 | $run_fio | |
35 | check_fio_retcode "Hotattach test case 1: Iteration 1." 0 $? | |
11fdf7f2 TL |
36 | } |
37 | ||
38 | # Run fio test for previously attached device. | |
39 | # During test attach another device to first controller and check fio status. | |
40 | function hotattach_tc2() { | |
f67539c2 TL |
41 | notice "Hotattach test case 2" |
42 | prepare_fio_cmd_tc1 "0" | |
43 | ||
44 | $run_fio & | |
45 | last_pid=$! | |
46 | sleep 3 | |
47 | $rpc_py vhost_scsi_controller_add_target naa.Nvme0n1p0.0 1 Nvme0n1p1 | |
48 | wait $last_pid | |
49 | check_fio_retcode "Hotattach test case 2: Iteration 1." 0 $? | |
11fdf7f2 TL |
50 | } |
51 | ||
52 | # Run fio test for previously attached devices. | |
53 | # During test attach another device to second controller and check fio status. | |
54 | function hotattach_tc3() { | |
f67539c2 TL |
55 | notice "Hotattach test case 3" |
56 | prepare_fio_cmd_tc1 "0" | |
57 | ||
58 | $run_fio & | |
59 | last_pid=$! | |
60 | sleep 3 | |
61 | $rpc_py vhost_scsi_controller_add_target naa.Nvme0n1p1.0 0 Nvme0n1p2 | |
62 | wait $last_pid | |
63 | check_fio_retcode "Hotattach test case 3: Iteration 1." 0 $? | |
11fdf7f2 TL |
64 | } |
65 | ||
66 | # Run fio test for previously attached devices. | |
67 | # During test attach another device to third controller(VM2) and check fio status. | |
68 | # At the end after rebooting VMs run fio test for all devices and check fio status. | |
69 | function hotattach_tc4() { | |
f67539c2 | 70 | notice "Hotattach test case 4" |
11fdf7f2 | 71 | |
f67539c2 | 72 | prepare_fio_cmd_tc1 "0" |
11fdf7f2 | 73 | |
f67539c2 TL |
74 | $run_fio & |
75 | last_pid=$! | |
76 | sleep 3 | |
77 | $rpc_py vhost_scsi_controller_add_target naa.Nvme0n1p2.1 0 Nvme0n1p3 | |
78 | wait $last_pid | |
79 | check_fio_retcode "Hotattach test case 4: Iteration 1." 0 $? | |
11fdf7f2 | 80 | |
f67539c2 TL |
81 | prepare_fio_cmd_tc1 "0 1" |
82 | $run_fio | |
83 | check_fio_retcode "Hotattach test case 4: Iteration 2." 0 $? | |
11fdf7f2 | 84 | |
f67539c2 | 85 | reboot_all_and_prepare "0 1" |
11fdf7f2 | 86 | |
f67539c2 TL |
87 | prepare_fio_cmd_tc1 "0 1" |
88 | $run_fio | |
89 | check_fio_retcode "Hotattach test case 4: Iteration 3." 0 $? | |
11fdf7f2 TL |
90 | } |
91 | ||
92 | function cleanup_after_tests() { | |
f67539c2 TL |
93 | $rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p0.0 0 |
94 | $rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p0.0 1 | |
95 | $rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p1.0 0 | |
96 | $rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p2.1 0 | |
11fdf7f2 TL |
97 | } |
98 | ||
99 | hotattach_tc1 | |
100 | hotattach_tc2 | |
101 | hotattach_tc3 | |
102 | hotattach_tc4 | |
103 | cleanup_after_tests |