Skip to content

Commit

Permalink
iotests: improve pause_job
Browse files Browse the repository at this point in the history
It's possible, that job was finished during waiting. In this case we
will see error message "Timeout waiting for job to pause" which is not
very informative. So, let's check during waiting iteration that the job
exists.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20180601115923.17159-1-vsementsov@virtuozzo.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
  • Loading branch information
Vladimir Sementsov-Ogievskiy authored and XanClic committed Jun 11, 2018
1 parent 0682854 commit c1bac16
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/qemu-iotests/iotests.py
Expand Up @@ -590,9 +590,14 @@ def pause_wait(self, job_id='job0'):
with Timeout(1, "Timeout waiting for job to pause"):
while True:
result = self.vm.qmp('query-block-jobs')
found = False
for job in result['return']:
if job['device'] == job_id and job['paused'] == True and job['busy'] == False:
return job
if job['device'] == job_id:
found = True
if job['paused'] == True and job['busy'] == False:
return job
break
assert found

def pause_job(self, job_id='job0', wait=True):
result = self.vm.qmp('block-job-pause', device=job_id)
Expand Down

0 comments on commit c1bac16

Please sign in to comment.