[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/10] iotests: Create VM.blockdev_create()
From: |
Kevin Wolf |
Subject: |
[PATCH 01/10] iotests: Create VM.blockdev_create() |
Date: |
Mon, 16 Dec 2019 18:08:48 +0100 |
We have several almost identical copies of a blockdev_create() function
in different test cases. Time to create one unified function in
iotests.py.
To keep the diff managable, this patch only creates the function and
follow-up patches will convert the individual test cases.
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/iotests.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index b46d298766..8739ec6613 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -643,6 +643,22 @@ class VM(qtest.QEMUQtestMachine):
elif status == 'null':
return error
+ # Returns None on success, and an error string on failure
+ def blockdev_create(self, options, job_id='job0', filters=None):
+ if filters is None:
+ filters = [filter_qmp_testfiles]
+ result = self.qmp_log('blockdev-create', filters=filters,
+ job_id=job_id, options=options)
+
+ if 'return' in result:
+ assert result['return'] == {}
+ job_result = self.run_job(job_id)
+ else:
+ job_result = result['error']
+
+ log("")
+ return job_result
+
def enable_migration_events(self, name):
log('Enabling migration QMP events on %s...' % name)
log(self.qmp('migrate-set-capabilities', capabilities=[
--
2.20.1
- [PATCH 00/10] iotests: Remove duplicated blockdev_create(), Kevin Wolf, 2019/12/16
- [PATCH 02/10] iotests: 255: Drop blockdev_create(), Kevin Wolf, 2019/12/16
- [PATCH 01/10] iotests: Create VM.blockdev_create(),
Kevin Wolf <=
- [PATCH 04/10] iotests: 210: Convert to VM.blockdev_create(), Kevin Wolf, 2019/12/16
- [PATCH 03/10] iotests: 206: Convert to VM.blockdev_create(), Kevin Wolf, 2019/12/16
- [PATCH 05/10] iotests: 212: Convert to VM.blockdev_create(), Kevin Wolf, 2019/12/16
- [PATCH 06/10] iotests: 213: Convert to VM.blockdev_create(), Kevin Wolf, 2019/12/16
- [PATCH 10/10] iotests: 211: Remove duplication with VM.blockdev_create(), Kevin Wolf, 2019/12/16
- [PATCH 07/10] iotests: 237: Convert to VM.blockdev_create(), Kevin Wolf, 2019/12/16
- [PATCH 08/10] iotests: 266: Convert to VM.blockdev_create(), Kevin Wolf, 2019/12/16
- [PATCH 09/10] iotests: 207: Remove duplication with VM.blockdev_create(), Kevin Wolf, 2019/12/16