vga: build virtio-gpu as module
[qemu/ar7.git] / tests / qemu-iotests / 202
blobe3900a44d112867968fc31ff3c0d318fc15723ae
1 #!/usr/bin/env python3
3 # Copyright (C) 2017 Red Hat, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 # Creator/Owner: Stefan Hajnoczi <stefanha@redhat.com>
20 # Check that QMP 'transaction' blockdev-snapshot-sync with multiple drives on a
21 # single IOThread completes successfully.  This particular command triggered a
22 # hang due to recursive AioContext locking and BDRV_POLL_WHILE().  Protect
23 # against regressions.
25 import iotests
27 iotests.script_initialize(supported_fmts=['qcow2'],
28                           supported_platforms=['linux'])
30 with iotests.FilePath('disk0.img') as disk0_img_path, \
31      iotests.FilePath('disk1.img') as disk1_img_path, \
32      iotests.FilePath('disk0-snap.img') as disk0_snap_img_path, \
33      iotests.FilePath('disk1-snap.img') as disk1_snap_img_path, \
34      iotests.VM() as vm:
36     img_size = '10M'
37     iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, disk0_img_path, img_size)
38     iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, disk1_img_path, img_size)
40     iotests.log('Launching VM...')
41     vm.launch()
43     iotests.log('Adding IOThread...')
44     iotests.log(vm.qmp('object-add',
45                        qom_type='iothread',
46                        id='iothread0'))
48     iotests.log('Adding blockdevs...')
49     iotests.log(vm.qmp('blockdev-add',
50                        driver=iotests.imgfmt,
51                        node_name='disk0',
52                        file={
53                            'driver': 'file',
54                            'filename': disk0_img_path,
55                        }))
56     iotests.log(vm.qmp('blockdev-add',
57                        driver=iotests.imgfmt,
58                        node_name='disk1',
59                        file={
60                            'driver': 'file',
61                            'filename': disk1_img_path,
62                        }))
64     iotests.log('Setting iothread...')
65     iotests.log(vm.qmp('x-blockdev-set-iothread',
66                        node_name='disk0',
67                        iothread='iothread0'))
68     iotests.log(vm.qmp('x-blockdev-set-iothread',
69                        node_name='disk1',
70                        iothread='iothread0'))
72     iotests.log('Creating external snapshots...')
73     iotests.log(vm.qmp(
74                   'transaction',
75                   actions=[
76                       {
77                           'data': {
78                               'node-name': 'disk0',
79                               'snapshot-file': disk0_snap_img_path,
80                               'snapshot-node-name': 'disk0-snap',
81                               'mode': 'absolute-paths',
82                               'format': iotests.imgfmt,
83                           },
84                           'type': 'blockdev-snapshot-sync'
85                       }, {
86                           'data': {
87                               'node-name': 'disk1',
88                               'snapshot-file': disk1_snap_img_path,
89                               'snapshot-node-name': 'disk1-snap',
90                               'mode': 'absolute-paths',
91                               'format': iotests.imgfmt
92                           },
93                           'type': 'blockdev-snapshot-sync'
94                       }
95                   ]))