diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2018-06-01 14:59:23 +0300 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2018-06-11 16:18:45 +0200 |
commit | c1bac161bb7ad27243776e90971c51cc38c2e1b6 (patch) | |
tree | 0d8df90dd097c530e24ad70ba2e13218584205b3 /tests/qemu-iotests | |
parent | 0682854f899d03c78befce9f5aae4a7e37655d25 (diff) | |
download | qemu-c1bac161bb7ad27243776e90971c51cc38c2e1b6.zip qemu-c1bac161bb7ad27243776e90971c51cc38c2e1b6.tar.gz qemu-c1bac161bb7ad27243776e90971c51cc38c2e1b6.tar.bz2 |
iotests: improve pause_job
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>
Diffstat (limited to 'tests/qemu-iotests')
-rw-r--r-- | tests/qemu-iotests/iotests.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 0b204dc..2f22fab 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -590,9 +590,14 @@ class QMPTestCase(unittest.TestCase): 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) |