[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/51] iotests: Mirror with different source/target size
From: |
Kevin Wolf |
Subject: |
[PULL 04/51] iotests: Mirror with different source/target size |
Date: |
Fri, 15 May 2020 14:44:34 +0200 |
This tests that the mirror job catches situations where the target node
has a different size than the source node. It must also forbid resize
operations when the job is already running.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/041 | 45 ++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/041.out | 4 ++--
2 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index 1812dd8479..601c756117 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -240,6 +240,49 @@ class TestSingleBlockdev(TestSingleDrive):
target=self.qmp_target)
self.assert_qmp(result, 'error/class', 'GenericError')
+ def do_test_resize(self, device, node):
+ def pre_finalize():
+ if device:
+ result = self.vm.qmp('block_resize', device=device, size=65536)
+ self.assert_qmp(result, 'error/class', 'GenericError')
+
+ result = self.vm.qmp('block_resize', node_name=node, size=65536)
+ self.assert_qmp(result, 'error/class', 'GenericError')
+
+ result = self.vm.qmp(self.qmp_cmd, job_id='job0', device='drive0',
+ sync='full', target=self.qmp_target,
+ auto_finalize=False, auto_dismiss=False)
+ self.assert_qmp(result, 'return', {})
+
+ result = self.vm.run_job('job0', auto_finalize=False,
+ pre_finalize=pre_finalize)
+ self.assertEqual(result, None)
+
+ def test_source_resize(self):
+ self.do_test_resize('drive0', 'top')
+
+ def test_target_resize(self):
+ self.do_test_resize(None, self.qmp_target)
+
+ def do_test_target_size(self, size):
+ result = self.vm.qmp('block_resize', node_name=self.qmp_target,
+ size=size)
+ self.assert_qmp(result, 'return', {})
+
+ result = self.vm.qmp(self.qmp_cmd, job_id='job0',
+ device='drive0', sync='full', auto_dismiss=False,
+ target=self.qmp_target)
+ self.assert_qmp(result, 'return', {})
+
+ result = self.vm.run_job('job0')
+ self.assertEqual(result, 'Source and target image have different
sizes')
+
+ def test_small_target(self):
+ self.do_test_target_size(self.image_len // 2)
+
+ def test_large_target(self):
+ self.do_test_target_size(self.image_len * 2)
+
test_large_cluster = None
test_image_not_found = None
test_small_buffer2 = None
@@ -251,6 +294,8 @@ class TestSingleDriveZeroLength(TestSingleDrive):
class TestSingleBlockdevZeroLength(TestSingleBlockdev):
image_len = 0
+ test_small_target = None
+ test_large_target = None
class TestSingleDriveUnalignedLength(TestSingleDrive):
image_len = 1025 * 1024
diff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out
index 877b76fd31..53abe11d73 100644
--- a/tests/qemu-iotests/041.out
+++ b/tests/qemu-iotests/041.out
@@ -1,5 +1,5 @@
-..............................................................................................
+........................................................................................................
----------------------------------------------------------------------
-Ran 94 tests
+Ran 104 tests
OK
--
2.25.4
- [PULL 00/51] Block layer patches, Kevin Wolf, 2020/05/15
- [PULL 02/51] iotests/229: Use blkdebug to inject an error, Kevin Wolf, 2020/05/15
- [PULL 01/51] iotests/109: Don't mirror with mismatched size, Kevin Wolf, 2020/05/15
- [PULL 03/51] mirror: Make sure that source and target size match, Kevin Wolf, 2020/05/15
- [PULL 05/51] block/replication.c: Avoid cancelling the job twice, Kevin Wolf, 2020/05/15
- [PULL 04/51] iotests: Mirror with different source/target size,
Kevin Wolf <=
- [PULL 06/51] iotests: Fix incomplete type declarations, Kevin Wolf, 2020/05/15
- [PULL 07/51] iotests: Run pylint and mypy in a testcase, Kevin Wolf, 2020/05/15
- [PULL 11/51] replication: Avoid blk_make_empty() on read-only child, Kevin Wolf, 2020/05/15
- [PULL 08/51] block: Add bdrv_make_empty(), Kevin Wolf, 2020/05/15
- [PULL 09/51] block: Add blk_make_empty(), Kevin Wolf, 2020/05/15
- [PULL 12/51] block: Use bdrv_make_empty() where possible, Kevin Wolf, 2020/05/15
- [PULL 10/51] block: Use blk_make_empty() after commits, Kevin Wolf, 2020/05/15
- [PULL 13/51] block: Mark commit, mirror, blkreplay as filters, Kevin Wolf, 2020/05/15
- [PULL 16/51] block: Add BdrvChildRole and BdrvChildRoleBits, Kevin Wolf, 2020/05/15
- [PULL 20/51] block: Pass parent_is_format to .inherit_options(), Kevin Wolf, 2020/05/15