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