From patchwork Mon Sep 18 12:42:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Butsykin X-Patchwork-Id: 9956623 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 BAE2760385 for ; Mon, 18 Sep 2017 12:46:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAC5C28D04 for ; Mon, 18 Sep 2017 12:46:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FA9728D0C; Mon, 18 Sep 2017 12:46:26 +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.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 9EB0B28D04 for ; Mon, 18 Sep 2017 12:46:25 +0000 (UTC) Received: from localhost ([::1]:36381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtvRQ-0005Rd-7x for patchwork-qemu-devel@patchwork.kernel.org; Mon, 18 Sep 2017 08:46:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtvOH-0003Tf-Bl for qemu-devel@nongnu.org; Mon, 18 Sep 2017 08:43:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dtvOD-0003U2-6c for qemu-devel@nongnu.org; Mon, 18 Sep 2017 08:43:09 -0400 Received: from mail-eopbgr00138.outbound.protection.outlook.com ([40.107.0.138]:27658 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dtvO2-0003IH-PC; Mon, 18 Sep 2017 08:42:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4b8KLvws7piRFKwocd1fAA3y6MAKVD5B09ZO5bOD2mA=; b=Dql69krngcV/kTAohWFDz+JCJhIEloX+UPbmaxMbgRdx34zC19v44+uhjrGYSYiJQGovksdvzUYZWxlwi6/iiUAKp/Q7at1fSkx8ibqRbwoejVq0hSt90VqTYW/zeqMJUu8HY8HoWjjg7roY/YQ/Iz/Fwz1x5dki16Ey1Cbsqes= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pbutsykin@virtuozzo.com; Received: from pavelb-Z68P-DS3.sw.ru (195.214.232.6) by DB6PR0802MB2549.eurprd08.prod.outlook.com (2603:10a6:4:a1::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Mon, 18 Sep 2017 12:42:50 +0000 From: Pavel Butsykin To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Mon, 18 Sep 2017 15:42:30 +0300 Message-Id: <20170918124230.8152-5-pbutsykin@virtuozzo.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170918124230.8152-1-pbutsykin@virtuozzo.com> References: <20170918124230.8152-1-pbutsykin@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR0202CA0006.eurprd02.prod.outlook.com (2603:10a6:4:29::16) To DB6PR0802MB2549.eurprd08.prod.outlook.com (2603:10a6:4:a1::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e290b776-9a68-4bea-4014-08d4fe92c696 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DB6PR0802MB2549; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2549; 3:sB7XLFIoF/AG2+kySkfyQxfzEPtISSJzxeDav+/fXx08dK8bJZFYJsckwXUJKIDTD2xzkUNxhOxHpgcFJgqS6YE8wrgzAYDMgzvMtAUiNv6MQnBOlecZ8vHBYaS0rPMEqaKtVvEKzF/6hAUfM2y24SUqOYitD148UDHMBd290LnK8JKjbaBceeJOJPQK8W4xAaRT41CS6EapPXLOdJJUeQVM40u+G4AJXYXZB137drqSSAaZAzwzg/pIymVUiC2H; 25:eEx03SNuDvdtfEyDKYXvHSXRlkcOMEZT/UZBlvup9/Zp3QJFj/8KXixLHOO4sdu/+ecitNJ30p5Bu73hDiAzWj4V3Fb/cR82T581ZgUDRwL/rloNLXbE/BUWNQg7HpWc143nEm25U1k+js3G/SAO+cULyzUj5d963epnbajuerEzN6Yyu9gr+InzBp1MuV4tdpODyfQj1UVB+VEvFDJjYNmnhXkm34XTGXvjSsVzBub1j6utq7wfcPZEPRbHlvnxf1DHlGYPdOlWSJQKqup8vGqBwRk3CLhgEZbAjfP1w11HaFwqoAwmZ32HGA/cX1ztbWI5juk6OosLrCKSgAkasQ==; 31:cUQFp6E8wg28xEi4eTJIxVtcrUcHuMeg9D3jekdu8/zsfHrfFRRhHOWDgDruurMjfbxHDOuT7i1rMt4CZUL/pLXwGnXy0/PfnOVgUBxEzoomwny63XWnFtSsUW9PKpDxkYegr6TGI20KYOgk6LFY52yKVPyJThOU85uT9XpamZ+iL6v/eRtW7KHyJzEURhA7vqR0q85BdjeIrQsDJVsk9AiCw8ir0j/A/aSF3WOEz58= X-MS-TrafficTypeDiagnostic: DB6PR0802MB2549: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2549; 20:Xmpz4rLQ9hPZntOKKwzYc6pgkRYKYqq7KHJGfO197X+cvN/cMSn94OFx9oxZgKBYqc3VqA/hlha7TH6TuiyVo5TgcjxDwTGO2VSOtp90nNf/BVdQSGTOZZKcs+ryiGhvRnD/BYdk5g4nVLWV0R5loWcaEHGaMaC4X8YY9FB6x9AYV+tmxXueXdoYxnwB2CAmxOQn/oStOdH3YQPSMJsY52fu67SPElpe/yqs7F4C159/Sl6erZ3YBLy3lT7qXXzOtSJ1Bz2kg7sAephtZePM5uzO1yOJeaz/Q4hBOVIVrvbIOR3uIkLzT2ln4HMMwP4HeNhnQA4R3h1IxqvnKDd6f5qGWfNsq2/palWb/Wj0xHSgLDKNLubPxU0yFWIdxLIpL+YU09Je5vfGm8q7hLfx/VmQP2OWMtTJfvpPkvpWgyY=; 4:kfbSNFlV59uf1Xo3V3gZkcGoqbqp1TnXu5ynAHBiL6eDyFvgeJgEdW2fFnzb+IBQekT12+r7XPBOryLlXLSX7wdi2Pz0mBaFa1sR7pJtfJbzfyUgt2l6atqN4WcBJ5IT0KMu10gOaUUkFgqmhlPwwhqNiI3GjQaKwdnHh21o7wBOn6EkZ+efUJeNEbGRQ/PWKMNyjf1kTUUee26ACA6np8XSQVirnM/oPUdJWfKZWpIN/e3vyoRIiJyMTS2w3CPJjCVn4q7bFdmOyeXgsXplDEezKv12lQGBmJGd241dwRzVBOSMHkQuRrNjsArN8Yn79Wckk+AhZ63nYZG1cgut9Q== X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123564025)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0802MB2549; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0802MB2549; X-Forefront-PRVS: 04347F8039 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(7370300001)(4630300001)(6009001)(346002)(376002)(39830400002)(199003)(189002)(36756003)(48376002)(105586002)(50466002)(107886003)(101416001)(110136004)(53416004)(50226002)(25786009)(305945005)(7736002)(53936002)(81156014)(4326008)(81166006)(6666003)(5003940100001)(68736007)(2906002)(8676002)(6506006)(3846002)(6306002)(86362001)(478600001)(6486002)(6512007)(1076002)(6116002)(50986999)(76176999)(47776003)(2950100002)(33646002)(16586007)(7350300001)(97736004)(16526017)(106356001)(316002)(5660300001)(66066001)(69596002)(189998001)(2004002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0802MB2549; H:pavelb-Z68P-DS3.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0802MB2549; 23:iHxythuaYllkLkcCQyYEfAkerzMgTcFYoPb47vW?= =?us-ascii?Q?xgjMM3me7uNgVu4MNtNiUhCNTPIkDqIw9j1OnfLkJPQjac1lxBLj3s8OBHqI?= =?us-ascii?Q?ebf5juccU+lzsgm1kFGyWpjQDuXc61uQznC9lTwCX7RnYKoINWDLGDr49Jf/?= =?us-ascii?Q?RALtXK9YHkq8HNvwr9IwMxHGgVFfNKNir0CiJN5Z6aJdGid54TO+RoSrefQJ?= =?us-ascii?Q?36cqJJM3VJepcrVURHZp38DgSAxO2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put: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2549; 20:ooFHmENltVJ/9DAjp7cGEFgAaBYImOe3Hx9zDMvsal7V+4k3iHL4DtTGXjidxF/tzBX1cJvmDuMFADTHUu88BkIZ+gGr1wAWPzwHn3LiJyyrysgfDECNbQZo8mXmS66eM57ZdmfiqOjXbmVpSXJ/tTr0KQDKlfJ2grGJWYkvONQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2017 12:42:50.8842 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2549 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.0.138 Subject: [Qemu-devel] [PATCH v8 4/4] qemu-iotests: add shrinking image test 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, pbutsykin@virtuozzo.com, jsnow@redhat.com, armbru@redhat.com, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Pavel Butsykin Reviewed-by: Max Reitz Reviewed-by: John Snow --- tests/qemu-iotests/163 | 170 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/163.out | 5 ++ tests/qemu-iotests/group | 1 + 3 files changed, 176 insertions(+) create mode 100644 tests/qemu-iotests/163 create mode 100644 tests/qemu-iotests/163.out diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163 new file mode 100644 index 0000000000..403842354e --- /dev/null +++ b/tests/qemu-iotests/163 @@ -0,0 +1,170 @@ +#!/usr/bin/env python +# +# Tests for shrinking images +# +# Copyright (c) 2016-2017 Parallels International GmbH +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import os, random, iotests, struct, qcow2 +from iotests import qemu_img, qemu_io, image_size + +test_img = os.path.join(iotests.test_dir, 'test.img') +check_img = os.path.join(iotests.test_dir, 'check.img') + +def size_to_int(str): + suff = ['B', 'K', 'M', 'G', 'T'] + return int(str[:-1]) * 1024**suff.index(str[-1:]) + +class ShrinkBaseClass(iotests.QMPTestCase): + image_len = '128M' + shrink_size = '10M' + chunk_size = '16M' + refcount_bits = '16' + + def __qcow2_check(self, filename): + entry_bits = 3 + entry_size = 1 << entry_bits + l1_mask = 0x00fffffffffffe00 + div_roundup = lambda n, d: (n + d - 1) / d + + def split_by_n(data, n): + for x in xrange(0, len(data), n): + yield struct.unpack('>Q', data[x:x + n])[0] & l1_mask + + def check_l1_table(h, l1_data): + l1_list = list(split_by_n(l1_data, entry_size)) + real_l1_size = div_roundup(h.size, + 1 << (h.cluster_bits*2 - entry_size)) + used, unused = l1_list[:real_l1_size], l1_list[real_l1_size:] + + self.assertTrue(len(used) != 0, "Verifying l1 table content") + self.assertFalse(any(unused), "Verifying l1 table content") + + def check_reftable(fd, h, reftable): + for offset in split_by_n(reftable, entry_size): + if offset != 0: + fd.seek(offset) + cluster = fd.read(1 << h.cluster_bits) + self.assertTrue(any(cluster), "Verifying reftable content") + + with open(filename, "rb") as fd: + h = qcow2.QcowHeader(fd) + + fd.seek(h.l1_table_offset) + l1_table = fd.read(h.l1_size << entry_bits) + + fd.seek(h.refcount_table_offset) + reftable = fd.read(h.refcount_table_clusters << h.cluster_bits) + + check_l1_table(h, l1_table) + check_reftable(fd, h, reftable) + + def __raw_check(self, filename): + pass + + image_check = { + 'qcow2' : __qcow2_check, + 'raw' : __raw_check + } + + def setUp(self): + if iotests.imgfmt == 'raw': + qemu_img('create', '-f', iotests.imgfmt, test_img, self.image_len) + qemu_img('create', '-f', iotests.imgfmt, check_img, + self.shrink_size) + else: + qemu_img('create', '-f', iotests.imgfmt, + '-o', 'cluster_size=' + self.cluster_size + + ',refcount_bits=' + self.refcount_bits, + test_img, self.image_len) + qemu_img('create', '-f', iotests.imgfmt, + '-o', 'cluster_size=%s'% self.cluster_size, + check_img, self.shrink_size) + qemu_io('-c', 'write -P 0xff 0 ' + self.shrink_size, check_img) + + def tearDown(self): + os.remove(test_img) + os.remove(check_img) + + def image_verify(self): + self.assertEqual(image_size(test_img), image_size(check_img), + "Verifying image size") + self.image_check[iotests.imgfmt](self, test_img) + + if iotests.imgfmt == 'raw': + return + self.assertEqual(qemu_img('check', test_img), 0, + "Verifying image corruption") + + def test_empty_image(self): + qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img, + self.shrink_size) + + self.assertEqual( + qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, test_img), + qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, check_img), + "Verifying image content") + + self.image_verify() + + def test_sequential_write(self): + for offs in range(0, size_to_int(self.image_len), + size_to_int(self.chunk_size)): + qemu_io('-c', 'write -P 0xff %d %s' % (offs, self.chunk_size), + test_img) + + qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img, + self.shrink_size) + + self.assertEqual(qemu_img("compare", test_img, check_img), 0, + "Verifying image content") + + self.image_verify() + + def test_random_write(self): + offs_list = range(0, size_to_int(self.image_len), + size_to_int(self.chunk_size)) + random.shuffle(offs_list) + for offs in offs_list: + qemu_io('-c', 'write -P 0xff %d %s' % (offs, self.chunk_size), + test_img) + + qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img, + self.shrink_size) + + self.assertEqual(qemu_img("compare", test_img, check_img), 0, + "Verifying image content") + + self.image_verify() + +class TestShrink512(ShrinkBaseClass): + image_len = '3M' + shrink_size = '1M' + chunk_size = '256K' + cluster_size = '512' + refcount_bits = '64' + +class TestShrink64K(ShrinkBaseClass): + cluster_size = '64K' + +class TestShrink1M(ShrinkBaseClass): + cluster_size = '1M' + refcount_bits = '1' + +ShrinkBaseClass = None + +if __name__ == '__main__': + iotests.main(supported_fmts=['raw', 'qcow2']) diff --git a/tests/qemu-iotests/163.out b/tests/qemu-iotests/163.out new file mode 100644 index 0000000000..dae404e278 --- /dev/null +++ b/tests/qemu-iotests/163.out @@ -0,0 +1,5 @@ +......... +---------------------------------------------------------------------- +Ran 9 tests + +OK diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 4bd5017008..82c38b403b 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -166,6 +166,7 @@ 159 rw auto quick 160 rw auto quick 162 auto quick +163 rw auto quick 165 rw auto quick 170 rw auto quick 171 rw auto quick