block: move encryption deprecation warning into qcow code
[qemu/kevin.git] / tests / qemu-iotests / 087
blob27cbebc2bc349622c845a3f3ec12edfe4f60354e
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 here=`pwd`
28 tmp=/tmp/$$
29 status=1 # failure is the default!
31 # get standard environment, filters and checks
32 . ./common.rc
33 . ./common.filter
35 _supported_fmt qcow2
36 _supported_proto file
37 _supported_os Linux
39 function do_run_qemu()
41 echo Testing: "$@"
42 $QEMU -nographic -qmp stdio -serial none "$@"
43 echo
46 function run_qemu()
48 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
49 | _filter_qemu | _filter_imgfmt \
50 | sed -e 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g'
53 size=128M
55 _make_test_img $size
57 echo
58 echo === Missing ID and node-name ===
59 echo
61 run_qemu <<EOF
62 { "execute": "qmp_capabilities" }
63 { "execute": "blockdev-add",
64 "arguments": {
65 "options": {
66 "driver": "$IMGFMT",
67 "file": {
68 "driver": "file",
69 "filename": "$TEST_IMG"
74 { "execute": "quit" }
75 EOF
77 echo
78 echo === Duplicate ID ===
79 echo
81 run_qemu <<EOF
82 { "execute": "qmp_capabilities" }
83 { "execute": "blockdev-add",
84 "arguments": {
85 "options": {
86 "driver": "$IMGFMT",
87 "id": "disk",
88 "node-name": "test-node",
89 "file": {
90 "driver": "file",
91 "filename": "$TEST_IMG"
96 { "execute": "blockdev-add",
97 "arguments": {
98 "options": {
99 "driver": "$IMGFMT",
100 "id": "disk",
101 "file": {
102 "driver": "file",
103 "filename": "$TEST_IMG"
108 { "execute": "blockdev-add",
109 "arguments": {
110 "options": {
111 "driver": "$IMGFMT",
112 "id": "test-node",
113 "file": {
114 "driver": "file",
115 "filename": "$TEST_IMG"
120 { "execute": "blockdev-add",
121 "arguments": {
122 "options": {
123 "driver": "$IMGFMT",
124 "id": "disk2",
125 "node-name": "disk",
126 "file": {
127 "driver": "file",
128 "filename": "$TEST_IMG"
133 { "execute": "blockdev-add",
134 "arguments": {
135 "options": {
136 "driver": "$IMGFMT",
137 "id": "disk2",
138 "node-name": "test-node",
139 "file": {
140 "driver": "file",
141 "filename": "$TEST_IMG"
146 { "execute": "blockdev-add",
147 "arguments": {
148 "options": {
149 "driver": "$IMGFMT",
150 "id": "disk3",
151 "node-name": "disk3",
152 "file": {
153 "driver": "file",
154 "filename": "$TEST_IMG"
159 { "execute": "quit" }
162 echo
163 echo === aio=native without O_DIRECT ===
164 echo
166 run_qemu <<EOF
167 { "execute": "qmp_capabilities" }
168 { "execute": "blockdev-add",
169 "arguments": {
170 "options": {
171 "driver": "$IMGFMT",
172 "id": "disk",
173 "aio": "native",
174 "file": {
175 "driver": "file",
176 "filename": "$TEST_IMG"
181 { "execute": "quit" }
184 echo
185 echo === Encrypted image ===
186 echo
188 _make_test_img -o encryption=on $size
189 run_qemu -S <<EOF
190 { "execute": "qmp_capabilities" }
191 { "execute": "blockdev-add",
192 "arguments": {
193 "options": {
194 "driver": "$IMGFMT",
195 "id": "disk",
196 "file": {
197 "driver": "file",
198 "filename": "$TEST_IMG"
203 { "execute": "quit" }
206 run_qemu <<EOF
207 { "execute": "qmp_capabilities" }
208 { "execute": "blockdev-add",
209 "arguments": {
210 "options": {
211 "driver": "$IMGFMT",
212 "id": "disk",
213 "file": {
214 "driver": "file",
215 "filename": "$TEST_IMG"
220 { "execute": "quit" }
223 echo
224 echo === Missing driver ===
225 echo
227 _make_test_img -o encryption=on $size
228 run_qemu -S <<EOF
229 { "execute": "qmp_capabilities" }
230 { "execute": "blockdev-add",
231 "arguments": {
232 "options": {
233 "id": "disk"
237 { "execute": "quit" }
240 # success, all done
241 echo "*** done"
242 rm -f $seq.full
243 status=0