4 # Copyright (C) 2017 Red Hat, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # Creator/Owner: Stefan Hajnoczi <stefanha@redhat.com>
21 # Check that QMP 'transaction' blockdev-snapshot-sync with multiple drives on a
22 # single IOThread completes successfully. This particular command triggered a
23 # hang due to recursive AioContext locking and BDRV_POLL_WHILE(). Protect
24 # against regressions.
28 iotests.script_initialize(supported_fmts=['qcow2'],
29 supported_platforms=['linux'])
31 with iotests.FilePath('disk0.img') as disk0_img_path, \
32 iotests.FilePath('disk1.img') as disk1_img_path, \
33 iotests.FilePath('disk0-snap.img') as disk0_snap_img_path, \
34 iotests.FilePath('disk1-snap.img') as disk1_snap_img_path, \
38 iotests.qemu_img_create('-f', iotests.imgfmt, disk0_img_path, img_size)
39 iotests.qemu_img_create('-f', iotests.imgfmt, disk1_img_path, img_size)
41 iotests.log('Launching VM...')
44 iotests.log('Adding IOThread...')
45 iotests.log(vm.qmp('object-add',
49 iotests.log('Adding blockdevs...')
50 iotests.log(vm.qmp('blockdev-add',
51 driver=iotests.imgfmt,
55 'filename': disk0_img_path,
57 iotests.log(vm.qmp('blockdev-add',
58 driver=iotests.imgfmt,
62 'filename': disk1_img_path,
65 iotests.log('Setting iothread...')
66 iotests.log(vm.qmp('x-blockdev-set-iothread',
68 iothread='iothread0'))
69 iotests.log(vm.qmp('x-blockdev-set-iothread',
71 iothread='iothread0'))
73 iotests.log('Creating external snapshots...')
80 'snapshot-file': disk0_snap_img_path,
81 'snapshot-node-name': 'disk0-snap',
82 'mode': 'absolute-paths',
83 'format': iotests.imgfmt,
85 'type': 'blockdev-snapshot-sync'
89 'snapshot-file': disk1_snap_img_path,
90 'snapshot-node-name': 'disk1-snap',
91 'mode': 'absolute-paths',
92 'format': iotests.imgfmt
94 'type': 'blockdev-snapshot-sync'