2 # group: rw migration quick
4 # Test savevm and loadvm after live migration with postcopy flag
6 # Copyright (C) 2017, IBM Corporation.
8 # This file is derived from tests/qemu-iotests/181 by Kevin Wolf
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 echo "QA output created by $seq"
26 status=1 # failure is the default!
28 MIG_SOCKET="${SOCK_DIR}/migrate"
30 # get standard environment, filters and checks
41 trap "_cleanup; exit \$status" 0 1 2 3 15
44 _supported_proto generic
47 # Internal snapshots are (currently) impossible with refcount_bits=1,
48 # and generally impossible with external data files
49 _unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
55 echo === Starting VMs ===
58 qemu_comm_method="monitor"
60 if [ "$IMGOPTSSYNTAX" = "true" ]; then
62 -drive "${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,id=disk
65 -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,driver=$IMGFMT,id=disk
69 if [ "$IMGOPTSSYNTAX" = "true" ]; then
71 -drive "${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,id=disk \
72 -incoming "unix:${MIG_SOCKET}"
75 -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,driver=$IMGFMT,id=disk \
76 -incoming "unix:${MIG_SOCKET}"
81 echo === Set \'migrate_set_capability postcopy-ram on\' and migrate ===
85 _send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)"
87 qemu_error_no_exit=yes success_or_failure=yes \
88 _send_qemu_cmd $dest '' "(qemu)" "Postcopy is not supported"
89 if [ ${QEMU_STATUS[$dest]} -lt 0 ]; then
90 _send_qemu_cmd $dest '' "(qemu)"
92 _send_qemu_cmd $src 'quit' ""
93 _send_qemu_cmd $dest 'quit' ""
96 _notrun 'Postcopy is not supported'
99 _send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)"
100 _send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)"
102 QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \
103 _send_qemu_cmd $src "info migrate" "completed\|failed"
104 silent=yes _send_qemu_cmd $src "" "(qemu)"
107 echo === Check if migration was successful ===
110 QEMU_COMM_TIMEOUT=1 silent=yes \
111 _send_qemu_cmd $src "info migrate" "completed"
112 silent=yes _send_qemu_cmd $src "" "(qemu)"
115 echo === On destination, execute savevm and loadvm ===
119 _send_qemu_cmd $dest 'savevm state1' "(qemu)"
120 _send_qemu_cmd $dest 'loadvm state1' "(qemu)"
123 echo === Shut down and check image ===
126 _send_qemu_cmd $src 'quit' ""
127 _send_qemu_cmd $dest 'quit' ""