[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL v2 23/40] qemu-iotests: Test the reopening of overlay
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL v2 23/40] qemu-iotests: Test the reopening of overlay_bs in 'block-commit' |
Date: |
Tue, 10 Nov 2015 15:09:23 +0100 |
From: Alberto Garcia <address@hidden>
The 'block-commit' command needs the overlay image of 'top' to
be opened in read-write mode in order to update the backing file
string. If 'top' is not the active layer or its backing file then its
overlay needs to be reopened during the block job.
This is a test case for that scenario.
Signed-off-by: Alberto Garcia <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/040 | 30 ++++++++++++++++++++++++++++++
tests/qemu-iotests/040.out | 4 ++--
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040
index ea2f98e..5bdaf3d 100755
--- a/tests/qemu-iotests/040
+++ b/tests/qemu-iotests/040
@@ -41,6 +41,7 @@ class ImageCommitTestCase(iotests.QMPTestCase):
while not completed:
for event in self.vm.get_qmp_events(wait=True):
if event['event'] == 'BLOCK_JOB_COMPLETED':
+ self.assert_qmp_absent(event, 'data/error')
self.assert_qmp(event, 'data/type', 'commit')
self.assert_qmp(event, 'data/device', 'drive0')
self.assert_qmp(event, 'data/offset', event['data']['len'])
@@ -251,5 +252,34 @@ class TestSetSpeed(ImageCommitTestCase):
class TestActiveZeroLengthImage(TestSingleDrive):
image_len = 0
+class TestReopenOverlay(ImageCommitTestCase):
+ image_len = 1024 * 1024
+ img0 = os.path.join(iotests.test_dir, '0.img')
+ img1 = os.path.join(iotests.test_dir, '1.img')
+ img2 = os.path.join(iotests.test_dir, '2.img')
+ img3 = os.path.join(iotests.test_dir, '3.img')
+
+ def setUp(self):
+ iotests.create_image(self.img0, self.image_len)
+ qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' %
self.img0, self.img1)
+ qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' %
self.img1, self.img2)
+ qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' %
self.img2, self.img3)
+ qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xab 0 128K', self.img1)
+ self.vm = iotests.VM().add_drive(self.img3)
+ self.vm.launch()
+
+ def tearDown(self):
+ self.vm.shutdown()
+ os.remove(self.img0)
+ os.remove(self.img1)
+ os.remove(self.img2)
+ os.remove(self.img3)
+
+ # This tests what happens when the overlay image of the 'top' node
+ # needs to be reopened in read-write mode in order to update the
+ # backing image string.
+ def test_reopen_overlay(self):
+ self.run_commit_test(self.img1, self.img0)
+
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2', 'qed'])
diff --git a/tests/qemu-iotests/040.out b/tests/qemu-iotests/040.out
index 42314e9..4fd1c2d 100644
--- a/tests/qemu-iotests/040.out
+++ b/tests/qemu-iotests/040.out
@@ -1,5 +1,5 @@
-........................
+.........................
----------------------------------------------------------------------
-Ran 24 tests
+Ran 25 tests
OK
--
1.8.3.1
- [Qemu-block] [PULL v2 13/40] hmp: Use blockdev-change-medium for change command, (continued)
- [Qemu-block] [PULL v2 13/40] hmp: Use blockdev-change-medium for change command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 15/40] hmp: Add read-only-mode option to change command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 14/40] blockdev: read-only-mode for blockdev-change-medium, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 17/40] block: check for existing device IDs in external_snapshot_prepare(), Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 18/40] block: rename BlockdevSnapshot to BlockdevSnapshotSync, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 19/40] block: support passing 'backing': '' to 'blockdev-add', Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 16/40] iotests: Add test for change-related QMP commands, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 20/40] block: add a 'blockdev-snapshot' QMP command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 21/40] block: add tests for the 'blockdev-snapshot' command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 22/40] commit: reopen overlay_bs before base, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 23/40] qemu-iotests: Test the reopening of overlay_bs in 'block-commit',
Kevin Wolf <=
- [Qemu-block] [PULL v2 26/40] throttle: Check for pending requests in throttle_group_unregister_bs(), Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 24/40] qcow2: avoid misaligned 64bit bswap, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 27/40] throttle: Use bs->throttle_state instead of bs->io_limits_enabled, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 25/40] qemu-img: add check for zero-length job len, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 29/40] block: Remove inner quotation marks in iotest 085, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 28/40] block: Disallow snapshots if the overlay doesn't support backing files, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 32/40] qemu-io: Check for trailing chars, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 31/40] qemu-io: fix cvtnum lval types, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 36/40] mirror: block all operations on the target image during the job, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 30/40] block: test 'blockdev-snapshot' using a file BDS as the overlay, Kevin Wolf, 2015/11/10