qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

tests/qemu-iotests: adding savevm/loadvm with postcopy flag test

This patch implements a test case for the scenario that was failing
prior to the patch "migration/ram.c: do not set 'postcopy_running' in
POSTCOPY_INCOMING_END", commit acab30b85d.

This new test file 201 was derived from the test file 181 authored
by Kevin Wolf.

CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
CC: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>

authored by

Daniel Henrique Barboza and committed by
Kevin Wolf
7c3a3028 a30306ed

+144
+120
tests/qemu-iotests/201
··· 1 + #!/bin/bash 2 + # 3 + # Test savevm and loadvm after live migration with postcopy flag 4 + # 5 + # Copyright (C) 2017, IBM Corporation. 6 + # 7 + # This file is derived from tests/qemu-iotests/181 by Kevin Wolf 8 + # 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. 13 + # 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. 18 + # 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/>. 21 + 22 + seq=`basename $0` 23 + echo "QA output created by $seq" 24 + 25 + status=1 # failure is the default! 26 + 27 + MIG_SOCKET="${TEST_DIR}/migrate" 28 + 29 + # get standard environment, filters and checks 30 + . ./common.rc 31 + . ./common.filter 32 + . ./common.qemu 33 + 34 + _cleanup() 35 + { 36 + rm -f "${MIG_SOCKET}" 37 + _cleanup_test_img 38 + _cleanup_qemu 39 + } 40 + trap "_cleanup; exit \$status" 0 1 2 3 15 41 + 42 + _supported_fmt qcow2 43 + _supported_proto generic 44 + _supported_os Linux 45 + 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]' 49 + 50 + size=64M 51 + _make_test_img $size 52 + 53 + echo 54 + echo === Starting VMs === 55 + echo 56 + 57 + qemu_comm_method="monitor" 58 + 59 + if [ "$IMGOPTSSYNTAX" = "true" ]; then 60 + _launch_qemu \ 61 + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk 62 + else 63 + _launch_qemu \ 64 + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk 65 + fi 66 + src=$QEMU_HANDLE 67 + 68 + if [ "$IMGOPTSSYNTAX" = "true" ]; then 69 + _launch_qemu \ 70 + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ 71 + -incoming "unix:${MIG_SOCKET}" 72 + else 73 + _launch_qemu \ 74 + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ 75 + -incoming "unix:${MIG_SOCKET}" 76 + fi 77 + dest=$QEMU_HANDLE 78 + 79 + echo 80 + echo === Set \'migrate_set_capability postcopy-ram on\' and migrate === 81 + echo 82 + 83 + silent=yes 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)" 87 + 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)" 91 + 92 + echo 93 + echo === Check if migration was successful === 94 + echo 95 + 96 + QEMU_COMM_TIMEOUT=1 silent=yes \ 97 + _send_qemu_cmd $src "info migrate" "completed" 98 + silent=yes _send_qemu_cmd $src "" "(qemu)" 99 + 100 + echo 101 + echo === On destination, execute savevm and loadvm === 102 + echo 103 + 104 + silent= 105 + _send_qemu_cmd $dest 'savevm state1' "(qemu)" 106 + _send_qemu_cmd $dest 'loadvm state1' "(qemu)" 107 + 108 + echo 109 + echo === Shut down and check image === 110 + echo 111 + 112 + _send_qemu_cmd $src 'quit' "" 113 + _send_qemu_cmd $dest 'quit' "" 114 + wait=1 _cleanup_qemu 115 + 116 + _check_test_img 117 + 118 + # success, all done 119 + echo "*** done" 120 + status=0
+23
tests/qemu-iotests/201.out
··· 1 + QA output created by 201 2 + Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 3 + 4 + === Starting VMs === 5 + 6 + 7 + === Set 'migrate_set_capability postcopy-ram on' and migrate === 8 + 9 + 10 + === Check if migration was successful === 11 + 12 + 13 + === On destination, execute savevm and loadvm === 14 + 15 + (qemu) savevm state1 16 + (qemu) loadvm state1 17 + 18 + === Shut down and check image === 19 + 20 + (qemu) quit 21 + (qemu) quit 22 + No errors were found on the image. 23 + *** done
+1
tests/qemu-iotests/group
··· 197 197 197 rw auto quick 198 198 198 rw auto 199 199 200 rw auto 200 + 201 rw auto migration 200 201 202 rw auto quick 201 202 203 rw auto