[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/34] iotests: Add test for failing mirror complete
From: |
Max Reitz |
Subject: |
[PULL 05/34] iotests: Add test for failing mirror complete |
Date: |
Mon, 6 Jan 2020 15:41:37 +0100 |
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Tested-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: John Snow <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/041 | 44 ++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/041.out | 4 ++--
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index 8568426311..d7be30b62b 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -1121,6 +1121,50 @@ class TestOrphanedSource(iotests.QMPTestCase):
target='dest-ro')
self.assert_qmp(result, 'error/class', 'GenericError')
+ def test_failing_permission_in_complete(self):
+ self.assert_no_active_block_jobs()
+
+ # Unshare consistent-read on the target
+ # (The mirror job does not care)
+ result = self.vm.qmp('blockdev-add',
+ driver='blkdebug',
+ node_name='dest-perm',
+ image='dest',
+ unshare_child_perms=['consistent-read'])
+ self.assert_qmp(result, 'return', {})
+
+ result = self.vm.qmp('blockdev-mirror', job_id='job', device='src',
+ sync='full', target='dest',
+ filter_node_name='mirror-filter')
+ self.assert_qmp(result, 'return', {})
+
+ # Require consistent-read on the source
+ # (We can only add this node once the job has started, or it
+ # will complain that it does not want to run on non-root nodes)
+ result = self.vm.qmp('blockdev-add',
+ driver='blkdebug',
+ node_name='src-perm',
+ image='src',
+ take_child_perms=['consistent-read'])
+ self.assert_qmp(result, 'return', {})
+
+ # While completing, mirror will attempt to replace src by
+ # dest, which must fail because src-perm requires
+ # consistent-read but dest-perm does not share it; thus
+ # aborting the job when it is supposed to complete
+ self.complete_and_wait('job',
+ completion_error='Operation not permitted')
+
+ # Assert that all of our nodes are still there (except for the
+ # mirror filter, which should be gone despite the failure)
+ nodes = self.vm.qmp('query-named-block-nodes')['return']
+ nodes = [node['node-name'] for node in nodes]
+
+ for expect in ('src', 'src-perm', 'dest', 'dest-perm'):
+ self.assertTrue(expect in nodes, '%s disappeared' % expect)
+ self.assertFalse('mirror-filter' in nodes,
+ 'Mirror filter node did not disappear')
+
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2', 'qed'],
supported_protocols=['file'])
diff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out
index 2c448b4239..f496be9197 100644
--- a/tests/qemu-iotests/041.out
+++ b/tests/qemu-iotests/041.out
@@ -1,5 +1,5 @@
-..........................................................................................
+...........................................................................................
----------------------------------------------------------------------
-Ran 90 tests
+Ran 91 tests
OK
--
2.24.1
- [PULL 00/34] Block patches, Max Reitz, 2020/01/06
- [PULL 01/34] block: Add bdrv_qapi_perm_to_blk_perm(), Max Reitz, 2020/01/06
- [PULL 02/34] block: Use bdrv_qapi_perm_to_blk_perm(), Max Reitz, 2020/01/06
- [PULL 03/34] blkdebug: Allow taking/unsharing permissions, Max Reitz, 2020/01/06
- [PULL 04/34] iotests: Add @error to wait_until_completed, Max Reitz, 2020/01/06
- [PULL 05/34] iotests: Add test for failing mirror complete,
Max Reitz <=
- [PULL 06/34] throttle-groups: fix memory leak in throttle_group_set_limit:, Max Reitz, 2020/01/06
- [PULL 07/34] qcow2-bitmaps: fix qcow2_can_store_new_dirty_bitmap, Max Reitz, 2020/01/06
- [PULL 08/34] iotests: s/qocw2/qcow2/, Max Reitz, 2020/01/06
- [PULL 09/34] iotests/qcow2.py: Add dump-header-exts, Max Reitz, 2020/01/06
- [PULL 11/34] iotests: Add _filter_json_filename, Max Reitz, 2020/01/06
- [PULL 10/34] iotests/qcow2.py: Split feature fields into bits, Max Reitz, 2020/01/06
- [PULL 12/34] iotests: Filter refcount_order in 036, Max Reitz, 2020/01/06
- [PULL 13/34] iotests: Replace IMGOPTS by _unsupported_imgopts, Max Reitz, 2020/01/06
- [PULL 14/34] iotests: Drop compat=1.1 in 050, Max Reitz, 2020/01/06
- [PULL 15/34] iotests: Let _make_test_img parse its parameters, Max Reitz, 2020/01/06