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 'migrate' with multiple drives on a single IOThread completes
21 # successfully. This particular command triggered a hang in the source QEMU
22 # process due to recursive AioContext locking in bdrv_invalidate_all() and
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, \
35 iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, disk0_img_path, img_size)
36 iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, disk1_img_path, img_size)
38 iotests.log('Launching VM...')
39 (vm.add_object('iothread,id=iothread0')
40 .add_drive(disk0_img_path, 'node-name=drive0-node', interface='none')
41 .add_drive(disk1_img_path, 'node-name=drive1-node', interface='none')
44 iotests.log('Setting IOThreads...')
45 iotests.log(vm.qmp('x-blockdev-set-iothread',
46 node_name='drive0-node', iothread='iothread0',
48 iotests.log(vm.qmp('x-blockdev-set-iothread',
49 node_name='drive1-node', iothread='iothread0',
52 iotests.log('Enabling migration QMP events...')
53 iotests.log(vm.qmp('migrate-set-capabilities', capabilities=[
55 'capability': 'events',
60 iotests.log('Starting migration...')
61 iotests.log(vm.qmp('migrate', uri='exec:cat >/dev/null'))
63 event = vm.event_wait('MIGRATION')
64 iotests.log(event, filters=[iotests.filter_qmp_event])
65 if event['data']['status'] == 'completed':