]> Git Repo - qemu.git/blob - tests/qemu-iotests/087
block: move encryption deprecation warning into qcow code
[qemu.git] / tests / qemu-iotests / 087
1 #!/bin/bash
2 #
3 # Test unsupported blockdev-add cases
4 #
5 # Copyright (C) 2014 Red Hat, Inc.
6 #
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.
11 #
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.
16 #
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/>.
19 #
20
21 # creator
22 [email protected]
23
24 seq=`basename $0`
25 echo "QA output created by $seq"
26
27 here=`pwd`
28 tmp=/tmp/$$
29 status=1        # failure is the default!
30
31 # get standard environment, filters and checks
32 . ./common.rc
33 . ./common.filter
34
35 _supported_fmt qcow2
36 _supported_proto file
37 _supported_os Linux
38
39 function do_run_qemu()
40 {
41     echo Testing: "$@"
42     $QEMU -nographic -qmp stdio -serial none "$@"
43     echo
44 }
45
46 function run_qemu()
47 {
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'
51 }
52
53 size=128M
54
55 _make_test_img $size
56
57 echo
58 echo === Missing ID and node-name ===
59 echo
60
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"
70         }
71       }
72     }
73   }
74 { "execute": "quit" }
75 EOF
76
77 echo
78 echo === Duplicate ID ===
79 echo
80
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"
92         }
93       }
94     }
95   }
96 { "execute": "blockdev-add",
97   "arguments": {
98       "options": {
99         "driver": "$IMGFMT",
100         "id": "disk",
101         "file": {
102             "driver": "file",
103             "filename": "$TEST_IMG"
104         }
105       }
106     }
107   }
108 { "execute": "blockdev-add",
109   "arguments": {
110       "options": {
111         "driver": "$IMGFMT",
112         "id": "test-node",
113         "file": {
114             "driver": "file",
115             "filename": "$TEST_IMG"
116         }
117       }
118     }
119   }
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"
129         }
130       }
131     }
132   }
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"
142         }
143       }
144     }
145   }
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"
155         }
156       }
157     }
158   }
159 { "execute": "quit" }
160 EOF
161
162 echo
163 echo === aio=native without O_DIRECT ===
164 echo
165
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"
177         }
178       }
179     }
180   }
181 { "execute": "quit" }
182 EOF
183
184 echo
185 echo === Encrypted image ===
186 echo
187
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"
199         }
200       }
201     }
202   }
203 { "execute": "quit" }
204 EOF
205
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"
216         }
217       }
218     }
219   }
220 { "execute": "quit" }
221 EOF
222
223 echo
224 echo === Missing driver ===
225 echo
226
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"
234       }
235     }
236   }
237 { "execute": "quit" }
238 EOF
239
240 # success, all done
241 echo "*** done"
242 rm -f $seq.full
243 status=0
This page took 0.032981 seconds and 4 git commands to generate.