migration: API to clear bits of guest free pages from the dirty bitmap
[qemu/ar7.git] / tests / qemu-iotests / 087
blobf625887082220e5b32584940c02677463467d4f6
1 #!/bin/bash
3 # Test unsupported blockdev-add cases
5 # Copyright (C) 2014 Red Hat, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # creator
22 owner=kwolf@redhat.com
24 seq=`basename $0`
25 echo "QA output created by $seq"
27 status=1 # failure is the default!
29 # get standard environment, filters and checks
30 . ./common.rc
31 . ./common.filter
33 _supported_fmt qcow2
34 _supported_proto file
35 _supported_os Linux
37 do_run_qemu()
39 echo Testing: "$@"
40 $QEMU -nographic -qmp stdio -serial none "$@"
41 echo
44 run_qemu()
46 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
47 | _filter_qemu | _filter_imgfmt \
48 | _filter_actual_image_size
51 size=128M
53 _make_test_img $size
55 echo
56 echo === Missing ID and node-name ===
57 echo
59 run_qemu <<EOF
60 { "execute": "qmp_capabilities" }
61 { "execute": "blockdev-add",
62 "arguments": {
63 "driver": "$IMGFMT",
64 "file": {
65 "driver": "file",
66 "filename": "$TEST_IMG"
70 { "execute": "quit" }
71 EOF
73 echo
74 echo === Duplicate ID ===
75 echo
77 run_qemu -drive driver=$IMGFMT,id=disk,node-name=test-node,file="$TEST_IMG" <<EOF
78 { "execute": "qmp_capabilities" }
79 { "execute": "blockdev-add",
80 "arguments": {
81 "driver": "$IMGFMT",
82 "node-name": "disk",
83 "file": {
84 "driver": "null-co"
88 { "execute": "blockdev-add",
89 "arguments": {
90 "driver": "$IMGFMT",
91 "node-name": "test-node",
92 "file": {
93 "driver": "null-co"
97 { "execute": "quit" }
98 EOF
100 echo
101 echo === aio=native without O_DIRECT ===
102 echo
104 # Skip this test if AIO is not enabled in this build
105 run_qemu_filter_aio()
107 run_qemu "$@" | \
108 sed -e 's/is not supported in this build/it requires cache.direct=on, which was not specified/'
111 run_qemu_filter_aio <<EOF
112 { "execute": "qmp_capabilities" }
113 { "execute": "blockdev-add",
114 "arguments": {
115 "driver": "$IMGFMT",
116 "node-name": "disk",
117 "file": {
118 "driver": "file",
119 "filename": "$TEST_IMG",
120 "aio": "native"
124 { "execute": "quit" }
127 echo
128 echo === Encrypted image QCow ===
129 echo
131 _make_test_img --object secret,id=sec0,data=123456 -o encryption=on,encrypt.key-secret=sec0 $size
132 run_qemu <<EOF
133 { "execute": "qmp_capabilities" }
134 { "execute": "object-add",
135 "arguments": {
136 "qom-type": "secret",
137 "id": "sec0",
138 "props": {
139 "data": "123456"
143 { "execute": "blockdev-add",
144 "arguments": {
145 "driver": "$IMGFMT",
146 "node-name": "disk",
147 "file": {
148 "driver": "file",
149 "filename": "$TEST_IMG"
151 "encrypt": {
152 "format": "aes",
153 "key-secret": "sec0"
157 { "execute": "quit" }
160 echo
161 echo === Encrypted image LUKS ===
162 echo
164 _make_test_img --object secret,id=sec0,data=123456 -o encrypt.format=luks,encrypt.key-secret=sec0 $size
165 run_qemu <<EOF
166 { "execute": "qmp_capabilities" }
167 { "execute": "object-add",
168 "arguments": {
169 "qom-type": "secret",
170 "id": "sec0",
171 "props": {
172 "data": "123456"
176 { "execute": "blockdev-add",
177 "arguments": {
178 "driver": "$IMGFMT",
179 "node-name": "disk",
180 "file": {
181 "driver": "file",
182 "filename": "$TEST_IMG"
184 "encrypt": {
185 "format": "luks",
186 "key-secret": "sec0"
190 { "execute": "quit" }
193 echo
194 echo === Missing driver ===
195 echo
197 _make_test_img --object secret,id=sec0,data=123456 -o encryption=on,encrypt.key-secret=sec0 $size
198 run_qemu -S <<EOF
199 { "execute": "qmp_capabilities" }
200 { "execute": "blockdev-add",
201 "arguments": {
202 "node-name": "disk"
205 { "execute": "quit" }
208 # success, all done
209 echo "*** done"
210 rm -f $seq.full
211 status=0