|
|
26ba25 |
From e589d367bbab2f9e30ea0896cf7728b8a296f407 Mon Sep 17 00:00:00 2001
|
|
|
26ba25 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Date: Tue, 26 Jun 2018 09:48:44 +0200
|
|
|
26ba25 |
Subject: [PATCH 136/268] qemu-iotests: Add VM.run_job()
|
|
|
26ba25 |
|
|
|
26ba25 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Message-id: <20180626094856.6924-62-kwolf@redhat.com>
|
|
|
26ba25 |
Patchwork-id: 81080
|
|
|
26ba25 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 61/73] qemu-iotests: Add VM.run_job()
|
|
|
26ba25 |
Bugzilla: 1513543
|
|
|
26ba25 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
26ba25 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
26ba25 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
26ba25 |
|
|
|
26ba25 |
Add an iotests.py function that runs a job and only returns when it is
|
|
|
26ba25 |
destroyed. An error is logged when the job failed and job-finalize and
|
|
|
26ba25 |
job-dismiss commands are issued if necessary.
|
|
|
26ba25 |
|
|
|
26ba25 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
26ba25 |
Reviewed-by: Jeff Cody <jcody@redhat.com>
|
|
|
26ba25 |
(cherry picked from commit fc47d8513b45b1968b0ae32d4bb2f96d3aca066a)
|
|
|
26ba25 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
26ba25 |
---
|
|
|
26ba25 |
tests/qemu-iotests/iotests.py | 19 +++++++++++++++++++
|
|
|
26ba25 |
1 file changed, 19 insertions(+)
|
|
|
26ba25 |
|
|
|
26ba25 |
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
|
|
|
26ba25 |
index db4206f..2b47062 100644
|
|
|
26ba25 |
--- a/tests/qemu-iotests/iotests.py
|
|
|
26ba25 |
+++ b/tests/qemu-iotests/iotests.py
|
|
|
26ba25 |
@@ -428,6 +428,25 @@ class VM(qtest.QEMUQtestMachine):
|
|
|
26ba25 |
log(str(result), filters)
|
|
|
26ba25 |
return result
|
|
|
26ba25 |
|
|
|
26ba25 |
+ def run_job(self, job, auto_finalize=True, auto_dismiss=False):
|
|
|
26ba25 |
+ while True:
|
|
|
26ba25 |
+ for ev in self.get_qmp_events_filtered(wait=True):
|
|
|
26ba25 |
+ if ev['event'] == 'JOB_STATUS_CHANGE':
|
|
|
26ba25 |
+ status = ev['data']['status']
|
|
|
26ba25 |
+ if status == 'aborting':
|
|
|
26ba25 |
+ result = self.qmp('query-jobs')
|
|
|
26ba25 |
+ for j in result['return']:
|
|
|
26ba25 |
+ if j['id'] == job:
|
|
|
26ba25 |
+ log('Job failed: %s' % (j['error']))
|
|
|
26ba25 |
+ elif status == 'pending' and not auto_finalize:
|
|
|
26ba25 |
+ self.qmp_log('job-finalize', id=job)
|
|
|
26ba25 |
+ elif status == 'concluded' and not auto_dismiss:
|
|
|
26ba25 |
+ self.qmp_log('job-dismiss', id=job)
|
|
|
26ba25 |
+ elif status == 'null':
|
|
|
26ba25 |
+ return
|
|
|
26ba25 |
+ else:
|
|
|
26ba25 |
+ iotests.log(ev)
|
|
|
26ba25 |
+
|
|
|
26ba25 |
|
|
|
26ba25 |
index_re = re.compile(r'([^\[]+)\[([^\]]+)\]')
|
|
|
26ba25 |
|
|
|
26ba25 |
--
|
|
|
26ba25 |
1.8.3.1
|
|
|
26ba25 |
|