diff options
author | Pavel Butsykin <pbutsykin@virtuozzo.com> | 2016-07-22 11:17:55 +0300 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-09-05 19:06:48 +0200 |
commit | 00198ecc776d2d6b9f65703f209f4e2c8b2ab844 (patch) | |
tree | c8988b6e6730e5b96112e9db49a6e18cd2ef11a5 | |
parent | e1b5c51f4c0c5ecbf158148e2333ee87080bc66f (diff) | |
download | qemu-00198ecc776d2d6b9f65703f209f4e2c8b2ab844.zip |
qemu-iotests: add vmdk for test backup compression in 055
The vmdk format has support for compression, it would be fine to add it for
the test backup compression
Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Jeff Cody <jcody@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
CC: Eric Blake <eblake@redhat.com>
CC: John Snow <jsnow@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rwxr-xr-x | tests/qemu-iotests/055 | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index 0e1326cba3..ff4535e3ea 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -451,7 +451,8 @@ class TestSingleTransaction(iotests.QMPTestCase): class TestDriveCompression(iotests.QMPTestCase): image_len = 64 * 1024 * 1024 # MB - outfmt = 'qcow2' + fmt_supports_compression = [{'type': 'qcow2', 'args': ()}, + {'type': 'vmdk', 'args': ('-o', 'subformat=streamOptimized')}] def setUp(self): # Write data to the image so we can compare later @@ -461,12 +462,6 @@ class TestDriveCompression(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x22 162k 32k', test_img) qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x33 67043328 64k', test_img) - qemu_img('create', '-f', TestDriveCompression.outfmt, blockdev_target_img, - str(TestDriveCompression.image_len)) - self.vm = iotests.VM().add_drive(test_img).add_drive(blockdev_target_img, - format=TestDriveCompression.outfmt) - self.vm.launch() - def tearDown(self): self.vm.shutdown() os.remove(test_img) @@ -476,7 +471,18 @@ class TestDriveCompression(iotests.QMPTestCase): except OSError: pass - def do_test_compress_complete(self, cmd, **args): + def do_prepare_drives(self, fmt, args): + self.vm = iotests.VM().add_drive(test_img) + + qemu_img('create', '-f', fmt, blockdev_target_img, + str(TestDriveCompression.image_len), *args) + self.vm.add_drive(blockdev_target_img, format=fmt) + + self.vm.launch() + + def do_test_compress_complete(self, cmd, format, **args): + self.do_prepare_drives(format['type'], format['args']) + self.assert_no_active_block_jobs() result = self.vm.qmp(cmd, device='drive0', sync='full', compress=True, **args) @@ -486,16 +492,21 @@ class TestDriveCompression(iotests.QMPTestCase): self.vm.shutdown() self.assertTrue(iotests.compare_images(test_img, blockdev_target_img, - iotests.imgfmt, TestDriveCompression.outfmt), + iotests.imgfmt, format['type']), 'target image does not match source after backup') def test_complete_compress_drive_backup(self): - self.do_test_compress_complete('drive-backup', target=blockdev_target_img, mode='existing') + for format in TestDriveCompression.fmt_supports_compression: + self.do_test_compress_complete('drive-backup', format, + target=blockdev_target_img, mode='existing') def test_complete_compress_blockdev_backup(self): - self.do_test_compress_complete('blockdev-backup', target='drive1') + for format in TestDriveCompression.fmt_supports_compression: + self.do_test_compress_complete('blockdev-backup', format, target='drive1') + + def do_test_compress_cancel(self, cmd, format, **args): + self.do_prepare_drives(format['type'], format['args']) - def do_test_compress_cancel(self, cmd, **args): self.assert_no_active_block_jobs() result = self.vm.qmp(cmd, device='drive0', sync='full', compress=True, **args) @@ -504,13 +515,20 @@ class TestDriveCompression(iotests.QMPTestCase): event = self.cancel_and_wait() self.assert_qmp(event, 'data/type', 'backup') + self.vm.shutdown() + def test_compress_cancel_drive_backup(self): - self.do_test_compress_cancel('drive-backup', target=blockdev_target_img, mode='existing') + for format in TestDriveCompression.fmt_supports_compression: + self.do_test_compress_cancel('drive-backup', format, + target=blockdev_target_img, mode='existing') def test_compress_cancel_blockdev_backup(self): - self.do_test_compress_cancel('blockdev-backup', target='drive1') + for format in TestDriveCompression.fmt_supports_compression: + self.do_test_compress_cancel('blockdev-backup', format, target='drive1') + + def do_test_compress_pause(self, cmd, format, **args): + self.do_prepare_drives(format['type'], format['args']) - def do_test_compress_pause(self, cmd, **args): self.assert_no_active_block_jobs() self.vm.pause_drive('drive0') @@ -536,14 +554,17 @@ class TestDriveCompression(iotests.QMPTestCase): self.vm.shutdown() self.assertTrue(iotests.compare_images(test_img, blockdev_target_img, - iotests.imgfmt, TestDriveCompression.outfmt), + iotests.imgfmt, format['type']), 'target image does not match source after backup') def test_compress_pause_drive_backup(self): - self.do_test_compress_pause('drive-backup', target=blockdev_target_img, mode='existing') + for format in TestDriveCompression.fmt_supports_compression: + self.do_test_compress_pause('drive-backup', format, + target=blockdev_target_img, mode='existing') def test_compress_pause_blockdev_backup(self): - self.do_test_compress_pause('blockdev-backup', target='drive1') + for format in TestDriveCompression.fmt_supports_compression: + self.do_test_compress_pause('blockdev-backup', format, target='drive1') if __name__ == '__main__': iotests.main(supported_fmts=['raw', 'qcow2']) |