|
|
357786 |
From 36d1b90499cb0b8ab992d249d742de66e6fc24b7 Mon Sep 17 00:00:00 2001
|
|
|
357786 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
Date: Tue, 26 Jun 2018 09:48:55 +0200
|
|
|
357786 |
Subject: [PATCH 86/89] iotests: Fix 219's timing
|
|
|
357786 |
|
|
|
357786 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
Message-id: <20180626094856.6924-73-kwolf@redhat.com>
|
|
|
357786 |
Patchwork-id: 81111
|
|
|
357786 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 72/73] iotests: Fix 219's timing
|
|
|
357786 |
Bugzilla: 1513543
|
|
|
357786 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
357786 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
357786 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
219 has two issues that may lead to sporadic failure, both of which are
|
|
|
357786 |
the result of issuing query-jobs too early after a job has been
|
|
|
357786 |
modified. This can then lead to different results based on whether the
|
|
|
357786 |
modification has taken effect already or not.
|
|
|
357786 |
|
|
|
357786 |
First, query-jobs is issued right after the job has been created.
|
|
|
357786 |
Besides its current progress possibly being in any random state (which
|
|
|
357786 |
has already been taken care of), its total progress too is basically
|
|
|
357786 |
arbitrary, because the job may not yet have been able to determine it.
|
|
|
357786 |
This patch addresses this by just filtering the total progress, like
|
|
|
357786 |
what has been done for the current progress already. However, for more
|
|
|
357786 |
clarity, the filtering is changed to replace the values by a string
|
|
|
357786 |
'FILTERED' instead of deleting them.
|
|
|
357786 |
|
|
|
357786 |
Secondly, query-jobs is issued right after a job has been resumed. The
|
|
|
357786 |
job may or may not yet have had the time to actually perform any I/O,
|
|
|
357786 |
and thus its current progress may or may not have advanced. To make
|
|
|
357786 |
sure it has indeed advanced (which is what the reference output already
|
|
|
357786 |
assumes), keep querying it until it has.
|
|
|
357786 |
|
|
|
357786 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
357786 |
Message-id: 20180606190628.8170-1-mreitz@redhat.com
|
|
|
357786 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
357786 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
357786 |
(cherry picked from commit 83f90b535a0d5e64056c087aa4022ea35c59bcd0)
|
|
|
357786 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
357786 |
---
|
|
|
357786 |
tests/qemu-iotests/219 | 26 ++++++++++++++++++++------
|
|
|
357786 |
tests/qemu-iotests/219.out | 10 +++++-----
|
|
|
357786 |
2 files changed, 25 insertions(+), 11 deletions(-)
|
|
|
357786 |
|
|
|
357786 |
diff --git a/tests/qemu-iotests/219 b/tests/qemu-iotests/219
|
|
|
357786 |
index 898a26e..c03bbdb 100755
|
|
|
357786 |
--- a/tests/qemu-iotests/219
|
|
|
357786 |
+++ b/tests/qemu-iotests/219
|
|
|
357786 |
@@ -42,11 +42,24 @@ def test_pause_resume(vm):
|
|
|
357786 |
iotests.log(vm.qmp(pause_cmd, **{pause_arg: 'job0'}))
|
|
|
357786 |
pause_wait(vm, 'job0')
|
|
|
357786 |
iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
|
|
|
357786 |
- iotests.log(vm.qmp('query-jobs'))
|
|
|
357786 |
+ result = vm.qmp('query-jobs')
|
|
|
357786 |
+ iotests.log(result)
|
|
|
357786 |
+
|
|
|
357786 |
+ old_progress = result['return'][0]['current-progress']
|
|
|
357786 |
+ total_progress = result['return'][0]['total-progress']
|
|
|
357786 |
|
|
|
357786 |
iotests.log(vm.qmp(resume_cmd, **{resume_arg: 'job0'}))
|
|
|
357786 |
iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
|
|
|
357786 |
- iotests.log(vm.qmp('query-jobs'))
|
|
|
357786 |
+ if old_progress < total_progress:
|
|
|
357786 |
+ # Wait for the job to advance
|
|
|
357786 |
+ while result['return'][0]['current-progress'] == old_progress:
|
|
|
357786 |
+ result = vm.qmp('query-jobs')
|
|
|
357786 |
+ iotests.log(result)
|
|
|
357786 |
+ else:
|
|
|
357786 |
+ # Already reached the end, so the job cannot advance
|
|
|
357786 |
+ # any further; therefore, the query-jobs result can be
|
|
|
357786 |
+ # logged immediately
|
|
|
357786 |
+ iotests.log(vm.qmp('query-jobs'))
|
|
|
357786 |
|
|
|
357786 |
def test_job_lifecycle(vm, job, job_args, has_ready=False):
|
|
|
357786 |
iotests.log('')
|
|
|
357786 |
@@ -58,12 +71,13 @@ def test_job_lifecycle(vm, job, job_args, has_ready=False):
|
|
|
357786 |
iotests.log(vm.qmp(job, job_id='job0', **job_args))
|
|
|
357786 |
|
|
|
357786 |
# Depending on the storage, the first request may or may not have completed
|
|
|
357786 |
- # yet, so filter out the progress. Later query-job calls don't need the
|
|
|
357786 |
- # filtering because the progress is made deterministic by the block job
|
|
|
357786 |
- # speed
|
|
|
357786 |
+ # yet (and the total progress may not have been fully determined yet), so
|
|
|
357786 |
+ # filter out the progress. Later query-job calls don't need the filtering
|
|
|
357786 |
+ # because the progress is made deterministic by the block job speed
|
|
|
357786 |
result = vm.qmp('query-jobs')
|
|
|
357786 |
for j in result['return']:
|
|
|
357786 |
- del j['current-progress']
|
|
|
357786 |
+ j['current-progress'] = 'FILTERED'
|
|
|
357786 |
+ j['total-progress'] = 'FILTERED'
|
|
|
357786 |
iotests.log(result)
|
|
|
357786 |
|
|
|
357786 |
# undefined -> created -> running
|
|
|
357786 |
diff --git a/tests/qemu-iotests/219.out b/tests/qemu-iotests/219.out
|
|
|
357786 |
index 346801b..6dc07bc 100644
|
|
|
357786 |
--- a/tests/qemu-iotests/219.out
|
|
|
357786 |
+++ b/tests/qemu-iotests/219.out
|
|
|
357786 |
@@ -3,7 +3,7 @@ Launching VM...
|
|
|
357786 |
|
|
|
357786 |
Starting block job: drive-mirror (auto-finalize: True; auto-dismiss: True)
|
|
|
357786 |
{u'return': {}}
|
|
|
357786 |
-{u'return': [{u'status': u'running', u'total-progress': 4194304, u'id': u'job0', u'type': u'mirror'}]}
|
|
|
357786 |
+{u'return': [{u'status': u'running', u'current-progress': 'FILTERED', u'total-progress': 'FILTERED', u'id': u'job0', u'type': u'mirror'}]}
|
|
|
357786 |
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'status': u'created', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
|
|
|
357786 |
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'status': u'running', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
|
|
|
357786 |
|
|
|
357786 |
@@ -93,7 +93,7 @@ Waiting for PENDING state...
|
|
|
357786 |
|
|
|
357786 |
Starting block job: drive-backup (auto-finalize: True; auto-dismiss: True)
|
|
|
357786 |
{u'return': {}}
|
|
|
357786 |
-{u'return': [{u'status': u'running', u'total-progress': 4194304, u'id': u'job0', u'type': u'backup'}]}
|
|
|
357786 |
+{u'return': [{u'status': u'running', u'current-progress': 'FILTERED', u'total-progress': 'FILTERED', u'id': u'job0', u'type': u'backup'}]}
|
|
|
357786 |
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'status': u'created', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
|
|
|
357786 |
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'status': u'running', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
|
|
|
357786 |
|
|
|
357786 |
@@ -144,7 +144,7 @@ Waiting for PENDING state...
|
|
|
357786 |
|
|
|
357786 |
Starting block job: drive-backup (auto-finalize: True; auto-dismiss: False)
|
|
|
357786 |
{u'return': {}}
|
|
|
357786 |
-{u'return': [{u'status': u'running', u'total-progress': 4194304, u'id': u'job0', u'type': u'backup'}]}
|
|
|
357786 |
+{u'return': [{u'status': u'running', u'current-progress': 'FILTERED', u'total-progress': 'FILTERED', u'id': u'job0', u'type': u'backup'}]}
|
|
|
357786 |
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'status': u'created', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
|
|
|
357786 |
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'status': u'running', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
|
|
|
357786 |
|
|
|
357786 |
@@ -203,7 +203,7 @@ Waiting for PENDING state...
|
|
|
357786 |
|
|
|
357786 |
Starting block job: drive-backup (auto-finalize: False; auto-dismiss: True)
|
|
|
357786 |
{u'return': {}}
|
|
|
357786 |
-{u'return': [{u'status': u'running', u'total-progress': 4194304, u'id': u'job0', u'type': u'backup'}]}
|
|
|
357786 |
+{u'return': [{u'status': u'running', u'current-progress': 'FILTERED', u'total-progress': 'FILTERED', u'id': u'job0', u'type': u'backup'}]}
|
|
|
357786 |
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'status': u'created', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
|
|
|
357786 |
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'status': u'running', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
|
|
|
357786 |
|
|
|
357786 |
@@ -262,7 +262,7 @@ Waiting for PENDING state...
|
|
|
357786 |
|
|
|
357786 |
Starting block job: drive-backup (auto-finalize: False; auto-dismiss: False)
|
|
|
357786 |
{u'return': {}}
|
|
|
357786 |
-{u'return': [{u'status': u'running', u'total-progress': 4194304, u'id': u'job0', u'type': u'backup'}]}
|
|
|
357786 |
+{u'return': [{u'status': u'running', u'current-progress': 'FILTERED', u'total-progress': 'FILTERED', u'id': u'job0', u'type': u'backup'}]}
|
|
|
357786 |
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'status': u'created', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
|
|
|
357786 |
{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'status': u'running', u'id': u'job0'}, u'event': u'JOB_STATUS_CHANGE'}
|
|
|
357786 |
|
|
|
357786 |
--
|
|
|
357786 |
1.8.3.1
|
|
|
357786 |
|