[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v4 6/6] iotests: Test changed Quorum filename
From: |
Max Reitz |
Subject: |
[Qemu-block] [PATCH v4 6/6] iotests: Test changed Quorum filename |
Date: |
Tue, 18 Aug 2015 16:10:15 -0700 |
After drive-mirror replacing a Quorum child, the filename of the Quorum
BDS should reflect the change. This patch replaces the existing test for
whether the operation did actually exchange the BDS (which simply tested
whether the new BDS existed) by a test which examines the children list
contained in the Quorum BDS's filename as returned by query-block.
As a nice side effect of confirming that the new BDS actually belongs to
the Quorum BDS, this checks whether the filename was properly updated.
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/041 | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index de8ea15..ad8ce83 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+import json
import time
import os
import iotests
@@ -914,10 +915,18 @@ class TestRepairQuorum(iotests.QMPTestCase):
self.assert_qmp(result, 'return', {})
self.complete_and_wait(drive="quorum0")
- result = self.vm.qmp('query-named-block-nodes')
- self.assert_qmp(result, 'return[0]/file', quorum_repair_img)
- # TODO: a better test requiring some QEMU infrastructure will be added
- # to check that this file is really driven by quorum
+
+ result = self.vm.qmp('query-block')
+ for blockdev in result['return']:
+ if blockdev['device'] == 'quorum0':
+ filename = blockdev['inserted']['image']['filename']
+ self.assertEquals(filename[:5], 'json:')
+ children = json.loads(filename[5:])['children']
+ self.assertEquals(children[0]['file']['filename'], quorum_img1)
+ self.assertEquals(children[1]['file']['filename'],
+ quorum_repair_img)
+ self.assertEquals(children[2]['file']['filename'], quorum_img3)
+
self.vm.shutdown()
if __name__ == '__main__':
--
2.4.3
- [Qemu-block] [PATCH v4 0/6] block: Drop BDS.filename, Max Reitz, 2015/08/18
- [Qemu-block] [PATCH v4 1/6] block: Change bdrv_get_encrypted_filename(), Max Reitz, 2015/08/18
- [Qemu-block] [PATCH v4 2/6] block: Avoid BlockDriverState.filename, Max Reitz, 2015/08/18
- [Qemu-block] [PATCH v4 3/6] block: Add bdrv_filename(), Max Reitz, 2015/08/18
- [Qemu-block] [PATCH v4 4/6] qemu-img: Use bdrv_filename_alloc() for map, Max Reitz, 2015/08/18
- [Qemu-block] [PATCH v4 6/6] iotests: Test changed Quorum filename,
Max Reitz <=
- [Qemu-block] [PATCH v4 5/6] block: Drop BlockDriverState.filename, Max Reitz, 2015/08/18