Message ID | 1432790990-25383-9-git-send-email-famz@redhat.com |
---|---|
State | New |
Headers | show |
On 28/05/2015 07:29, Fam Zheng wrote: > Only poll the specific type of event we are interested in, to avoid > stealing events that should be consumed by someone else. > > Suggested-by: John Snow <jsnow@redhat.com> > Signed-off-by: Fam Zheng <famz@redhat.com> > Reviewed-by: John Snow <jsnow@redhat.com> > --- > tests/qemu-iotests/iotests.py | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py > index 63de726..8615b10 100644 > --- a/tests/qemu-iotests/iotests.py > +++ b/tests/qemu-iotests/iotests.py > @@ -328,13 +328,8 @@ class QMPTestCase(unittest.TestCase): > > def wait_ready(self, drive='drive0'): > '''Wait until a block job BLOCK_JOB_READY event''' > - ready = False > - while not ready: > - for event in self.vm.get_qmp_events(wait=True): > - if event['event'] == 'BLOCK_JOB_READY': > - self.assert_qmp(event, 'data/type', 'mirror') > - self.assert_qmp(event, 'data/device', drive) > - ready = True > + f = {'data': {'type': 'mirror', 'device': drive } } > + event = self.vm.event_wait(name='BLOCK_JOB_READY', match=f) > > def wait_ready_and_cancel(self, drive='drive0'): > self.wait_ready(drive=drive) > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 63de726..8615b10 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -328,13 +328,8 @@ class QMPTestCase(unittest.TestCase): def wait_ready(self, drive='drive0'): '''Wait until a block job BLOCK_JOB_READY event''' - ready = False - while not ready: - for event in self.vm.get_qmp_events(wait=True): - if event['event'] == 'BLOCK_JOB_READY': - self.assert_qmp(event, 'data/type', 'mirror') - self.assert_qmp(event, 'data/device', drive) - ready = True + f = {'data': {'type': 'mirror', 'device': drive } } + event = self.vm.event_wait(name='BLOCK_JOB_READY', match=f) def wait_ready_and_cancel(self, drive='drive0'): self.wait_ready(drive=drive)