Blame SOURCES/kvm-iotests-improve-pause_job.patch

1bdc94
From 438c9fb5fd117816c960ad2995e53a627d2df4c5 Mon Sep 17 00:00:00 2001
1bdc94
From: Kevin Wolf <kwolf@redhat.com>
1bdc94
Date: Tue, 26 Jun 2018 09:48:56 +0200
1bdc94
Subject: [PATCH 87/89] iotests: improve pause_job
1bdc94
1bdc94
RH-Author: Kevin Wolf <kwolf@redhat.com>
1bdc94
Message-id: <20180626094856.6924-74-kwolf@redhat.com>
1bdc94
Patchwork-id: 81118
1bdc94
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 73/73] iotests: improve pause_job
1bdc94
Bugzilla: 1513543
1bdc94
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
1bdc94
RH-Acked-by: Max Reitz <mreitz@redhat.com>
1bdc94
RH-Acked-by: Fam Zheng <famz@redhat.com>
1bdc94
1bdc94
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1bdc94
1bdc94
It's possible, that job was finished during waiting. In this case we
1bdc94
will see error message "Timeout waiting for job to pause" which is not
1bdc94
very informative. So, let's check during waiting iteration that the job
1bdc94
exists.
1bdc94
1bdc94
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1bdc94
Message-id: 20180601115923.17159-1-vsementsov@virtuozzo.com
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
(cherry picked from commit c1bac161bb7ad27243776e90971c51cc38c2e1b6)
1bdc94
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 tests/qemu-iotests/iotests.py | 9 +++++++--
1bdc94
 1 file changed, 7 insertions(+), 2 deletions(-)
1bdc94
1bdc94
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
1bdc94
index 0b204dc..2f22fab 100644
1bdc94
--- a/tests/qemu-iotests/iotests.py
1bdc94
+++ b/tests/qemu-iotests/iotests.py
1bdc94
@@ -590,9 +590,14 @@ class QMPTestCase(unittest.TestCase):
1bdc94
         with Timeout(1, "Timeout waiting for job to pause"):
1bdc94
             while True:
1bdc94
                 result = self.vm.qmp('query-block-jobs')
1bdc94
+                found = False
1bdc94
                 for job in result['return']:
1bdc94
-                    if job['device'] == job_id and job['paused'] == True and job['busy'] == False:
1bdc94
-                        return job
1bdc94
+                    if job['device'] == job_id:
1bdc94
+                        found = True
1bdc94
+                        if job['paused'] == True and job['busy'] == False:
1bdc94
+                            return job
1bdc94
+                        break
1bdc94
+                assert found
1bdc94
 
1bdc94
     def pause_job(self, job_id='job0', wait=True):
1bdc94
         result = self.vm.qmp('block-job-pause', device=job_id)
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94