[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 22/29] qemu-iotests: Test streaming to a Quorum child
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 22/29] qemu-iotests: Test streaming to a Quorum child |
Date: |
Mon, 31 Oct 2016 18:25:51 +0100 |
From: Alberto Garcia <address@hidden>
Quorum children are special in the sense that they're not directly
attached to a block backend but they're not used as backing images
either. However the intermediate block streaming code supports
streaming to them. This is a test case for that scenario.
Signed-off-by: Alberto Garcia <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/030 | 56 ++++++++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/030.out | 4 ++--
2 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index 83aeaa6..783a1b8 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -347,6 +347,62 @@ class TestParallelOps(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
+class TestQuorum(iotests.QMPTestCase):
+ num_children = 3
+ children = []
+ backing = []
+
+ def setUp(self):
+ opts = ['driver=quorum', 'vote-threshold=2']
+
+ # Initialize file names and command-line options
+ for i in range(self.num_children):
+ child_img = os.path.join(iotests.test_dir, 'img-%d.img' % i)
+ backing_img = os.path.join(iotests.test_dir, 'backing-%d.img' % i)
+ self.children.append(child_img)
+ self.backing.append(backing_img)
+ qemu_img('create', '-f', iotests.imgfmt, backing_img, '1M')
+ qemu_io('-f', iotests.imgfmt,
+ '-c', 'write -P 0x55 0 1024', backing_img)
+ qemu_img('create', '-f', iotests.imgfmt,
+ '-o', 'backing_file=%s' % backing_img, child_img)
+ opts.append("children.%d.file.filename=%s" % (i, child_img))
+ opts.append("children.%d.node-name=node%d" % (i, i))
+
+ # Attach the drive to the VM
+ self.vm = iotests.VM()
+ self.vm.add_drive(path = None, opts = ','.join(opts))
+ self.vm.launch()
+
+ def tearDown(self):
+ self.vm.shutdown()
+ for img in self.children:
+ os.remove(img)
+ for img in self.backing:
+ os.remove(img)
+
+ def test_stream_quorum(self):
+ if not iotests.supports_quorum():
+ return
+
+ self.assertNotEqual(qemu_io('-f', iotests.imgfmt, '-c', 'map',
self.children[0]),
+ qemu_io('-f', iotests.imgfmt, '-c', 'map',
self.backing[0]),
+ 'image file map matches backing file before
streaming')
+
+ self.assert_no_active_block_jobs()
+
+ result = self.vm.qmp('block-stream', device='node0',
job_id='stream-node0')
+ self.assert_qmp(result, 'return', {})
+
+ self.wait_until_completed(drive='stream-node0')
+
+ self.assert_no_active_block_jobs()
+ self.vm.shutdown()
+
+ self.assertEqual(qemu_io('-f', iotests.imgfmt, '-c', 'map',
self.children[0]),
+ qemu_io('-f', iotests.imgfmt, '-c', 'map',
self.backing[0]),
+ 'image file map does not match backing file after
streaming')
+
class TestSmallerBackingFile(iotests.QMPTestCase):
backing_len = 1 * 1024 * 1024 # MB
image_len = 2 * backing_len
diff --git a/tests/qemu-iotests/030.out b/tests/qemu-iotests/030.out
index 3a89159..c6a10f8 100644
--- a/tests/qemu-iotests/030.out
+++ b/tests/qemu-iotests/030.out
@@ -1,5 +1,5 @@
-....................
+.....................
----------------------------------------------------------------------
-Ran 20 tests
+Ran 21 tests
OK
--
1.8.3.1
- [Qemu-devel] [PULL 10/29] block: Use block_job_add_bdrv() in backup_start(), (continued)
- [Qemu-devel] [PULL 10/29] block: Use block_job_add_bdrv() in backup_start(), Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 03/29] block/ssh: Add InetSocketAddress and accept it, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 11/29] block: Check blockers in all nodes involved in a block-commit job, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 14/29] block: Support streaming to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 13/29] block: Block all intermediate nodes in commit_active_start(), Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 15/29] block: Add QMP support for streaming to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 12/29] block: Block all nodes involved in the block-commit operation, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 16/29] docs: Document how to stream to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 17/29] qemu-iotests: Test streaming to an intermediate layer, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 18/29] qemu-iotests: Test block-stream operations in parallel, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 22/29] qemu-iotests: Test streaming to a Quorum child,
Kevin Wolf <=
- [Qemu-devel] [PULL 20/29] qemu-iotests: Test block-stream and block-commit in parallel, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 21/29] qemu-iotests: Add iotests.supports_quorum(), Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 19/29] qemu-iotests: Test overlapping stream and commit operations, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 24/29] qemu-iotests: Test the 'base-node' parameter of 'block-stream', Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 23/29] block: Add 'base-node' parameter to the 'block-stream' command, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 27/29] block: Mention replication in BlockdevDriver enum docs, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 29/29] qapi: allow blockdev-add for NFS, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 25/29] raw_bsd: add offset and size options, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 26/29] qemu-iotests: test 'offset' and 'size' options in raw driver, Kevin Wolf, 2016/10/31
- [Qemu-devel] [PULL 28/29] block/nfs: Introduce runtime_opts in NFS, Kevin Wolf, 2016/10/31