From patchwork Thu Jul 21 19:40:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 9242431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 23C6960574 for ; Thu, 21 Jul 2016 19:56:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 146D627A98 for ; Thu, 21 Jul 2016 19:56:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07E8727D85; Thu, 21 Jul 2016 19:56:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3F6F927A98 for ; Thu, 21 Jul 2016 19:56:30 +0000 (UTC) Received: from localhost ([::1]:43376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQK57-0008Cb-5M for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 Jul 2016 15:56:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQJpf-0002Ld-NI for qemu-devel@nongnu.org; Thu, 21 Jul 2016 15:40:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQJpa-000125-3Q for qemu-devel@nongnu.org; Thu, 21 Jul 2016 15:40:30 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:31902 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQJpZ-0000zW-JR for qemu-devel@nongnu.org; Thu, 21 Jul 2016 15:40:26 -0400 Received: from hades.sw.ru ([10.30.8.132]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u6KBAfvk027557; Wed, 20 Jul 2016 14:10:43 +0300 (MSK) From: "Denis V. Lunev" To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 21 Jul 2016 22:40:19 +0300 Message-Id: <1469130019-18497-17-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1469130019-18497-1-git-send-email-den@openvz.org> References: <1469130019-18497-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH v6 16/16] qemu-iotests: add vmdk for test backup compression in 055 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Pavel Butsykin , Jeff Cody , Markus Armbruster , Stefan Hajnoczi , den@openvz.org, John Snow Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Pavel Butsykin The vmdk format has support for compression, it would be fine to add it for the test backup compression Signed-off-by: Pavel Butsykin Reviewed-by: Stefan Hajnoczi Signed-off-by: Denis V. Lunev CC: Jeff Cody CC: Markus Armbruster CC: Eric Blake CC: John Snow CC: Stefan Hajnoczi CC: Kevin Wolf --- tests/qemu-iotests/055 | 57 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index be81a42..cf5a423 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -454,7 +454,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 @@ -464,12 +465,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) @@ -479,7 +474,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) @@ -489,16 +495,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) @@ -507,13 +518,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') @@ -539,14 +557,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'])