[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 36/36] iotests: Check that @replaces can replace filters
From: |
Kevin Wolf |
Subject: |
[PULL 36/36] iotests: Check that @replaces can replace filters |
Date: |
Tue, 18 Feb 2020 15:07:22 +0100 |
From: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/041 | 46 ++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/041.out | 4 ++--
2 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index 7af6de9124..5d67bf14bf 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -1190,6 +1190,52 @@ class TestOrphanedSource(iotests.QMPTestCase):
self.assertFalse('mirror-filter' in nodes,
'Mirror filter node did not disappear')
+# Test cases for @replaces that do not necessarily involve Quorum
+class TestReplaces(iotests.QMPTestCase):
+ # Each of these test cases needs their own block graph, so do not
+ # create any nodes here
+ def setUp(self):
+ self.vm = iotests.VM()
+ self.vm.launch()
+
+ def tearDown(self):
+ self.vm.shutdown()
+ for img in (test_img, target_img):
+ try:
+ os.remove(img)
+ except OSError:
+ pass
+
+ @iotests.skip_if_unsupported(['copy-on-read'])
+ def test_replace_filter(self):
+ """
+ Check that we can replace filter nodes.
+ """
+ result = self.vm.qmp('blockdev-add', **{
+ 'driver': 'copy-on-read',
+ 'node-name': 'filter0',
+ 'file': {
+ 'driver': 'copy-on-read',
+ 'node-name': 'filter1',
+ 'file': {
+ 'driver': 'null-co'
+ }
+ }
+ })
+ self.assert_qmp(result, 'return', {})
+
+ result = self.vm.qmp('blockdev-add',
+ node_name='target', driver='null-co')
+ self.assert_qmp(result, 'return', {})
+
+ result = self.vm.qmp('blockdev-mirror', job_id='mirror',
device='filter0',
+ target='target', sync='full', replaces='filter1')
+ self.assert_qmp(result, 'return', {})
+
+ self.complete_and_wait('mirror')
+
+ self.vm.assert_block_path('filter0', '/file', 'target')
+
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 ffc779b4d1..877b76fd31 100644
--- a/tests/qemu-iotests/041.out
+++ b/tests/qemu-iotests/041.out
@@ -1,5 +1,5 @@
-.............................................................................................
+..............................................................................................
----------------------------------------------------------------------
-Ran 93 tests
+Ran 94 tests
OK
--
2.20.1
- [PULL 27/36] block: Remove bdrv_recurse_is_first_non_filter(), (continued)
- [PULL 27/36] block: Remove bdrv_recurse_is_first_non_filter(), Kevin Wolf, 2020/02/18
- [PULL 26/36] block: Use bdrv_recurse_can_replace(), Kevin Wolf, 2020/02/18
- [PULL 28/36] mirror: Double-check immediately before replacing, Kevin Wolf, 2020/02/18
- [PULL 29/36] quorum: Stop marking it as a filter, Kevin Wolf, 2020/02/18
- [PULL 31/36] iotests: Add VM.assert_block_path(), Kevin Wolf, 2020/02/18
- [PULL 30/36] iotests: Use complete_and_wait() in 155, Kevin Wolf, 2020/02/18
- [PULL 33/36] iotests: Resolve TODOs in 041, Kevin Wolf, 2020/02/18
- [PULL 32/36] iotests/041: Drop superfluous shutdowns, Kevin Wolf, 2020/02/18
- [PULL 34/36] iotests: Use self.image_len in TestRepairQuorum, Kevin Wolf, 2020/02/18
- [PULL 35/36] iotests: Add tests for invalid Quorum @replaces, Kevin Wolf, 2020/02/18
- [PULL 36/36] iotests: Check that @replaces can replace filters,
Kevin Wolf <=
- Re: [PULL 00/36] Block layer patches, Peter Maydell, 2020/02/20