From patchwork Mon Sep 5 18:13:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 9315031 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 3C026607D3 for ; Mon, 5 Sep 2016 18:41:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F7E828A43 for ; Mon, 5 Sep 2016 18:41:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23D7F28AAA; Mon, 5 Sep 2016 18:41:58 +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 89C2E28A43 for ; Mon, 5 Sep 2016 18:41:57 +0000 (UTC) Received: from localhost ([::1]:56281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgyqC-0000at-JT for patchwork-qemu-devel@patchwork.kernel.org; Mon, 05 Sep 2016 14:41:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgyPq-00038G-0S for qemu-devel@nongnu.org; Mon, 05 Sep 2016 14:14:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgyPl-000133-1Q for qemu-devel@nongnu.org; Mon, 05 Sep 2016 14:14:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37462) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgyPi-0000zn-2O; Mon, 05 Sep 2016 14:14:34 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9054C056819; Mon, 5 Sep 2016 18:14:33 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-62.ams2.redhat.com [10.36.116.62]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u85IDt7r020627; Mon, 5 Sep 2016 14:14:32 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 5 Sep 2016 20:13:41 +0200 Message-Id: <1473099234-10882-30-git-send-email-kwolf@redhat.com> In-Reply-To: <1473099234-10882-1-git-send-email-kwolf@redhat.com> References: <1473099234-10882-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 05 Sep 2016 18:14:33 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 29/42] 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: kwolf@redhat.com, qemu-devel@nongnu.org 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 Signed-off-by: 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 0e1326c..ff4535e 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'])