Docs/RCU: Correct sample code of qatomic_rcu_set
[qemu/ar7.git] / tests / qemu-iotests / 091
blob8dee168bf697e978f2951161a8e95f2394434d2e
1 #!/usr/bin/env bash
3 # Live migration test
5 # Performs a migration from one VM to another via monitor commands
7 # Copyright (C) 2014 Red Hat, Inc.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 # creator
24 owner=jcody@redhat.com
26 seq=`basename $0`
27 echo "QA output created by $seq"
29 status=1 # failure is the default!
31 MIG_FIFO="${TEST_DIR}/migrate"
33 _cleanup()
35 rm -f "${MIG_FIFO}"
36 _cleanup_qemu
37 _cleanup_test_img
39 trap "_cleanup; exit \$status" 0 1 2 3 15
41 # get standard environment, filters and checks
42 . ./common.rc
43 . ./common.filter
44 . ./common.qemu
46 _supported_fmt qcow2
47 _supported_proto file fuse
48 _supported_os Linux
49 _supported_cache_modes writethrough none writeback
50 _default_cache_mode none writeback
52 size=1G
54 _make_test_img $size
56 mkfifo "${MIG_FIFO}"
58 echo
59 echo === Starting QEMU VM1 ===
60 echo
62 qemu_comm_method="monitor"
63 _launch_qemu -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=${AIOMODE},id=disk
64 h1=$QEMU_HANDLE
66 echo
67 echo === Starting QEMU VM2 ===
68 echo
69 _launch_qemu -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=${AIOMODE},id=disk \
70 -incoming "exec: cat '${MIG_FIFO}'"
71 h2=$QEMU_HANDLE
73 echo
74 echo === VM 1: Migrate from VM1 to VM2 ===
75 echo
77 silent=yes
78 _send_qemu_cmd $h1 'qemu-io disk "write -P 0x22 0 4M"' "(qemu)"
79 echo "vm1: qemu-io disk write complete"
80 _send_qemu_cmd $h1 "migrate \"exec: cat > '${MIG_FIFO}'\"" "(qemu)"
81 echo "vm1: live migration started"
82 qemu_cmd_repeat=20 _send_qemu_cmd $h1 "info migrate" "completed"
83 echo "vm1: live migration completed"
85 echo
86 echo === VM 2: Post-migration, write to disk, verify running ===
87 echo
89 _send_qemu_cmd $h2 'qemu-io disk "write 4M 1M"' "(qemu)"
90 echo "vm2: qemu-io disk write complete"
91 qemu_cmd_repeat=20 _send_qemu_cmd $h2 "info status" "running"
92 echo "vm2: qemu process running successfully"
94 echo "vm2: flush io, and quit"
95 _send_qemu_cmd $h2 'qemu-io disk flush' "(qemu)"
96 _send_qemu_cmd $h2 'quit' ""
97 _send_qemu_cmd $h1 'quit' ""
99 wait=yes _cleanup_qemu >/dev/null
101 echo "Check image pattern"
102 ${QEMU_IO} -c "read -P 0x22 0 4M" "${TEST_IMG}" | _filter_testdir | _filter_qemu_io
104 echo "Running 'qemu-img check -r all \$TEST_IMG'"
105 _check_test_img -r all
107 echo "*** done"
108 rm -f $seq.full
109 status=0