From nobody Fri Nov 7 17:04:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548706025669964.3569760969282; Mon, 28 Jan 2019 12:07:05 -0800 (PST) Received: from localhost ([127.0.0.1]:38023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goDBQ-0004UC-KM for importer@patchew.org; Mon, 28 Jan 2019 15:07:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goD6K-0000xf-EK for qemu-devel@nongnu.org; Mon, 28 Jan 2019 15:01:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goD6J-0003Hc-1o for qemu-devel@nongnu.org; Mon, 28 Jan 2019 15:01:48 -0500 Received: from relay.sw.ru ([185.231.240.75]:38194) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goD6I-0003BE-Qm; Mon, 28 Jan 2019 15:01:46 -0500 Received: from [172.16.25.136] (helo=localhost.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1goD62-0005cN-BW; Mon, 28 Jan 2019 23:01:30 +0300 From: Andrey Shinkevich To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 28 Jan 2019 23:01:28 +0300 Message-Id: <1548705688-1027522-3-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1548705688-1027522-1-git-send-email-andrey.shinkevich@virtuozzo.com> References: <1548705688-1027522-1-git-send-email-andrey.shinkevich@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH v9 2/2] qemu-img info: bitmaps extension new test 239 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, vsementsov@virtuozzo.com, armbru@redhat.com, mreitz@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" A new test file 239 added to the qemu-iotests set. It checks the output format of 'qemu-img info' for bitmaps extension of qcow2 specific information. Signed-off-by: Andrey Shinkevich --- tests/qemu-iotests/239 | 60 +++++++++++++++++++++++++++++++ tests/qemu-iotests/239.out | 88 ++++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/group | 1 + 3 files changed, 149 insertions(+) create mode 100755 tests/qemu-iotests/239 create mode 100644 tests/qemu-iotests/239.out diff --git a/tests/qemu-iotests/239 b/tests/qemu-iotests/239 new file mode 100755 index 0000000..233b58b --- /dev/null +++ b/tests/qemu-iotests/239 @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# +# Test for qcow2 bitmap printed information +# +# Copyright (c) 2018 Virtuozzo 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 iotests +import json +from iotests import qemu_img_create, qemu_io, qemu_img_pipe, \ + file_path, log + +disk =3D file_path('disk') +chunk =3D 256 + +def print_bitmap(): + log('bitmap info dump:') + result =3D json.loads(qemu_img_pipe('info', '--force-share', + '--output=3Djson', disk)) + bitmaps =3D result['format-specific']['data']['bitmaps'] + log(bitmaps, indent=3D2) + +def add_bitmap(bitmap_number): + num =3D bitmap_number + granularity =3D 2**(13 + num) + bitmap_name =3D 'bitmap-' + str(num) + vm =3D iotests.VM().add_drive(disk) + vm.launch() + vm.qmp_log('block-dirty-bitmap-add', node=3D'drive0', name=3Dbitmap_na= me, + granularity=3Dgranularity, persistent=3DTrue) + vm.shutdown() + write =3D 'write {} {}K'.format((num-1)*chunk, chunk) + qemu_io('-f', iotests.imgfmt, '-c', write, disk) + +iotests.verify_image_format(supported_fmts=3D['qcow2']) +qemu_img_create('-f', iotests.imgfmt, disk, '1M') + +for num in range(1, 4): + add_bitmap(num) + print_bitmap() + log('') + +vm =3D iotests.VM().add_drive(disk) +vm.launch() +log('Check \"in-use\" flag') +print_bitmap() +vm.shutdown() diff --git a/tests/qemu-iotests/239.out b/tests/qemu-iotests/239.out new file mode 100644 index 0000000..efeca9f --- /dev/null +++ b/tests/qemu-iotests/239.out @@ -0,0 +1,88 @@ +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 16384, = "name": "bitmap-1", "node": "drive0", "persistent": true}} +{"return": {}} +bitmap info dump: +[ + { + "flags": [ + "auto" + ], + "granularity": 16384, + "name": "bitmap-1" + } +] + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 32768, = "name": "bitmap-2", "node": "drive0", "persistent": true}} +{"return": {}} +bitmap info dump: +[ + { + "flags": [ + "auto" + ], + "granularity": 16384, + "name": "bitmap-1" + }, + { + "flags": [ + "auto" + ], + "granularity": 32768, + "name": "bitmap-2" + } +] + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap-3", "node": "drive0", "persistent": true}} +{"return": {}} +bitmap info dump: +[ + { + "flags": [ + "auto" + ], + "granularity": 16384, + "name": "bitmap-1" + }, + { + "flags": [ + "auto" + ], + "granularity": 32768, + "name": "bitmap-2" + }, + { + "flags": [ + "auto" + ], + "granularity": 65536, + "name": "bitmap-3" + } +] + +Check "in-use" flag +bitmap info dump: +[ + { + "flags": [ + "in-use", + "auto" + ], + "granularity": 16384, + "name": "bitmap-1" + }, + { + "flags": [ + "in-use", + "auto" + ], + "granularity": 32768, + "name": "bitmap-2" + }, + { + "flags": [ + "in-use", + "auto" + ], + "granularity": 65536, + "name": "bitmap-3" + } +] diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 0f1c3f9..3e310c7 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -235,3 +235,4 @@ 235 auto quick 236 auto quick 238 auto quick +239 rw auto quick --=20 1.8.3.1