[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 21/29] qemu-iotests: Add iotests.supports_quorum()
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 21/29] qemu-iotests: Add iotests.supports_quorum() |
Date: |
Mon, 31 Oct 2016 18:25:50 +0100 |
From: Alberto Garcia <address@hidden>
There's many tests that need Quorum support in order to run. At the
moment each test implements its own check to see if Quorum is
enabled. This patch centralizes all those checks in a new function
called iotests.supports_quorum().
Signed-off-by: Alberto Garcia <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/041 | 27 ++++++++++++---------------
tests/qemu-iotests/139 | 3 ++-
tests/qemu-iotests/iotests.py | 5 ++++-
3 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index 30e628f..bc6cf78 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -760,9 +760,6 @@ class TestRepairQuorum(iotests.QMPTestCase):
image_len = 1 * 1024 * 1024 # MB
IMAGES = [ quorum_img1, quorum_img2, quorum_img3 ]
- def has_quorum(self):
- return 'quorum' in iotests.qemu_img_pipe('--help')
-
def setUp(self):
self.vm = iotests.VM()
@@ -783,7 +780,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
#assemble the quorum block device from the individual files
args = { "driver": "quorum", "node-name": "quorum0",
"vote-threshold": 2, "children": [ "img0", "img1", "img2" ] }
- if self.has_quorum():
+ if iotests.supports_quorum():
result = self.vm.qmp("blockdev-add", **args)
self.assert_qmp(result, 'return', {})
@@ -798,7 +795,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
pass
def test_complete(self):
- if not self.has_quorum():
+ if not iotests.supports_quorum():
return
self.assert_no_active_block_jobs()
@@ -817,7 +814,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
'target image does not match source after mirroring')
def test_cancel(self):
- if not self.has_quorum():
+ if not iotests.supports_quorum():
return
self.assert_no_active_block_jobs()
@@ -834,7 +831,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
self.vm.shutdown()
def test_cancel_after_ready(self):
- if not self.has_quorum():
+ if not iotests.supports_quorum():
return
self.assert_no_active_block_jobs()
@@ -853,7 +850,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
'target image does not match source after mirroring')
def test_pause(self):
- if not self.has_quorum():
+ if not iotests.supports_quorum():
return
self.assert_no_active_block_jobs()
@@ -883,7 +880,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
'target image does not match source after mirroring')
def test_medium_not_found(self):
- if not self.has_quorum():
+ if not iotests.supports_quorum():
return
if iotests.qemu_default_machine != 'pc':
@@ -897,7 +894,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
self.assert_qmp(result, 'error/class', 'GenericError')
def test_image_not_found(self):
- if not self.has_quorum():
+ if not iotests.supports_quorum():
return
result = self.vm.qmp('drive-mirror', job_id='job0', device='quorum0',
@@ -907,7 +904,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
self.assert_qmp(result, 'error/class', 'GenericError')
def test_device_not_found(self):
- if not self.has_quorum():
+ if not iotests.supports_quorum():
return
result = self.vm.qmp('drive-mirror', job_id='job0',
@@ -918,7 +915,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
self.assert_qmp(result, 'error/class', 'GenericError')
def test_wrong_sync_mode(self):
- if not self.has_quorum():
+ if not iotests.supports_quorum():
return
result = self.vm.qmp('drive-mirror', device='quorum0', job_id='job0',
@@ -928,7 +925,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
self.assert_qmp(result, 'error/class', 'GenericError')
def test_no_node_name(self):
- if not self.has_quorum():
+ if not iotests.supports_quorum():
return
result = self.vm.qmp('drive-mirror', job_id='job0', device='quorum0',
@@ -937,7 +934,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
self.assert_qmp(result, 'error/class', 'GenericError')
def test_nonexistent_replaces(self):
- if not self.has_quorum():
+ if not iotests.supports_quorum():
return
result = self.vm.qmp('drive-mirror', job_id='job0', device='quorum0',
@@ -946,7 +943,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
self.assert_qmp(result, 'error/class', 'GenericError')
def test_after_a_quorum_snapshot(self):
- if not self.has_quorum():
+ if not iotests.supports_quorum():
return
result = self.vm.qmp('blockdev-snapshot-sync', node_name='img1',
diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139
index 6a0f6ca..6d98e4f 100644
--- a/tests/qemu-iotests/139
+++ b/tests/qemu-iotests/139
@@ -336,8 +336,9 @@ class TestBlockdevDel(iotests.QMPTestCase):
self.checkBlockDriverState('node1', False)
def testQuorum(self):
- if not 'quorum' in iotests.qemu_img_pipe('--help'):
+ if not iotests.supports_quorum():
return
+
self.addQuorum('quorum0', 'node0', 'node1')
# We cannot remove the children of a Quorum device
self.delBlockDriverState('node0', expect_error = True)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 1f30cfc..bec8eb4 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -348,9 +348,12 @@ def verify_platform(supported_oses=['linux']):
if True not in [sys.platform.startswith(x) for x in supported_oses]:
notrun('not suitable for this OS: %s' % sys.platform)
+def supports_quorum():
+ return 'quorum' in qemu_img_pipe('--help')
+
def verify_quorum():
'''Skip test suite if quorum support is not available'''
- if 'quorum' not in qemu_img_pipe('--help'):
+ if not supports_quorum():
notrun('quorum support missing')
def main(supported_fmts=[], supported_oses=['linux']):
--
1.8.3.1
- [Qemu-devel] [PULL 11/29] block: Check blockers in all nodes involved in a block-commit job, (continued)
- [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, 2016/10/31
- [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 <=
- [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
- Re: [Qemu-devel] [PULL 00/29] Block layer patches, Peter Maydell, 2016/10/31