[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 56/56] qemu-iotests: fix 203 migration completion rac
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 56/56] qemu-iotests: fix 203 migration completion race |
Date: |
Fri, 9 Mar 2018 17:19:33 +0100 |
From: Stefan Hajnoczi <address@hidden>
There is a race between the test's 'query-migrate' QMP command after the
QMP 'STOP' event and completing the migration:
The test case invokes 'query-migrate' upon receiving 'STOP'. At this
point the migration thread may still be in the process of completing.
Therefore 'query-migrate' can return 'status': 'active' for a brief
window of time instead of 'status': 'completed'. This results in
qemu-iotests 203 hanging.
Solve the race by enabling the 'events' migration capability, which
causes QEMU to emit migration-specific QMP events that do not suffer
from this race condition. Wait for the QMP 'MIGRATION' event with
'status': 'completed'.
Reported-by: Max Reitz <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/203 | 15 +++++++++++----
tests/qemu-iotests/203.out | 5 +++++
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/tests/qemu-iotests/203 b/tests/qemu-iotests/203
index 2c811917d8..4874a1a0d8 100755
--- a/tests/qemu-iotests/203
+++ b/tests/qemu-iotests/203
@@ -49,11 +49,18 @@ with iotests.FilePath('disk0.img') as disk0_img_path, \
node_name='drive1-node', iothread='iothread0',
force=True))
+ iotests.log('Enabling migration QMP events...')
+ iotests.log(vm.qmp('migrate-set-capabilities', capabilities=[
+ {
+ 'capability': 'events',
+ 'state': True
+ }
+ ]))
+
iotests.log('Starting migration...')
iotests.log(vm.qmp('migrate', uri='exec:cat >/dev/null'))
while True:
- vm.get_qmp_event(wait=60.0)
- result = vm.qmp('query-migrate')
- status = result.get('return', {}).get('status', None)
- if status == 'completed':
+ event = vm.event_wait('MIGRATION')
+ iotests.log(event, filters=[iotests.filter_qmp_event])
+ if event['data']['status'] == 'completed':
break
diff --git a/tests/qemu-iotests/203.out b/tests/qemu-iotests/203.out
index 3f1ff900e4..1a11f0975c 100644
--- a/tests/qemu-iotests/203.out
+++ b/tests/qemu-iotests/203.out
@@ -2,5 +2,10 @@ Launching VM...
Setting IOThreads...
{u'return': {}}
{u'return': {}}
+Enabling migration QMP events...
+{u'return': {}}
Starting migration...
{u'return': {}}
+{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'setup'}, u'event': u'MIGRATION'}
+{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'active'}, u'event': u'MIGRATION'}
+{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'completed'}, u'event': u'MIGRATION'}
--
2.13.6
- [Qemu-devel] [PULL 35/56] rbd: Remove non-schema options from runtime_opts, (continued)
- [Qemu-devel] [PULL 35/56] rbd: Remove non-schema options from runtime_opts, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 43/56] sheepdog: Support .bdrv_co_create, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 51/56] qemu-iotests: Test ssh image creation over QMP, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 38/56] rbd: Assign s->snap/image_name in qemu_rbd_open(), Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 42/56] sheepdog: QAPIfy "redundancy" create option, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 47/56] ssh: Support .bdrv_co_create, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 45/56] ssh: QAPIfy host-key-check option, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 52/56] iotests: Test creating overlay when guest running, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 54/56] iotests: Skip test for ENOMEM error, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 53/56] iotests: Mark all tests executable, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 56/56] qemu-iotests: fix 203 migration completion race,
Kevin Wolf <=
- [Qemu-devel] [PULL 55/56] iotests: Tweak 030 in order to trigger a race condition with parallel jobs, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 50/56] qemu-iotests: Test qcow2 over file image creation with QMP, Kevin Wolf, 2018/03/09
- Re: [Qemu-devel] [PULL 00/56] Block layer patches, Peter Maydell, 2018/03/12