[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PULL 14/36] iotests: teach run_job to cancel pending jobs
From: |
John Snow |
Subject: |
[Qemu-stable] [PULL 14/36] iotests: teach run_job to cancel pending jobs |
Date: |
Fri, 16 Aug 2019 19:12:56 -0400 |
run_job can cancel pending jobs to simulate failure. This lets us use
the pending callback to issue test commands while the job is open, but
then still have the job fail in the end.
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Message-id: address@hidden
[Maintainer edit: Merge conflict resolution in run_job]
Signed-off-by: John Snow <address@hidden>
---
tests/qemu-iotests/iotests.py | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 7fc062cdcf4..81ae7b911ac 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -541,7 +541,23 @@ class VM(qtest.QEMUQtestMachine):
# Returns None on success, and an error string on failure
def run_job(self, job, auto_finalize=True, auto_dismiss=False,
- pre_finalize=None, use_log=True, wait=60.0):
+ pre_finalize=None, cancel=False, use_log=True, wait=60.0):
+ """
+ run_job moves a job from creation through to dismissal.
+
+ :param job: String. ID of recently-launched job
+ :param auto_finalize: Bool. True if the job was launched with
+ auto_finalize. Defaults to True.
+ :param auto_dismiss: Bool. True if the job was launched with
+ auto_dismiss=True. Defaults to False.
+ :param pre_finalize: Callback. A callable that takes no arguments to be
+ invoked prior to issuing job-finalize, if any.
+ :param cancel: Bool. When true, cancels the job after the pre_finalize
+ callback.
+ :param use_log: Bool. When false, does not log QMP messages.
+ :param wait: Float. Timeout value specifying how long to wait for any
+ event, in seconds. Defaults to 60.0.
+ """
match_device = {'data': {'device': job}}
match_id = {'data': {'id': job}}
events = [
@@ -570,7 +586,11 @@ class VM(qtest.QEMUQtestMachine):
elif status == 'pending' and not auto_finalize:
if pre_finalize:
pre_finalize()
- if use_log:
+ if cancel and use_log:
+ self.qmp_log('job-cancel', id=job)
+ elif cancel:
+ self.qmp('job-cancel', id=job)
+ elif use_log:
self.qmp_log('job-finalize', id=job)
else:
self.qmp('job-finalize', id=job)
--
2.21.0
- [Qemu-stable] [PULL 03/36] blockdev-backup: utilize do_backup_common, (continued)
- [Qemu-stable] [PULL 03/36] blockdev-backup: utilize do_backup_common, John Snow, 2019/08/16
- [Qemu-stable] [PULL 04/36] qapi: add BitmapSyncMode enum, John Snow, 2019/08/16
- [Qemu-stable] [PULL 07/36] hbitmap: Fix merge when b is empty, and result is not an alias of a, John Snow, 2019/08/16
- [Qemu-stable] [PULL 06/36] block/backup: add 'never' policy to bitmap sync mode, John Snow, 2019/08/16
- [Qemu-stable] [PULL 08/36] hbitmap: enable merging across granularities, John Snow, 2019/08/16
- [Qemu-stable] [PULL 01/36] qapi/block-core: Introduce BackupCommon, John Snow, 2019/08/16
- [Qemu-stable] [PULL 09/36] block/dirty-bitmap: add bdrv_dirty_bitmap_merge_internal, John Snow, 2019/08/16
- [Qemu-stable] [PULL 02/36] drive-backup: create do_backup_common, John Snow, 2019/08/16
- [Qemu-stable] [PULL 12/36] block/backup: add 'always' bitmap sync policy, John Snow, 2019/08/16
- [Qemu-stable] [PULL 10/36] block/dirty-bitmap: add bdrv_dirty_bitmap_get, John Snow, 2019/08/16
- [Qemu-stable] [PULL 14/36] iotests: teach run_job to cancel pending jobs,
John Snow <=
- [Qemu-stable] [PULL 05/36] block/backup: Add mirror sync mode 'bitmap', John Snow, 2019/08/16
- [Qemu-stable] [PULL 11/36] block/backup: upgrade copy_bitmap to BdrvDirtyBitmap, John Snow, 2019/08/16
- [Qemu-stable] [PULL 16/36] iotests: Add virtio-scsi device helper, John Snow, 2019/08/16
- [Qemu-stable] [PULL 15/36] iotests: teach FilePath to produce multiple paths, John Snow, 2019/08/16
- [Qemu-stable] [PULL 13/36] iotests: add testing shim for script-style python tests, John Snow, 2019/08/16
- [Qemu-stable] [PULL 18/36] block/backup: loosen restriction on readonly bitmaps, John Snow, 2019/08/16
- [Qemu-stable] [PULL 19/36] blockdev: reduce aio_context locked sections in bitmap add/remove, John Snow, 2019/08/16
- [Qemu-stable] [PULL 21/36] iotests: test bitmap moving inside 254, John Snow, 2019/08/16
- [Qemu-stable] [PULL 22/36] iotests/257: add Pattern class, John Snow, 2019/08/16
- [Qemu-stable] [PULL 20/36] qapi: implement block-dirty-bitmap-remove transaction action, John Snow, 2019/08/16