aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2019-09-27 15:23:49 +0300
committerJohn Snow <jsnow@redhat.com>2019-10-17 17:02:32 -0400
commit5752f89a788537cccc7a8e05904fb1b4ddf5eb43 (patch)
tree312f86c7afe2d49030dd7c03375ca7742dd8ba2e
parentfcd6a4f42deef7e9f28c7b82f7d340200fb7846e (diff)
downloadqemu-5752f89a788537cccc7a8e05904fb1b4ddf5eb43.zip
qemu-5752f89a788537cccc7a8e05904fb1b4ddf5eb43.tar.gz
qemu-5752f89a788537cccc7a8e05904fb1b4ddf5eb43.tar.bz2
iotests: add test-case to 165 to test reopening qcow2 bitmaps to RW
Reopening bitmaps to RW was broken prior to previous commit. Check that it works now. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-id: 20190927122355.7344-4-vsementsov@virtuozzo.com Signed-off-by: John Snow <jsnow@redhat.com>
-rwxr-xr-xtests/qemu-iotests/16557
-rw-r--r--tests/qemu-iotests/165.out4
2 files changed, 57 insertions, 4 deletions
diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165
index 5650dc7..951ea01 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,6 +102,59 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
self.vm.shutdown()
+ def test_reopen_rw(self):
+ self.vm = self.mkVm()
+ self.vm.launch()
+ self.qmpAddBitmap()
+
+ # Calculate hashes
+
+ self.writeRegions(regions1)
+ sha256_1 = self.getSha256()
+
+ self.writeRegions(regions2)
+ sha256_2 = self.getSha256()
+ assert sha256_1 != sha256_2 # Otherwise, it's not very interesting.
+
+ result = self.vm.qmp('block-dirty-bitmap-clear', node='drive0',
+ name='bitmap0')
+ self.assert_qmp(result, 'return', {})
+
+ # Start with regions1
+
+ self.writeRegions(regions1)
+ assert sha256_1 == self.getSha256()
+
+ self.vm.shutdown()
+
+ self.vm = self.mkVmRo()
+ self.vm.launch()
+
+ assert sha256_1 == self.getSha256()
+
+ # Check that we are in RO mode and can't modify bitmap.
+ self.writeRegions(regions2)
+ assert sha256_1 == self.getSha256()
+
+ # Reopen to RW
+ 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(regions2)
+ assert sha256_2 == self.getSha256()
+
+ self.vm.shutdown()
+
+
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'],
supported_protocols=['file'])
diff --git a/tests/qemu-iotests/165.out b/tests/qemu-iotests/165.out
index ae1213e..fbc63e6 100644
--- a/tests/qemu-iotests/165.out
+++ b/tests/qemu-iotests/165.out
@@ -1,5 +1,5 @@
-.
+..
----------------------------------------------------------------------
-Ran 1 tests
+Ran 2 tests
OK