3 # Test case for the QMP 'change' command and all other associated
6 # Copyright (C) 2015 Red Hat, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 from iotests
import qemu_img
28 old_img
= os
.path
.join(iotests
.test_dir
, 'test0.img')
29 new_img
= os
.path
.join(iotests
.test_dir
, 'test1.img')
31 class ChangeBaseClass(iotests
.QMPTestCase
):
35 def process_events(self
):
36 for event
in self
.vm
.get_qmp_events(wait
=False):
37 if (event
['event'] == 'DEVICE_TRAY_MOVED' and
38 event
['data']['device'] == 'drive0'):
39 if event
['data']['tray-open'] == False:
40 self
.has_closed
= True
42 self
.has_opened
= True
44 def wait_for_open(self
):
45 if not self
.has_real_tray
:
48 timeout
= time
.clock() + 3
49 while not self
.has_opened
and time
.clock() < timeout
:
51 if not self
.has_opened
:
52 self
.fail('Timeout while waiting for the tray to open')
54 def wait_for_close(self
):
55 if not self
.has_real_tray
:
58 timeout
= time
.clock() + 3
59 while not self
.has_closed
and time
.clock() < timeout
:
61 if not self
.has_opened
:
62 self
.fail('Timeout while waiting for the tray to close')
64 class GeneralChangeTestsBaseClass(ChangeBaseClass
):
65 def test_change(self
):
66 result
= self
.vm
.qmp('change', device
='drive0', target
=new_img
,
68 self
.assert_qmp(result
, 'return', {})
73 result
= self
.vm
.qmp('query-block')
74 if self
.has_real_tray
:
75 self
.assert_qmp(result
, 'return[0]/tray_open', False)
76 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
78 def test_blockdev_change_medium(self
):
79 result
= self
.vm
.qmp('blockdev-change-medium', device
='drive0',
81 format
=iotests
.imgfmt
)
82 self
.assert_qmp(result
, 'return', {})
87 result
= self
.vm
.qmp('query-block')
88 if self
.has_real_tray
:
89 self
.assert_qmp(result
, 'return[0]/tray_open', False)
90 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
93 result
= self
.vm
.qmp('eject', device
='drive0', force
=True)
94 self
.assert_qmp(result
, 'return', {})
98 result
= self
.vm
.qmp('query-block')
99 if self
.has_real_tray
:
100 self
.assert_qmp(result
, 'return[0]/tray_open', True)
101 self
.assert_qmp_absent(result
, 'return[0]/inserted')
103 def test_tray_eject_change(self
):
104 result
= self
.vm
.qmp('eject', device
='drive0', force
=True)
105 self
.assert_qmp(result
, 'return', {})
109 result
= self
.vm
.qmp('query-block')
110 if self
.has_real_tray
:
111 self
.assert_qmp(result
, 'return[0]/tray_open', True)
112 self
.assert_qmp_absent(result
, 'return[0]/inserted')
114 result
= self
.vm
.qmp('blockdev-change-medium', device
='drive0',
116 format
=iotests
.imgfmt
)
117 self
.assert_qmp(result
, 'return', {})
119 self
.wait_for_close()
121 result
= self
.vm
.qmp('query-block')
122 if self
.has_real_tray
:
123 self
.assert_qmp(result
, 'return[0]/tray_open', False)
124 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
126 def test_tray_open_close(self
):
127 result
= self
.vm
.qmp('blockdev-open-tray', device
='drive0', force
=True)
128 self
.assert_qmp(result
, 'return', {})
132 result
= self
.vm
.qmp('query-block')
133 if self
.has_real_tray
:
134 self
.assert_qmp(result
, 'return[0]/tray_open', True)
135 if self
.was_empty
== True:
136 self
.assert_qmp_absent(result
, 'return[0]/inserted')
138 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
140 result
= self
.vm
.qmp('blockdev-close-tray', device
='drive0')
141 self
.assert_qmp(result
, 'return', {})
143 if self
.has_real_tray
or not self
.was_empty
:
144 self
.wait_for_close()
146 result
= self
.vm
.qmp('query-block')
147 if self
.has_real_tray
:
148 self
.assert_qmp(result
, 'return[0]/tray_open', False)
149 if self
.was_empty
== True:
150 self
.assert_qmp_absent(result
, 'return[0]/inserted')
152 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
154 def test_tray_eject_close(self
):
155 result
= self
.vm
.qmp('eject', device
='drive0', force
=True)
156 self
.assert_qmp(result
, 'return', {})
160 result
= self
.vm
.qmp('query-block')
161 if self
.has_real_tray
:
162 self
.assert_qmp(result
, 'return[0]/tray_open', True)
163 self
.assert_qmp_absent(result
, 'return[0]/inserted')
165 result
= self
.vm
.qmp('blockdev-close-tray', device
='drive0')
166 self
.assert_qmp(result
, 'return', {})
168 self
.wait_for_close()
170 result
= self
.vm
.qmp('query-block')
171 if self
.has_real_tray
:
172 self
.assert_qmp(result
, 'return[0]/tray_open', False)
173 self
.assert_qmp_absent(result
, 'return[0]/inserted')
175 def test_tray_open_change(self
):
176 result
= self
.vm
.qmp('blockdev-open-tray', device
='drive0', force
=True)
177 self
.assert_qmp(result
, 'return', {})
181 result
= self
.vm
.qmp('query-block')
182 if self
.has_real_tray
:
183 self
.assert_qmp(result
, 'return[0]/tray_open', True)
184 if self
.was_empty
== True:
185 self
.assert_qmp_absent(result
, 'return[0]/inserted')
187 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
189 result
= self
.vm
.qmp('blockdev-change-medium', device
='drive0',
191 format
=iotests
.imgfmt
)
192 self
.assert_qmp(result
, 'return', {})
194 self
.wait_for_close()
196 result
= self
.vm
.qmp('query-block')
197 if self
.has_real_tray
:
198 self
.assert_qmp(result
, 'return[0]/tray_open', False)
199 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
201 def test_cycle(self
):
202 result
= self
.vm
.qmp('blockdev-add',
203 options
={'node-name': 'new',
204 'driver': iotests
.imgfmt
,
205 'file': {'filename': new_img
,
207 self
.assert_qmp(result
, 'return', {})
209 result
= self
.vm
.qmp('blockdev-open-tray', device
='drive0', force
=True)
210 self
.assert_qmp(result
, 'return', {})
214 result
= self
.vm
.qmp('query-block')
215 if self
.has_real_tray
:
216 self
.assert_qmp(result
, 'return[0]/tray_open', True)
217 if self
.was_empty
== True:
218 self
.assert_qmp_absent(result
, 'return[0]/inserted')
220 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
222 result
= self
.vm
.qmp('x-blockdev-remove-medium', device
='drive0')
223 self
.assert_qmp(result
, 'return', {})
225 result
= self
.vm
.qmp('query-block')
226 if self
.has_real_tray
:
227 self
.assert_qmp(result
, 'return[0]/tray_open', True)
228 self
.assert_qmp_absent(result
, 'return[0]/inserted')
230 result
= self
.vm
.qmp('x-blockdev-insert-medium', device
='drive0',
232 self
.assert_qmp(result
, 'return', {})
234 result
= self
.vm
.qmp('query-block')
235 if self
.has_real_tray
:
236 self
.assert_qmp(result
, 'return[0]/tray_open', True)
237 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
239 result
= self
.vm
.qmp('blockdev-close-tray', device
='drive0')
240 self
.assert_qmp(result
, 'return', {})
242 self
.wait_for_close()
244 result
= self
.vm
.qmp('query-block')
245 if self
.has_real_tray
:
246 self
.assert_qmp(result
, 'return[0]/tray_open', False)
247 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
249 def test_close_on_closed(self
):
250 result
= self
.vm
.qmp('blockdev-close-tray', device
='drive0')
252 self
.assert_qmp(result
, 'return', {})
253 self
.assertEquals(self
.vm
.get_qmp_events(wait
=False), [])
255 def test_remove_on_closed(self
):
256 if not self
.has_real_tray
:
259 result
= self
.vm
.qmp('x-blockdev-remove-medium', device
='drive0')
260 self
.assert_qmp(result
, 'error/class', 'GenericError')
262 def test_insert_on_closed(self
):
263 if not self
.has_real_tray
:
266 result
= self
.vm
.qmp('blockdev-add',
267 options
={'node-name': 'new',
268 'driver': iotests
.imgfmt
,
269 'file': {'filename': new_img
,
271 self
.assert_qmp(result
, 'return', {})
273 result
= self
.vm
.qmp('x-blockdev-insert-medium', device
='drive0',
275 self
.assert_qmp(result
, 'error/class', 'GenericError')
277 class TestInitiallyFilled(GeneralChangeTestsBaseClass
):
280 def setUp(self
, media
, interface
):
281 qemu_img('create', '-f', iotests
.imgfmt
, old_img
, '1440k')
282 qemu_img('create', '-f', iotests
.imgfmt
, new_img
, '1440k')
283 self
.vm
= iotests
.VM().add_drive(old_img
, 'media=%s' % media
, interface
)
291 def test_insert_on_filled(self
):
292 result
= self
.vm
.qmp('blockdev-add',
293 options
={'node-name': 'new',
294 'driver': iotests
.imgfmt
,
295 'file': {'filename': new_img
,
297 self
.assert_qmp(result
, 'return', {})
299 result
= self
.vm
.qmp('blockdev-open-tray', device
='drive0')
300 self
.assert_qmp(result
, 'return', {})
304 result
= self
.vm
.qmp('x-blockdev-insert-medium', device
='drive0',
306 self
.assert_qmp(result
, 'error/class', 'GenericError')
308 class TestInitiallyEmpty(GeneralChangeTestsBaseClass
):
311 def setUp(self
, media
, interface
):
312 qemu_img('create', '-f', iotests
.imgfmt
, new_img
, '1440k')
313 self
.vm
= iotests
.VM().add_drive(None, 'media=%s' % media
, interface
)
320 def test_remove_on_empty(self
):
321 result
= self
.vm
.qmp('blockdev-open-tray', device
='drive0')
322 self
.assert_qmp(result
, 'return', {})
326 result
= self
.vm
.qmp('x-blockdev-remove-medium', device
='drive0')
328 self
.assert_qmp(result
, 'return', {})
330 class TestCDInitiallyFilled(TestInitiallyFilled
):
331 TestInitiallyFilled
= TestInitiallyFilled
335 self
.TestInitiallyFilled
.setUp(self
, 'cdrom', 'ide')
337 class TestCDInitiallyEmpty(TestInitiallyEmpty
):
338 TestInitiallyEmpty
= TestInitiallyEmpty
342 self
.TestInitiallyEmpty
.setUp(self
, 'cdrom', 'ide')
344 class TestFloppyInitiallyFilled(TestInitiallyFilled
):
345 TestInitiallyFilled
= TestInitiallyFilled
346 has_real_tray
= False
349 self
.TestInitiallyFilled
.setUp(self
, 'disk', 'floppy')
351 class TestFloppyInitiallyEmpty(TestInitiallyEmpty
):
352 TestInitiallyEmpty
= TestInitiallyEmpty
353 has_real_tray
= False
356 self
.TestInitiallyEmpty
.setUp(self
, 'disk', 'floppy')
357 # FDDs not having a real tray and there not being a medium inside the
358 # tray at startup means the tray will be considered open
359 self
.has_opened
= True
361 class TestChangeReadOnly(ChangeBaseClass
):
363 qemu_img('create', '-f', iotests
.imgfmt
, old_img
, '1440k')
364 qemu_img('create', '-f', iotests
.imgfmt
, new_img
, '1440k')
365 self
.vm
= iotests
.VM()
369 os
.chmod(old_img
, 0666)
370 os
.chmod(new_img
, 0666)
374 def test_ro_ro_retain(self
):
375 os
.chmod(old_img
, 0444)
376 os
.chmod(new_img
, 0444)
377 self
.vm
.add_drive(old_img
, 'media=disk,read-only=on', 'floppy')
380 result
= self
.vm
.qmp('query-block')
381 self
.assert_qmp(result
, 'return[0]/inserted/ro', True)
382 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
384 result
= self
.vm
.qmp('blockdev-change-medium', device
='drive0',
386 format
=iotests
.imgfmt
,
387 read_only_mode
='retain')
388 self
.assert_qmp(result
, 'return', {})
390 result
= self
.vm
.qmp('query-block')
391 self
.assert_qmp(result
, 'return[0]/inserted/ro', True)
392 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
394 def test_ro_rw_retain(self
):
395 os
.chmod(old_img
, 0444)
396 self
.vm
.add_drive(old_img
, 'media=disk,read-only=on', 'floppy')
399 result
= self
.vm
.qmp('query-block')
400 self
.assert_qmp(result
, 'return[0]/inserted/ro', True)
401 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
403 result
= self
.vm
.qmp('blockdev-change-medium', device
='drive0',
405 format
=iotests
.imgfmt
,
406 read_only_mode
='retain')
407 self
.assert_qmp(result
, 'return', {})
409 result
= self
.vm
.qmp('query-block')
410 self
.assert_qmp(result
, 'return[0]/inserted/ro', True)
411 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
413 def test_rw_ro_retain(self
):
414 os
.chmod(new_img
, 0444)
415 self
.vm
.add_drive(old_img
, 'media=disk', 'floppy')
418 result
= self
.vm
.qmp('query-block')
419 self
.assert_qmp(result
, 'return[0]/inserted/ro', False)
420 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
422 result
= self
.vm
.qmp('blockdev-change-medium', device
='drive0',
424 format
=iotests
.imgfmt
,
425 read_only_mode
='retain')
426 self
.assert_qmp(result
, 'error/class', 'GenericError')
428 self
.assertEquals(self
.vm
.get_qmp_events(wait
=False), [])
430 result
= self
.vm
.qmp('query-block')
431 self
.assert_qmp(result
, 'return[0]/inserted/ro', False)
432 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
434 def test_ro_rw(self
):
435 os
.chmod(old_img
, 0444)
436 self
.vm
.add_drive(old_img
, 'media=disk,read-only=on', 'floppy')
439 result
= self
.vm
.qmp('query-block')
440 self
.assert_qmp(result
, 'return[0]/inserted/ro', True)
441 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
443 result
= self
.vm
.qmp('blockdev-change-medium',
446 format
=iotests
.imgfmt
,
447 read_only_mode
='read-write')
448 self
.assert_qmp(result
, 'return', {})
450 result
= self
.vm
.qmp('query-block')
451 self
.assert_qmp(result
, 'return[0]/inserted/ro', False)
452 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
454 def test_rw_ro(self
):
455 os
.chmod(new_img
, 0444)
456 self
.vm
.add_drive(old_img
, 'media=disk', 'floppy')
459 result
= self
.vm
.qmp('query-block')
460 self
.assert_qmp(result
, 'return[0]/inserted/ro', False)
461 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
463 result
= self
.vm
.qmp('blockdev-change-medium',
466 format
=iotests
.imgfmt
,
467 read_only_mode
='read-only')
468 self
.assert_qmp(result
, 'return', {})
470 result
= self
.vm
.qmp('query-block')
471 self
.assert_qmp(result
, 'return[0]/inserted/ro', True)
472 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
474 def test_make_rw_ro(self
):
475 self
.vm
.add_drive(old_img
, 'media=disk', 'floppy')
478 result
= self
.vm
.qmp('query-block')
479 self
.assert_qmp(result
, 'return[0]/inserted/ro', False)
480 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
482 result
= self
.vm
.qmp('blockdev-change-medium',
485 format
=iotests
.imgfmt
,
486 read_only_mode
='read-only')
487 self
.assert_qmp(result
, 'return', {})
489 result
= self
.vm
.qmp('query-block')
490 self
.assert_qmp(result
, 'return[0]/inserted/ro', True)
491 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
493 def test_make_ro_rw(self
):
494 os
.chmod(new_img
, 0444)
495 self
.vm
.add_drive(old_img
, 'media=disk', 'floppy')
498 result
= self
.vm
.qmp('query-block')
499 self
.assert_qmp(result
, 'return[0]/inserted/ro', False)
500 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
502 result
= self
.vm
.qmp('blockdev-change-medium',
505 format
=iotests
.imgfmt
,
506 read_only_mode
='read-write')
507 self
.assert_qmp(result
, 'error/class', 'GenericError')
509 result
= self
.vm
.qmp('query-block')
510 self
.assert_qmp(result
, 'return[0]/inserted/ro', False)
511 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
513 def test_make_rw_ro_by_retain(self
):
514 os
.chmod(old_img
, 0444)
515 self
.vm
.add_drive(old_img
, 'media=disk,read-only=on', 'floppy')
518 result
= self
.vm
.qmp('query-block')
519 self
.assert_qmp(result
, 'return[0]/inserted/ro', True)
520 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
522 result
= self
.vm
.qmp('blockdev-change-medium', device
='drive0',
524 format
=iotests
.imgfmt
,
525 read_only_mode
='retain')
526 self
.assert_qmp(result
, 'return', {})
528 result
= self
.vm
.qmp('query-block')
529 self
.assert_qmp(result
, 'return[0]/inserted/ro', True)
530 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
532 def test_make_ro_rw_by_retain(self
):
533 os
.chmod(new_img
, 0444)
534 self
.vm
.add_drive(old_img
, 'media=disk', 'floppy')
537 result
= self
.vm
.qmp('query-block')
538 self
.assert_qmp(result
, 'return[0]/inserted/ro', False)
539 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
541 result
= self
.vm
.qmp('blockdev-change-medium', device
='drive0',
543 format
=iotests
.imgfmt
,
544 read_only_mode
='retain')
545 self
.assert_qmp(result
, 'error/class', 'GenericError')
547 result
= self
.vm
.qmp('query-block')
548 self
.assert_qmp(result
, 'return[0]/inserted/ro', False)
549 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
551 def test_rw_ro_cycle(self
):
552 os
.chmod(new_img
, 0444)
553 self
.vm
.add_drive(old_img
, 'media=disk', 'floppy')
556 result
= self
.vm
.qmp('query-block')
557 self
.assert_qmp(result
, 'return[0]/inserted/ro', False)
558 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
560 result
= self
.vm
.qmp('blockdev-add',
561 options
={'node-name': 'new',
562 'driver': iotests
.imgfmt
,
564 'file': {'filename': new_img
,
566 self
.assert_qmp(result
, 'return', {})
568 result
= self
.vm
.qmp('query-block')
569 self
.assert_qmp(result
, 'return[0]/inserted/ro', False)
570 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
572 result
= self
.vm
.qmp('x-blockdev-remove-medium', device
='drive0')
573 self
.assert_qmp(result
, 'return', {})
575 result
= self
.vm
.qmp('query-block')
576 self
.assert_qmp_absent(result
, 'return[0]/inserted')
578 result
= self
.vm
.qmp('x-blockdev-insert-medium', device
='drive0',
580 self
.assert_qmp(result
, 'return', {})
582 result
= self
.vm
.qmp('query-block')
583 self
.assert_qmp(result
, 'return[0]/inserted/ro', True)
584 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
586 result
= self
.vm
.qmp('query-block')
587 self
.assert_qmp(result
, 'return[0]/inserted/ro', True)
588 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
590 GeneralChangeTestsBaseClass
= None
591 TestInitiallyFilled
= None
592 TestInitiallyEmpty
= None
595 class TestBlockJobsAfterCycle(ChangeBaseClass
):
597 qemu_img('create', '-f', iotests
.imgfmt
, old_img
, '1M')
599 self
.vm
= iotests
.VM()
602 result
= self
.vm
.qmp('blockdev-add',
603 options
={'id': 'drive0',
604 'driver': 'null-co'})
605 self
.assert_qmp(result
, 'return', {})
607 result
= self
.vm
.qmp('query-block')
608 self
.assert_qmp(result
, 'return[0]/inserted/image/format', 'null-co')
610 # For device-less BBs, calling blockdev-open-tray or blockdev-close-tray
612 result
= self
.vm
.qmp('x-blockdev-remove-medium', device
='drive0')
613 self
.assert_qmp(result
, 'return', {})
615 result
= self
.vm
.qmp('query-block')
616 self
.assert_qmp_absent(result
, 'return[0]/inserted')
618 result
= self
.vm
.qmp('blockdev-add',
619 options
={'node-name': 'node0',
620 'driver': iotests
.imgfmt
,
621 'file': {'filename': old_img
,
623 self
.assert_qmp(result
, 'return', {})
625 result
= self
.vm
.qmp('x-blockdev-insert-medium', device
='drive0',
627 self
.assert_qmp(result
, 'return', {})
629 result
= self
.vm
.qmp('query-block')
630 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', old_img
)
640 def test_snapshot_and_commit(self
):
641 # We need backing file support
642 if iotests
.imgfmt
!= 'qcow2' and iotests
.imgfmt
!= 'qed':
645 result
= self
.vm
.qmp('blockdev-snapshot-sync', device
='drive0',
646 snapshot_file
=new_img
,
647 format
=iotests
.imgfmt
)
648 self
.assert_qmp(result
, 'return', {})
650 result
= self
.vm
.qmp('query-block')
651 self
.assert_qmp(result
, 'return[0]/inserted/image/filename', new_img
)
652 self
.assert_qmp(result
,
653 'return[0]/inserted/image/backing-image/filename',
656 result
= self
.vm
.qmp('block-commit', device
='drive0')
657 self
.assert_qmp(result
, 'return', {})
659 self
.vm
.event_wait(name
='BLOCK_JOB_READY')
661 result
= self
.vm
.qmp('query-block-jobs')
662 self
.assert_qmp(result
, 'return[0]/device', 'drive0')
664 result
= self
.vm
.qmp('block-job-complete', device
='drive0')
665 self
.assert_qmp(result
, 'return', {})
667 self
.vm
.event_wait(name
='BLOCK_JOB_COMPLETED')
670 if __name__
== '__main__':
671 if iotests
.qemu_default_machine
!= 'pc':
672 # We need floppy and IDE CD-ROM
673 iotests
.notrun('not suitable for this machine type: %s' %
674 iotests
.qemu_default_machine
)
675 # Need to support image creation
676 iotests
.main(supported_fmts
=['vpc', 'parallels', 'qcow', 'vdi', 'qcow2',
677 'vmdk', 'raw', 'vhdx', 'qed'])