From nobody Sat Sep 26 20:51:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=openvz.org ARC-Seal: i=1; a=rsa-sha256; t=1789329264; cv=none; d=zohomail.com; s=zohoarc; b=B+C6qJ1/hnIHaOcBDU7VJ/BmHufYwv7m1jFMeobOlISXqfmWFz63Q5y7zD3/65BHnIAAZHwtQ9HXNBJMH/LsNDoDSoGZwZvU8hHRKCZOmMSJ4C4vI3assRKdvZ0SU40l0x+nEXUSYi68Ue1e6THg+H888qpjzauypy9jdOvASQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789329264; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4q2zOJoCWtVlXRK/eOfEkk1X/KfIu1H8kUT6tpjDdpI=; b=bJuBF/hcVHrgFpUGfQMpndUdQu1ckz9igoJ2TVqoOfb4q6IhO+2SDi2/MbFJQLjrd3aRs7SVcvHh5mmkRMXKD3q3oYYvAHlZWGo7SesFOjfqKj729/C/M39Fp2Z/gGlAMzxHjI/f7Ng+saxT45FjCGUbfdWhbHnaLqnLQzbRhVU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789329264571917.6596879330187; Sun, 13 Sep 2026 12:54:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x5qGk-0007Us-Am; Sun, 13 Sep 2026 15:53:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x5qGH-0007Om-Kg for qemu-devel@nongnu.org; Sun, 13 Sep 2026 15:53:17 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x5qGC-0006Cn-28 for qemu-devel@nongnu.org; Sun, 13 Sep 2026 15:53:12 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-485850cbac3so1301430f8f.3 for ; Sun, 13 Sep 2026 12:53:07 -0700 (PDT) Received: from athena ([2a06:5b06:b600:300:ef7b:3cbd:e3a9:adbf]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-486eb33fc02sm20374678f8f.16.2026.09.13.12.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2026 12:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1789329186; x=1789933986; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=4q2zOJoCWtVlXRK/eOfEkk1X/KfIu1H8kUT6tpjDdpI=; b=ez/xaJ+Mj2UmAh1lQ41Qo+s4H2zznhUclv/JtQN7TKuF94j56IRLLDEopDM+o0SD/e VpSb7pfIygDV5sQ2Q9pP97Vn9+WZdEaSBZKwEi2L/knMAd1L6FbJ/RwWn0OyuHf2UeVQ VaCSG5v6sJ8C1apmjFE96Ij5HF3Vfro58JMpCwKLmV6gSyFgEt69v6CcRFf1HmD51Juy SIKuLz5oflj9Ix7JBWYmKJppkidp4Mop1e6Tt6SCtpb+KcVyAfDGbbaW+ekuVFbZtjB/ js6ysp7y5mJIXs/rga3HUquL0t60HxotH3EK447jTNmc1Y9CKtYt+TrIR1ThWL7NWoUc fv+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789329186; x=1789933986; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=4q2zOJoCWtVlXRK/eOfEkk1X/KfIu1H8kUT6tpjDdpI=; b=r7Hl6oUFKehXY7wZbAYnGzM7tdwO7TLlp0dkwPvMl9p03Sr4QRoAe4ARiiOvtnBIv0 vBnWU366dYAN/iHUp/d33oB6t7OoP6jab2T+EdAwxdtl0lurFdGhaBF65ugJk3LHnrSY Q+Dax+FApVq2hJCdcuPbbdGNDd7aC73xHpdayJyZnOg3raMl/wgSRceE6DABOS3HF7KM ur4fVcfkyP2/idFQX3OSb8B4ynEfX72U2YuNL04bfg1M09+mUhro+FWSB+f9GYSzLj1r /emxwaqXQZgX9PnA5+3TcI9Ea4Oeb4+b4cghjzTmnBtaDiG3MAsrUUeraw2TySRFpTQv meGg== X-Gm-Message-State: AFuF++nIUV3TgN+khpuA69R6v2DDpp3UyuVFlEArxmpEVOYc86q+18f7 hdGwFL8rXeyYe4QbOYpdVKcqxB+XG2vig+AQ6PPZVQgWcqN6Qv02DgWMlGcd+feMRW70HtcXYU9 lDLl5 X-Gm-Gg: AYBFou0Q6Mxnfg2ySBtHV08o61CxdWxWbqCY6pHK8TSQ62JWBUe/vvOWmwApWaOSKFB iJ9wb3+4ACfGeOh1y+QQp2lE3mZy1H8Kub7ay9nBeyp7t2UmdMZFqav/lrHQGjUkCVRFctraru8 DjtfxFA0HJ+WIEry+hpUFhuwFKf0zgsk4fOARcF4GGpZnhQaCIUSxX/zUICHGgAtD5XAtcnDQNF CIkQnX5xlx/wazagM3Y/WgLgj4EISBE0UGq7LYdR6V6tZdbLwwl/w7fsFTIeGayHDSduko2NIFx OArU2nrZAMGZZUGLNESDm/L5PQbHv1L0Y2bhRJ5uiWqSSUd1gG+XIRbmXuF6hRDfmmSNDWh7HYk q+YLjEMK7elcrYQUoi5cXDpeaEpNa6JYNNBLpDz9gSKl051FbDPWwmYmx47hy9J1cD2A2AEopES x7W9C/kJx8Hv0tgn35/oT6Yu63VEvvLjn88GX6I3rqIx4gSC3QG4NgyrPZ7iJ6 X-Received: by 2002:a05:6000:1446:b0:485:b169:54f8 with SMTP id ffacd0b85a97d-486eb2ec46emr15580887f8f.2.1789329186345; Sun, 13 Sep 2026 12:53:06 -0700 (PDT) From: "Denis V. Lunev" To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, "Denis V. Lunev" , Stefan Hajnoczi , Eric Blake , Markus Armbruster Subject: [PATCH v8 1/3] parallels: report the stored dirty bitmaps in qemu-img info Date: Sun, 13 Sep 2026 21:52:59 +0200 Message-ID: <20260913195301.1514888-2-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260913195301.1514888-1-den@openvz.org> References: <20260913195301.1514888-1-den@openvz.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=den@openvz.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @openvz.org) X-ZM-MESSAGEID: 1789329266047158500 Content-Type: text/plain; charset="utf-8" From: Denis V. Lunev Nothing tells which persistent bitmaps an image carries. qemu-img info says nothing about them, and the only other way to see one is to export the image over NBD and ask for a bitmap by name, which needs the name beforehand. Add ImageInfoSpecificParallels with the bitmaps and their granularity, in the same way as qcow2 reports the contents of its bitmap directory: Format specific information: bitmaps: [0]: name: b2c9e1a4-5d3f-4e8b-9a7c-6f0d1e2b3a45 granularity: 65536 For running VM process the list is built on the fly from in-memory list. This is the best we can do. FormatExtension could be dead in the image while VMs are running as all bitmaps are cleared on non-clean VM stop. A bitmap of an image which was not closed correctly is inconsistent and can not be used. Report that as well, the way qcow2 reports its in-use flag, so such a bitmap is not listed as a valid one. The section is left empty for an image with no persistent dirty bitmaps, and an empty section is not printed, so the human readable output of "qemu-img info" and "info block" is unchanged. Cc: Stefan Hajnoczi Cc: Eric Blake Cc: Markus Armbruster Signed-off-by: Denis V. Lunev Acked-by: Markus Armbruster --- block/parallels-ext.c | 26 +++++++++++ block/parallels.c | 20 +++++++++ block/parallels.h | 3 ++ qapi/block-core.json | 45 ++++++++++++++++++- tests/qemu-iotests/tests/parallels-checks | 6 +++ tests/qemu-iotests/tests/parallels-checks.out | 19 ++++++++ 6 files changed, 117 insertions(+), 2 deletions(-) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index f687f2da7c..8b8035af91 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -736,3 +736,29 @@ parallels_co_remove_persistent_dirty_bitmap(BlockDrive= rState *bs, =20 return ret; } + +void parallels_get_bitmap_info_list(BlockDriverState *bs, + ParallelsBitmapInfoList **info_list) +{ + BdrvDirtyBitmap *bitmap; + ParallelsBitmapInfoList **tail =3D info_list; + + *info_list =3D NULL; + + FOR_EACH_DIRTY_BITMAP(bs, bitmap) { + ParallelsBitmapInfo *info; + + if (!bdrv_dirty_bitmap_get_persistence(bitmap)) { + continue; + } + + info =3D g_new0(ParallelsBitmapInfo, 1); + info->name =3D g_strdup(bdrv_dirty_bitmap_name(bitmap)); + info->granularity =3D bdrv_dirty_bitmap_granularity(bitmap); + if (bdrv_dirty_bitmap_inconsistent(bitmap)) { + info->has_inconsistent =3D true; + info->inconsistent =3D true; + } + QAPI_LIST_APPEND(tail, info); + } +} diff --git a/block/parallels.c b/block/parallels.c index 2a5ceb8978..e7d65d0458 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1624,6 +1624,25 @@ static bool parallels_is_support_dirty_bitmaps(Block= DriverState *bs) return 1; } =20 +static ImageInfoSpecific * GRAPH_RDLOCK +parallels_get_specific_info(BlockDriverState *bs, Error **errp) +{ + ImageInfoSpecificParallels *parallels_info; + ImageInfoSpecific *spec_info; + + parallels_info =3D g_new0(ImageInfoSpecificParallels, 1); + parallels_get_bitmap_info_list(bs, ¶llels_info->bitmaps); + parallels_info->has_bitmaps =3D !!parallels_info->bitmaps; + + spec_info =3D g_new(ImageInfoSpecific, 1); + *spec_info =3D (ImageInfoSpecific){ + .type =3D IMAGE_INFO_SPECIFIC_KIND_PARALLELS, + .u.parallels.data =3D parallels_info, + }; + + return spec_info; +} + static BlockDriver bdrv_parallels =3D { .format_name =3D "parallels", .instance_size =3D sizeof(BDRVParallelsState), @@ -1653,6 +1672,7 @@ static BlockDriver bdrv_parallels =3D { parallels_co_can_store_new_dirty_bitmap, .bdrv_co_remove_persistent_dirty_bitmap =3D parallels_co_remove_persistent_dirty_bit= map, + .bdrv_get_specific_info =3D parallels_get_specific_info, }; =20 static void bdrv_parallels_init(void) diff --git a/block/parallels.h b/block/parallels.h index 27d8c3ac83..012f47320b 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -32,6 +32,7 @@ #ifndef BLOCK_PARALLELS_H #define BLOCK_PARALLELS_H #include "qemu/coroutine.h" +#include "qapi/qapi-types-block-core.h" =20 #define HEADS_NUMBER 16 #define SEC_IN_CYL 32 @@ -111,5 +112,7 @@ parallels_co_can_store_new_dirty_bitmap(BlockDriverStat= e *bs, const char *name, int coroutine_fn GRAPH_RDLOCK parallels_co_remove_persistent_dirty_bitmap(BlockDriverState *bs, const char *name, Error **errp= ); +void parallels_get_bitmap_info_list(BlockDriverState *bs, + ParallelsBitmapInfoList **info_list); =20 #endif diff --git a/qapi/block-core.json b/qapi/block-core.json index 199efc1e00..aed2888147 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -188,6 +188,16 @@ '*extent-size-hint': 'size' } } =20 +## +# @ImageInfoSpecificParallels: +# +# @bitmaps: A list of parallels bitmap details +# +# Since: 11.2 +## +{ 'struct': 'ImageInfoSpecificParallels', + 'data': { '*bitmaps': ['ParallelsBitmapInfo'] } } + ## # @ImageInfoSpecificKind: # @@ -197,10 +207,12 @@ # # @file: Since 8.0 # +# @parallels: Since 11.2 +# # Since: 1.7 ## { 'enum': 'ImageInfoSpecificKind', - 'data': [ 'qcow2', 'vmdk', 'luks', 'rbd', 'file' ] } + 'data': [ 'qcow2', 'vmdk', 'luks', 'rbd', 'file', 'parallels' ] } =20 ## # @ImageInfoSpecificQCow2Wrapper: @@ -255,6 +267,16 @@ { 'struct': 'ImageInfoSpecificFileWrapper', 'data': { 'data': 'ImageInfoSpecificFile' } } =20 +## +# @ImageInfoSpecificParallelsWrapper: +# +# @data: image information specific to Parallels +# +# Since: 11.2 +## +{ 'struct': 'ImageInfoSpecificParallelsWrapper', + 'data': { 'data': 'ImageInfoSpecificParallels' } } + ## # @ImageInfoSpecific: # @@ -273,7 +295,8 @@ 'vmdk': 'ImageInfoSpecificVmdkWrapper', 'luks': 'ImageInfoSpecificLUKSWrapper', 'rbd': 'ImageInfoSpecificRbdWrapper', - 'file': 'ImageInfoSpecificFileWrapper' + 'file': 'ImageInfoSpecificFileWrapper', + 'parallels': 'ImageInfoSpecificParallelsWrapper' } } =20 ## @@ -751,6 +774,24 @@ 'data': {'name': 'str', 'granularity': 'uint32', 'flags': ['Qcow2BitmapInfoFlags'] } } =20 +## +# @ParallelsBitmapInfo: +# +# Parallels bitmap information. +# +# @name: the name of the bitmap +# +# @granularity: granularity of the bitmap in bytes +# +# @inconsistent: true if the bitmap is in an inconsistent state and +# cannot be used +# +# Since: 11.2 +## +{ 'struct': 'ParallelsBitmapInfo', + 'data': { 'name': 'str', 'granularity': 'uint32', + '*inconsistent': 'bool' } } + ## # @BlockLatencyHistogramInfo: # diff --git a/tests/qemu-iotests/tests/parallels-checks b/tests/qemu-iotests= /tests/parallels-checks index 3e9928c9c3..ca89ed5d62 100755 --- a/tests/qemu-iotests/tests/parallels-checks +++ b/tests/qemu-iotests/tests/parallels-checks @@ -382,6 +382,9 @@ echo "=3D=3D dirty a single granule of the bitmap =3D= =3D" file_size=3D`stat --printf=3D"%s" "$TEST_IMG"` echo "file size: $file_size" =20 +echo "=3D=3D the bitmap is reported by qemu-img info =3D=3D" +_img_info --format-specific + echo "=3D=3D the extension and its bitmap data are not a leak =3D=3D" _check_test_img =20 @@ -425,6 +428,9 @@ $QEMU_IMG bitmap --add -f $IMGFMT "$TEST_IMG" $BITMAP 2= >&1 | _filter_testdir echo "=3D=3D pretend the image was not closed correctly =3D=3D" poke_file "$TEST_IMG" "$INUSE_OFFSET" "\x59\x6e\x6f\x74" =20 +echo "=3D=3D a read-only open still reports it, marked inconsistent =3D=3D" +_img_info --format-specific + echo "=3D=3D the bitmap is stale, so it can not be used and is dropped =3D= =3D" $QEMU_IMG bitmap --clear -f $IMGFMT "$TEST_IMG" $BITMAP 2>&1 | _filter_tes= tdir =20 diff --git a/tests/qemu-iotests/tests/parallels-checks.out b/tests/qemu-iot= ests/tests/parallels-checks.out index 871a88d924..f6806f82fa 100644 --- a/tests/qemu-iotests/tests/parallels-checks.out +++ b/tests/qemu-iotests/tests/parallels-checks.out @@ -241,6 +241,15 @@ qemu-img: Operation add on bitmap bitmap0 failed: Bitm= ap name must be a UUID to wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) file size: 4194304 +=3D=3D the bitmap is reported by qemu-img info =3D=3D +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 4 MiB (4194304 bytes) +Format specific information: + bitmaps: + [0]: + name: b2c9e1a4-5d3f-4e8b-9a7c-6f0d1e2b3a45 + granularity: 65536 =3D=3D the extension and its bitmap data are not a leak =3D=3D No errors were found on the image. =3D=3D extend image by 1 cluster =3D=3D @@ -273,6 +282,16 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D41= 94304 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =3D=3D pretend the image was not closed correctly =3D=3D +=3D=3D a read-only open still reports it, marked inconsistent =3D=3D +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 4 MiB (4194304 bytes) +Format specific information: + bitmaps: + [0]: + name: b2c9e1a4-5d3f-4e8b-9a7c-6f0d1e2b3a45 + granularity: 65536 + inconsistent: true =3D=3D the bitmap is stale, so it can not be used and is dropped =3D=3D Repairing image was not closed correctly qemu-img: Operation clear on bitmap b2c9e1a4-5d3f-4e8b-9a7c-6f0d1e2b3a45 f= ailed: Bitmap 'b2c9e1a4-5d3f-4e8b-9a7c-6f0d1e2b3a45' is inconsistent and ca= nnot be used --=20 2.53.0 From nobody Sat Sep 26 20:51:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=openvz.org ARC-Seal: i=1; a=rsa-sha256; t=1789329268; cv=none; d=zohomail.com; s=zohoarc; b=QXZnFu6SPZOs1vUcNZm7FRvn/sa64/+FDTccUb/t/9udUhqqyzzhLm5xTgD5/a2xypAPxOky64sZSVRvUqHhrojg9E56GS0tBWmhezOAwG5DZ1XJ1MAuHE8rj/0M8e6qmckE+HFle60JfbHN2s7Q5CKem8skMs78Sytdjhhk3Ks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789329268; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CrNy0DGUAMNQACpRIKae6EFwhUPs4CrGUyns6CD/7LI=; b=Q+IwyhHFsHUj2ASQFTmc68TmOtq6nYRCQ5ckjQEB5MCmcEEJQyaTJhMErmHA+2+LIrB8elsGvOID4hA2kgltQuJ0WqLIAK+iJvNROajKm7ryE1NwT9aAbQuqM8au17DXkHzi54KnkQ7tDxLPSb2500Hc/4o9iFSbrvq3gEoltZU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789329268834814.1553102856311; Sun, 13 Sep 2026 12:54:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x5qGk-0007Uq-86; Sun, 13 Sep 2026 15:53:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x5qGI-0007Op-K6 for qemu-devel@nongnu.org; Sun, 13 Sep 2026 15:53:17 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x5qGC-0006D1-RR for qemu-devel@nongnu.org; Sun, 13 Sep 2026 15:53:13 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-49e6deb520eso16758865e9.0 for ; Sun, 13 Sep 2026 12:53:08 -0700 (PDT) Received: from athena ([2a06:5b06:b600:300:ef7b:3cbd:e3a9:adbf]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-486eb33fc02sm20374678f8f.16.2026.09.13.12.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2026 12:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1789329187; x=1789933987; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=CrNy0DGUAMNQACpRIKae6EFwhUPs4CrGUyns6CD/7LI=; b=dyScXFqFzNxTml5i5hTiWj0TvII9k/K+YG0uSgJh9l135abtQ8Aam0EzSzCsftpCvc Aqb2aErmSMC3Y/SqO3TeZ7HF0DLLB+Ed1DyctQA/gMBFrg4zhqMcz9/GGgnnNwizOMI6 MPwiq3jPEiFXdn+va0KxKzvAbe/kspoO3tOFqwl8cmd8XdtSYd/e34xWzMP7snZAiT7c g6OCL9vhMkM9SN5KWYZacUeMh90ikSlwvROw5dSnRtsbiyNkK6bSimXPZaIe7HenfLyR PKYbBSRPPUyRqic5QciC+hw4Q+0MVrMFwJ30mgVWdnp6vJxlv7iYt3qceMH+v2HSdwFt 24hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789329187; x=1789933987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=CrNy0DGUAMNQACpRIKae6EFwhUPs4CrGUyns6CD/7LI=; b=YFlDvSHWc0DvG19esCCRb0burP1zL2JnRxD3ZP6XeokXZSXfBBAgEWxRacJEagXuNf xtQzJOcVNTlOEcnNV6CzNge+hNUm0T8h0p8CBQJM+50FmI22vPRXDkXWzc5AsFn+6wWj wSM4gLPiBLrugjtVj4lYQMyJwHnRL80HcG9xolg0iCRjsAzepBywDrXGMsvRB1ZuVg5q C8V3SG6teSEMjAR4v6vTwB0M67pGkAYRvm5Bp4XfddPiHS+6R8hQIDK7uoA4axCh46Mt bjQX4IQ178kFOHCLzfkCAPruA9y+POUR7z4l6G6hPLhhR2Q0uYnAWuhYlkHfdyEoN3CS SD+A== X-Gm-Message-State: AFuF++lUbjzvDZbOjOQEa41PF4kfgZGpG3X8K23p7ACgGk7XEy9WAR20 gRdO1IWin4IXMppjVBF8ml6xLFrgDGhIQ+quKHz38ddOVgCrJaSEIeS1nGQH5RZPYVn4GL6eJK9 LIH/X X-Gm-Gg: AYBFou1I/uO8/VjJcv7Ni+FWnhcC0ET+9kJeyQlBgcgrw+LSMNpjHI65k0yFxYGT1Zk A//ehXh56opDSKbBeUmEjsCtCwqwUNyRLcYxEMc0BtRw6OtWQzU0yOoRfuHb1LBQIfhWxMT3VgB ntzggaB+juzPMuX2ORMq27L+lFvWITt27x2XjDRVNZNCUa1WREIBtVYFycv1JAxGP4A45arfevQ rBVKwyOhH5ZRu5FxP2vdO9gHYAjUMUPH1Z8bbW2CPVyITkKAHLj+7+Y2QAYvLx3yPLx8Dscy0El r6evkf/xUTE5PF/YwA3aA8Pa5PKWljVLPW29uNME0x/vrxr2ftuNRaWCofMwVG+e7EHi3pQxgyE xo37QJjqyTNdY98/9rAzoeXIDgNCumFCxu2JrRuWKFGi16cuh1Veal48IPVyIcK7yDWCBF/VRKu 55qCtQNbtG0xqr8/4Xkr+CgLrePIdvanft/NrWNx7b2qtdOzLEH/TanU4O8znA X-Received: by 2002:a05:600c:c049:b0:499:60bf:c6f7 with SMTP id 5b1f17b1804b1-49e61992b43mr121746705e9.13.1789329187463; Sun, 13 Sep 2026 12:53:07 -0700 (PDT) From: "Denis V. Lunev" To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, "Denis V. Lunev" , Stefan Hajnoczi Subject: [PATCH v8 2/3] iotests: cover storing a parallels dirty bitmap Date: Sun, 13 Sep 2026 21:53:00 +0200 Message-ID: <20260913195301.1514888-3-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260913195301.1514888-1-den@openvz.org> References: <20260913195301.1514888-1-den@openvz.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=den@openvz.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @openvz.org) X-ZM-MESSAGEID: 1789329270095158500 Content-Type: text/plain; charset="utf-8" From: Denis V. Lunev parallels-bitmap covers loading a bitmap and parsing the Format Extension. Storing one is the other direction and is not covered at all. Nothing compares a stored bitmap with the writes it describes: test 165 compares a hash across a VM restart, which the same code produces and consumes, so a serialization wrong in both directions passes it. Write known ranges and read the bitmap back over NBD, in the shapes the storage code decides between: short ranges, a chunk dirty as a whole, a dirty run shorter than the cluster which serializes it, and a dirty tail. A bitmap which does not fit is refused when it is created, as the L1 table shares the Format Extension cluster with the feature headers of the bitmaps already there. One which fits an empty cluster does not fit next to seven others, and those seven have to survive the refusal. The rest is read out of the image file, as that is what the next open will see: a removal has to reach it when the command is given rather than when the node is closed, and the in use flag has to go with an inactivation and come back when the node is activated again. A bitmap which can not be written used to be lost in silence, so blkdebug fails the write of its data cluster: the loss has to be reported while the guest data still goes through, and the flag has to survive the failed inactivation. Cc: Stefan Hajnoczi Signed-off-by: Denis V. Lunev --- tests/qemu-iotests/tests/parallels-bitmap | 178 +++++++++++++++++- tests/qemu-iotests/tests/parallels-bitmap.out | 45 +++++ 2 files changed, 222 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/tests/parallels-bitmap b/tests/qemu-iotests= /tests/parallels-bitmap index 814b56b32c..be0ba8185d 100755 --- a/tests/qemu-iotests/tests/parallels-bitmap +++ b/tests/qemu-iotests/tests/parallels-bitmap @@ -25,7 +25,8 @@ import uuid from qemu.utils import VerboseProcessError =20 import iotests -from iotests import qemu_nbd_popen, qemu_img, qemu_img_map, log, file_path +from iotests import qemu_nbd_popen, qemu_img, qemu_img_create, qemu_img_ma= p, \ + qemu_io, log, file_path, QemuStorageDaemon =20 iotests.script_initialize(supported_fmts=3D['parallels']) =20 @@ -258,3 +259,178 @@ def check_multi_l1(): =20 =20 check_multi_l1() + + +# Storing a bitmap. The driver has to produce the extension itself here, +# so the images are real ones rather than hand crafted clusters. + +INUSE_MAGIC =3D 0x746F6E59 +INUSE_OFF =3D 0x2c +EXT_OFF =3D 0x38 +TRACKS_OFF =3D 0x1c + +stored =3D file_path('stored') +copy =3D file_path('copy') +STORED =3D '9b7b8b2e-1c4a-4d3f-8e6a-1f2d3c4b5a69' +OTHER =3D '11111111-2222-3333-4444-555555555555' + + +def read_header(off, fmt): + with open(stored, 'rb') as f: + return struct.unpack_from(fmt, f.read(0x40), off)[0] + + +def in_use(): + return read_header(INUSE_OFF, ' (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789329265054691.1262688643112; Sun, 13 Sep 2026 12:54:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x5qHC-0007l3-MH; Sun, 13 Sep 2026 15:54:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x5qGJ-0007Os-44 for qemu-devel@nongnu.org; Sun, 13 Sep 2026 15:53:19 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x5qGF-0006DQ-VG for qemu-devel@nongnu.org; Sun, 13 Sep 2026 15:53:14 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-485850cbac3so1301441f8f.3 for ; Sun, 13 Sep 2026 12:53:10 -0700 (PDT) Received: from athena ([2a06:5b06:b600:300:ef7b:3cbd:e3a9:adbf]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-486eb33fc02sm20374678f8f.16.2026.09.13.12.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2026 12:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1789329189; x=1789933989; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0cFMp897/2LhAMY3XQX2UH5MPXIwRH5TBMsVmASGwDU=; b=ltWVkHI4hoNMDccBVxPNyNKUekOKbENSycKRYsYarkeHSOgx7JxRbkf4onPL97GiX4 2VJsVCqNwTUo/Ta8jq12E5pSot4ZV8t6atio5xdAcisLuK6nagUY46OexpHwyyr14odX VwGkkalz04Zs8+VTnTiUZGd6XbOeevei/mn20nc54USMKWAZ/CUxV99ZZEluAnUyp3IT mg9qOQnygaOZXItwSRqyK284o+ODS4QU2sJ0y4JD2I7k+PJ9AXoDYxGlEWcYfQuMb0sZ GKAn3D+Rt8qnskqw+J6rIFOseBz6y4ciupOcRBhVx/KykwHtTdzKvWhQDEpnnDrVnP4t sZrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789329189; x=1789933989; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=0cFMp897/2LhAMY3XQX2UH5MPXIwRH5TBMsVmASGwDU=; b=jlvl5axEwnkxONNTvPXYNXF9MWcBkCp0KrAho78UrDBWwrwWPxV7gRx4CNWKUNItO7 phBvfguTOpGKDzRsxaM2HDIw9Ri9mnUv2zZq2lYgtH+KJft7970we9CDa8Uf2uWy3/oE 1wuEmE/DDxu54dJysTi0fKIlsFdgIWBcyuRX27D2JeMpO0yCm5OiIk+nukYiMrn7e50w VWVSg553HToXdXWMFPiAsd1Ty27pIn8vduO4f5QDiWx/+2k0+tuDK6CeZyn9ewDo0BXS DoI5zetq5SuL39aDWPA+howwTg0kER+9Iy3CzYMBBux5/zvUvUC3zTDWajjKSRe0oQdI mAhw== X-Gm-Message-State: AFuF++k5+Pd7PnM27OnUBXT1R8AFHv2/tHmnb8c+tD/EyjEfokFdo9ba qR2U1jsSVJB+Hk24V33oj+blimP2TMrUUGAkY5s//pQAGawcdRQJ+ihbjk3XBCQ3jPUZtjqvPBM IA8dV X-Gm-Gg: AYBFou2bEeNeqN0xDQpC1I6QFNcn3lwGk5PToHTC7NXU8t5t1JrOCILi0slsgDV5OLy fAcd0uVxhGELCJ2LcNHB1pdRul3sLO2a0a4pctFE1078R8I2YX7RWLna285PIt0pMkegHMenHtN zyB+e3mHD16Ni2Np9d8MNpcRkd6rko+XBILh1UHfTkRQgbHhOMwh21+dbS8KJ+NjiMRUhiaaw5o ytPQ518RtDcJU6wIMxB66Yn3LTaTH7tcvs6a1XO80dh669GmIB+9nFKpp3dMOzwl4CUd44sXjr9 wf/pFiys8167NNP4lL9Q2foOLRQjFulRcMcGcLzafRdgO5S68RUSHh0lxUedxoNTV95jvr9Pj64 jgrk2SULC4f9LMJ0xXjN3/JlcVu1LP9HNGVs1Qu/BCA2VLGJPvb5TBH4vbtHP2PxcT5cmvX++CI 5hUiOCHXyVb6sLhI0lHOaTxdzeMzGck0lzcxtYa6sBu3ujr8p7xEqswzYx2qMh X-Received: by 2002:adf:f091:0:b0:484:36c8:ffb9 with SMTP id ffacd0b85a97d-486eb2ec349mr10916227f8f.4.1789329188768; Sun, 13 Sep 2026 12:53:08 -0700 (PDT) From: "Denis V. Lunev" To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, "Denis V. Lunev" , Stefan Hajnoczi Subject: [PATCH v8 3/3] iotests: cover the qemu-img bitmap operations on parallels Date: Sun, 13 Sep 2026 21:53:01 +0200 Message-ID: <20260913195301.1514888-4-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260913195301.1514888-1-den@openvz.org> References: <20260913195301.1514888-1-den@openvz.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=den@openvz.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @openvz.org) X-ZM-MESSAGEID: 1789329266020158500 Content-Type: text/plain; charset="utf-8" From: Denis V. Lunev qemu-img-bitmaps drives convert --bitmaps and every qemu-img bitmap sub-command, but for qcow2 alone. It is built on a backing chain and a rebase, which parallels has neither of, so half of it could not run there and the format is left with no coverage of any of this. Cover what applies in the parallels test instead. A copy made with --bitmaps has to carry them, and raw has to refuse them. --merge and --clear leave the bitmap count alone, --remove-all sweeps it to zero, and --remove-all --add in one invocation leaves only the bitmap which was just added. An image which was not closed correctly is left out. parallels-checks covers that already, next to the code which drops the bitmaps. Cc: Stefan Hajnoczi Signed-off-by: Denis V. Lunev --- tests/qemu-iotests/tests/parallels-bitmap | 39 +++++++++++++++++++ tests/qemu-iotests/tests/parallels-bitmap.out | 12 ++++++ 2 files changed, 51 insertions(+) diff --git a/tests/qemu-iotests/tests/parallels-bitmap b/tests/qemu-iotests= /tests/parallels-bitmap index be0ba8185d..8ae9314114 100755 --- a/tests/qemu-iotests/tests/parallels-bitmap +++ b/tests/qemu-iotests/tests/parallels-bitmap @@ -273,6 +273,7 @@ stored =3D file_path('stored') copy =3D file_path('copy') STORED =3D '9b7b8b2e-1c4a-4d3f-8e6a-1f2d3c4b5a69' OTHER =3D '11111111-2222-3333-4444-555555555555' +MERGED =3D '22222222-3333-4444-5555-666666666666' =20 =20 def read_header(off, fmt): @@ -434,3 +435,41 @@ log('--- and the image is still readable') info_out =3D qemu_img('info', '-f', iotests.imgfmt, stored, check=3DFalse) log('image opened' if info_out.returncode =3D=3D 0 else iotests.filter_testfiles(info_out.stdout).strip()) + + +# qemu-img-bitmaps drives these for qcow2 alone, as it is built on a +# backing chain and a rebase, which parallels has neither of. + +log('--- bitmaps can not be preserved into raw') +make_image(STORED) +raw_out =3D qemu_img('convert', '--bitmaps', '-f', iotests.imgfmt, '-O', + 'raw', stored, copy, check=3DFalse) +log(' ' + iotests.filter_testfiles(raw_out.stdout).strip()) + +log('--- convert --bitmaps carries the bitmaps into the copy') +make_image(STORED, OTHER) +qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0x11 1M 64k', stored) +qemu_img('convert', '--bitmaps', '-f', iotests.imgfmt, '-O', iotests.imgfm= t, + stored, copy) +copy_info =3D iotests.qemu_img_info('-f', iotests.imgfmt, copy) +copy_data =3D copy_info.get('format-specific', {}).get('data', {}) +log(' %d bitmaps in the copy' % len(copy_data.get('bitmaps', []))) + +log('--- merging one bitmap into a new one') +qemu_img('bitmap', '--add', '--merge', STORED, '-f', iotests.imgfmt, + stored, MERGED) +log(' %d bitmaps stored' % len(bitmaps_reported())) + +log('--- clearing a bitmap keeps it in the image') +qemu_img('bitmap', '--clear', '-f', iotests.imgfmt, stored, STORED) +log(' %d bitmaps stored' % len(bitmaps_reported())) + +log('--- remove-all sweeps every bitmap of the image') +qemu_img('bitmap', '--remove-all', '-f', iotests.imgfmt, stored) +log(' %d bitmaps after remove-all' % len(bitmaps_reported())) + +log('--- remove-all with --add leaves only the new bitmap') +make_image(STORED, OTHER) +qemu_img('bitmap', '--remove-all', '--add', '-f', iotests.imgfmt, + stored, MERGED) +log(' ' + ' '.join(bitmaps_reported())) diff --git a/tests/qemu-iotests/tests/parallels-bitmap.out b/tests/qemu-iot= ests/tests/parallels-bitmap.out index 994c67390e..df6f676106 100644 --- a/tests/qemu-iotests/tests/parallels-bitmap.out +++ b/tests/qemu-iotests/tests/parallels-bitmap.out @@ -92,3 +92,15 @@ read 65536/65536 bytes at offset 0 0 bitmaps stored --- and the image is still readable image opened +--- bitmaps can not be preserved into raw + qemu-img: Format driver 'raw' does not support bitmaps +--- convert --bitmaps carries the bitmaps into the copy + 2 bitmaps in the copy +--- merging one bitmap into a new one + 3 bitmaps stored +--- clearing a bitmap keeps it in the image + 3 bitmaps stored +--- remove-all sweeps every bitmap of the image + 0 bitmaps after remove-all +--- remove-all with --add leaves only the new bitmap + 22222222-3333-4444-5555-666666666666 --=20 2.53.0