3 # Test savevm and loadvm after live migration with postcopy flag
5 # Copyright (C) 2017, IBM Corporation.
7 # This file is derived from tests/qemu-iotests/181 by Kevin Wolf
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 echo "QA output created by $seq"
25 status
=1 # failure is the default!
27 MIG_SOCKET
="${TEST_DIR}/migrate"
29 # get standard environment, filters and checks
40 trap "_cleanup; exit \$status" 0 1 2 3 15
43 _supported_proto generic
46 # Internal snapshots are (currently) impossible with refcount_bits=1
47 # This was taken from test 080
48 _unsupported_imgopts
'refcount_bits=1[^0-9]'
54 echo === Starting VMs
===
57 qemu_comm_method
="monitor"
59 if [ "$IMGOPTSSYNTAX" = "true" ]; then
61 -drive "${TEST_IMG}",cache
=${CACHEMODE},id
=disk
64 -drive file="${TEST_IMG}",cache
=${CACHEMODE},driver
=$IMGFMT,id
=disk
68 if [ "$IMGOPTSSYNTAX" = "true" ]; then
70 -drive "${TEST_IMG}",cache
=${CACHEMODE},id
=disk \
71 -incoming "unix:${MIG_SOCKET}"
74 -drive file="${TEST_IMG}",cache
=${CACHEMODE},driver
=$IMGFMT,id
=disk \
75 -incoming "unix:${MIG_SOCKET}"
80 echo === Set
\'migrate_set_capability postcopy-ram on
\' and migrate
===
84 _send_qemu_cmd
$dest 'migrate_set_capability postcopy-ram on' "(qemu)"
85 _send_qemu_cmd
$src 'migrate_set_capability postcopy-ram on' "(qemu)"
86 _send_qemu_cmd
$src "migrate -d unix:${MIG_SOCKET}" "(qemu)"
88 QEMU_COMM_TIMEOUT
=1 qemu_cmd_repeat
=10 silent
=yes \
89 _send_qemu_cmd
$src "info migrate" "completed\|failed"
90 silent
=yes _send_qemu_cmd
$src "" "(qemu)"
93 echo === Check
if migration was successful
===
96 QEMU_COMM_TIMEOUT
=1 silent
=yes \
97 _send_qemu_cmd
$src "info migrate" "completed"
98 silent
=yes _send_qemu_cmd
$src "" "(qemu)"
101 echo === On destination
, execute savevm and loadvm
===
105 _send_qemu_cmd
$dest 'savevm state1' "(qemu)"
106 _send_qemu_cmd
$dest 'loadvm state1' "(qemu)"
109 echo === Shut down and check image
===
112 _send_qemu_cmd
$src 'quit' ""
113 _send_qemu_cmd
$dest 'quit' ""