diff options
author | Kevin Wolf <kwolf@redhat.com> | 2019-12-16 17:53:41 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2019-12-19 14:32:43 +0100 |
commit | e9dbd1cae86f7cb6f8e470e1485aeb0c6e23ae64 (patch) | |
tree | 15f600476779a859e33cd5d32673d955cc557b15 /tests/qemu-iotests | |
parent | 66be5c3e7825cab861b3d68e87851a4ac9ff8c3d (diff) | |
download | qemu-e9dbd1cae86f7cb6f8e470e1485aeb0c6e23ae64.zip qemu-e9dbd1cae86f7cb6f8e470e1485aeb0c6e23ae64.tar.gz qemu-e9dbd1cae86f7cb6f8e470e1485aeb0c6e23ae64.tar.bz2 |
iotests: Create VM.blockdev_create()
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 <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests')
-rw-r--r-- | tests/qemu-iotests/iotests.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index b46d298..8739ec6 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=[ |