[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 23/29] iotests: Fix 219's timing
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL 23/29] iotests: Fix 219's timing |
Date: |
Mon, 11 Jun 2018 16:26:05 +0200 |
219 has two issues that may lead to sporadic failure, both of which are
the result of issuing query-jobs too early after a job has been
modified. This can then lead to different results based on whether the
modification has taken effect already or not.
First, query-jobs is issued right after the job has been created.
Besides its current progress possibly being in any random state (which
has already been taken care of), its total progress too is basically
arbitrary, because the job may not yet have been able to determine it.
This patch addresses this by just filtering the total progress, like
what has been done for the current progress already. However, for more
clarity, the filtering is changed to replace the values by a string
'FILTERED' instead of deleting them.
Secondly, query-jobs is issued right after a job has been resumed. The
job may or may not yet have had the time to actually perform any I/O,
and thus its current progress may or may not have advanced. To make
sure it has indeed advanced (which is what the reference output already
assumes), keep querying it until it has.
Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/219 | 26 ++++++++++++++++++++------
tests/qemu-iotests/219.out | 10 +++++-----
2 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/tests/qemu-iotests/219 b/tests/qemu-iotests/219
index 898a26eef0..c03bbdb294 100755
--- a/tests/qemu-iotests/219
+++ b/tests/qemu-iotests/219
@@ -42,11 +42,24 @@ def test_pause_resume(vm):
iotests.log(vm.qmp(pause_cmd, **{pause_arg: 'job0'}))
pause_wait(vm, 'job0')
iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
- iotests.log(vm.qmp('query-jobs'))
+ result = vm.qmp('query-jobs')
+ iotests.log(result)
+
+ old_progress = result['return'][0]['current-progress']
+ total_progress = result['return'][0]['total-progress']
iotests.log(vm.qmp(resume_cmd, **{resume_arg: 'job0'}))
iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
- iotests.log(vm.qmp('query-jobs'))
+ if old_progress < total_progress:
+ # Wait for the job to advance
+ while result['return'][0]['current-progress'] == old_progress:
+ result = vm.qmp('query-jobs')
+ iotests.log(result)
+ else:
+ # Already reached the end, so the job cannot advance
+ # any further; therefore, the query-jobs result can be
+ # logged immediately
+ iotests.log(vm.qmp('query-jobs'))
def test_job_lifecycle(vm, job, job_args, has_ready=False):
iotests.log('')
@@ -58,12 +71,13 @@ def test_job_lifecycle(vm, job, job_args, has_ready=False):
iotests.log(vm.qmp(job, job_id='job0', **job_args))
# Depending on the storage, the first request may or may not have completed
- # yet, so filter out the progress. Later query-job calls don't need the
- # filtering because the progress is made deterministic by the block job
- # speed
+ # yet (and the total progress may not have been fully determined yet), so
+ # filter out the progress. Later query-job calls don't need the filtering
+ # because the progress is made deterministic by the block job speed
result = vm.qmp('query-jobs')
for j in result['return']:
- del j['current-progress']
+ j['current-progress'] = 'FILTERED'
+ j['total-progress'] = 'FILTERED'
iotests.log(result)
# undefined -> created -> running
diff --git a/tests/qemu-iotests/219.out b/tests/qemu-iotests/219.out
index 346801b655..6dc07bc41e 100644
--- a/tests/qemu-iotests/219.out
+++ b/tests/qemu-iotests/219.out
@@ -3,7 +3,7 @@ Launching VM...
Starting block job: drive-mirror (auto-finalize: True; auto-dismiss: True)
{u'return': {}}
-{u'return': [{u'status': u'running', u'total-progress': 4194304, u'id':
u'job0', u'type': u'mirror'}]}
+{u'return': [{u'status': u'running', u'current-progress': 'FILTERED',
u'total-progress': 'FILTERED', u'id': u'job0', u'type': u'mirror'}]}
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'created', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'running', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
@@ -93,7 +93,7 @@ Waiting for PENDING state...
Starting block job: drive-backup (auto-finalize: True; auto-dismiss: True)
{u'return': {}}
-{u'return': [{u'status': u'running', u'total-progress': 4194304, u'id':
u'job0', u'type': u'backup'}]}
+{u'return': [{u'status': u'running', u'current-progress': 'FILTERED',
u'total-progress': 'FILTERED', u'id': u'job0', u'type': u'backup'}]}
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'created', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'running', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
@@ -144,7 +144,7 @@ Waiting for PENDING state...
Starting block job: drive-backup (auto-finalize: True; auto-dismiss: False)
{u'return': {}}
-{u'return': [{u'status': u'running', u'total-progress': 4194304, u'id':
u'job0', u'type': u'backup'}]}
+{u'return': [{u'status': u'running', u'current-progress': 'FILTERED',
u'total-progress': 'FILTERED', u'id': u'job0', u'type': u'backup'}]}
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'created', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'running', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
@@ -203,7 +203,7 @@ Waiting for PENDING state...
Starting block job: drive-backup (auto-finalize: False; auto-dismiss: True)
{u'return': {}}
-{u'return': [{u'status': u'running', u'total-progress': 4194304, u'id':
u'job0', u'type': u'backup'}]}
+{u'return': [{u'status': u'running', u'current-progress': 'FILTERED',
u'total-progress': 'FILTERED', u'id': u'job0', u'type': u'backup'}]}
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'created', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'running', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
@@ -262,7 +262,7 @@ Waiting for PENDING state...
Starting block job: drive-backup (auto-finalize: False; auto-dismiss: False)
{u'return': {}}
-{u'return': [{u'status': u'running', u'total-progress': 4194304, u'id':
u'job0', u'type': u'backup'}]}
+{u'return': [{u'status': u'running', u'current-progress': 'FILTERED',
u'total-progress': 'FILTERED', u'id': u'job0', u'type': u'backup'}]}
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'created', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data':
{u'status': u'running', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
--
2.17.1
- [Qemu-devel] [PULL 16/29] iotests.py: Add qemu_io_silent, (continued)
- [Qemu-devel] [PULL 16/29] iotests.py: Add qemu_io_silent, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 18/29] qemu-img: Resolve relative backing paths in rebase, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 17/29] iotests: Let 216 make use of qemu-io's exit code, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 19/29] iotests: Add test for rebasing with relative paths, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 14/29] qemu-io: Let command functions return error code, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 20/29] qemu-img: Special post-backing convert handling, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 22/29] iotests: improve pause_job, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 13/29] qemu-io: Drop command functions' return values, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 21/29] iotests: Test post-backing convert target behavior, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 26/29] throttle: Fix crash on reopen, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 23/29] iotests: Fix 219's timing,
Max Reitz <=
- [Qemu-devel] [PULL 25/29] block/qcow2-bitmap: fix free_bitmap_clusters, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 27/29] block: Make bdrv_is_writable() public, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 24/29] qemu-img: Remove deprecated -s snapshot_id_or_name option, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 28/29] qcow2: Do not mark inactive images corrupt, Max Reitz, 2018/06/11
- [Qemu-devel] [PULL 29/29] iotests: Add case for a corrupted inactive image, Max Reitz, 2018/06/11
- Re: [Qemu-devel] [PULL 00/29] Block patches, Peter Maydell, 2018/06/11