iotests.py: rewrite run_job to be pickier
Don't pull events out of the queue that don't belong to us; be choosier so that we can use this method to drive jobs that were launched by transactions that may have more jobs. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20190523170643.20794-5-jsnow@redhat.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
f6f4b3f045
commit
d6a79af0e6
@ -543,10 +543,22 @@ class VM(qtest.QEMUQtestMachine):
|
|||||||
# Returns None on success, and an error string on failure
|
# Returns None on success, and an error string on failure
|
||||||
def run_job(self, job, auto_finalize=True, auto_dismiss=False,
|
def run_job(self, job, auto_finalize=True, auto_dismiss=False,
|
||||||
pre_finalize=None, wait=60.0):
|
pre_finalize=None, wait=60.0):
|
||||||
|
match_device = {'data': {'device': job}}
|
||||||
|
match_id = {'data': {'id': job}}
|
||||||
|
events = [
|
||||||
|
('BLOCK_JOB_COMPLETED', match_device),
|
||||||
|
('BLOCK_JOB_CANCELLED', match_device),
|
||||||
|
('BLOCK_JOB_ERROR', match_device),
|
||||||
|
('BLOCK_JOB_READY', match_device),
|
||||||
|
('BLOCK_JOB_PENDING', match_id),
|
||||||
|
('JOB_STATUS_CHANGE', match_id)
|
||||||
|
]
|
||||||
error = None
|
error = None
|
||||||
while True:
|
while True:
|
||||||
for ev in self.get_qmp_events_filtered(wait=wait):
|
ev = filter_qmp_event(self.events_wait(events))
|
||||||
if ev['event'] == 'JOB_STATUS_CHANGE':
|
if ev['event'] != 'JOB_STATUS_CHANGE':
|
||||||
|
log(ev)
|
||||||
|
continue
|
||||||
status = ev['data']['status']
|
status = ev['data']['status']
|
||||||
if status == 'aborting':
|
if status == 'aborting':
|
||||||
result = self.qmp('query-jobs')
|
result = self.qmp('query-jobs')
|
||||||
@ -562,8 +574,6 @@ class VM(qtest.QEMUQtestMachine):
|
|||||||
self.qmp_log('job-dismiss', id=job)
|
self.qmp_log('job-dismiss', id=job)
|
||||||
elif status == 'null':
|
elif status == 'null':
|
||||||
return error
|
return error
|
||||||
else:
|
|
||||||
log(ev)
|
|
||||||
|
|
||||||
def node_info(self, node_name):
|
def node_info(self, node_name):
|
||||||
nodes = self.qmp('query-named-block-nodes')
|
nodes = self.qmp('query-named-block-nodes')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user