[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 03/10] iotests: add test-case to 165 to test reop
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-devel] [PATCH v4 03/10] iotests: add test-case to 165 to test reopening qcow2 bitmaps to RW |
Date: |
Wed, 7 Aug 2019 17:12:19 +0300 |
Reopening bitmaps to RW was broken prior to previous commit. Check that
it works now.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
tests/qemu-iotests/165 | 46 ++++++++++++++++++++++++++++++++++++--
tests/qemu-iotests/165.out | 4 ++--
2 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165
index 88f62d3c6d..dd93b5a2d0 100755
--- a/tests/qemu-iotests/165
+++ b/tests/qemu-iotests/165
@@ -43,10 +43,10 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
os.remove(disk)
def mkVm(self):
- return iotests.VM().add_drive(disk)
+ return iotests.VM().add_drive(disk, opts='node-name=node0')
def mkVmRo(self):
- return iotests.VM().add_drive(disk, opts='readonly=on')
+ return iotests.VM().add_drive(disk, opts='readonly=on,node-name=node0')
def getSha256(self):
result = self.vm.qmp('x-debug-block-dirty-bitmap-sha256',
@@ -102,5 +102,47 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
self.vm.shutdown()
+ def test_reopen_rw(self):
+ self.vm = self.mkVm()
+ self.vm.launch()
+ self.qmpAddBitmap()
+
+ # Calculate sha256 corresponding to regions1
+ self.writeRegions(regions1)
+ sha256 = self.getSha256()
+ result = self.vm.qmp('block-dirty-bitmap-clear', node='drive0',
+ name='bitmap0')
+ self.assert_qmp(result, 'return', {})
+
+ self.vm.shutdown()
+
+ self.vm = self.mkVmRo()
+ self.vm.launch()
+
+ # We've loaded empty bitmap
+ assert sha256 != self.getSha256()
+
+ # Check that we are in RO mode
+ self.writeRegions(regions1)
+ assert sha256 != self.getSha256()
+
+ result = self.vm.qmp('x-blockdev-reopen', **{
+ 'node-name': 'node0',
+ 'driver': iotests.imgfmt,
+ 'file': {
+ 'driver': 'file',
+ 'filename': disk
+ },
+ 'read-only': False
+ })
+ self.assert_qmp(result, 'return', {})
+
+ # Check that bitmap is reopened to RW and we can write to it.
+ self.writeRegions(regions1)
+ assert sha256 == self.getSha256()
+
+ self.vm.shutdown()
+
+
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
diff --git a/tests/qemu-iotests/165.out b/tests/qemu-iotests/165.out
index ae1213e6f8..fbc63e62f8 100644
--- a/tests/qemu-iotests/165.out
+++ b/tests/qemu-iotests/165.out
@@ -1,5 +1,5 @@
-.
+..
----------------------------------------------------------------------
-Ran 1 tests
+Ran 2 tests
OK
--
2.18.0
- [Qemu-devel] [PATCH v4 00/10] qcow2-bitmaps: rewrite reopening logic, Vladimir Sementsov-Ogievskiy, 2019/08/07
- [Qemu-devel] [PATCH v4 10/10] qcow2-bitmap: move bitmap reopen-rw code to qcow2_reopen_commit, Vladimir Sementsov-Ogievskiy, 2019/08/07
- [Qemu-devel] [PATCH v4 01/10] block: switch reopen queue from QSIMPLEQ to QTAILQ, Vladimir Sementsov-Ogievskiy, 2019/08/07
- [Qemu-devel] [PATCH v4 07/10] block/qcow2-bitmap: do not remove bitmaps on reopen-ro, Vladimir Sementsov-Ogievskiy, 2019/08/07
- [Qemu-devel] [PATCH v4 06/10] block/qcow2-bitmap: drop qcow2_reopen_bitmaps_rw_hint(), Vladimir Sementsov-Ogievskiy, 2019/08/07
- [Qemu-devel] [PATCH v4 05/10] block/qcow2-bitmap: get rid of bdrv_has_changed_persistent_bitmaps, Vladimir Sementsov-Ogievskiy, 2019/08/07
- [Qemu-devel] [PATCH v4 08/10] iotests: add test 260 to check bitmap life after snapshot + commit, Vladimir Sementsov-Ogievskiy, 2019/08/07
- [Qemu-devel] [PATCH v4 04/10] iotests.py: add event_wait_log and events_wait_log helpers, Vladimir Sementsov-Ogievskiy, 2019/08/07
- [Qemu-devel] [PATCH v4 02/10] block: reverse order for reopen commits, Vladimir Sementsov-Ogievskiy, 2019/08/07
- [Qemu-devel] [PATCH v4 03/10] iotests: add test-case to 165 to test reopening qcow2 bitmaps to RW,
Vladimir Sementsov-Ogievskiy <=
- [Qemu-devel] [PATCH v4 09/10] block/qcow2-bitmap: fix and improve qcow2_reopen_bitmaps_rw, Vladimir Sementsov-Ogievskiy, 2019/08/07