From nobody Mon Feb 9 09:28:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770304328; cv=none; d=zohomail.com; s=zohoarc; b=KI2eCmrreGS8+M9E61lL+mtJKQyClM+F/W/rASNoCJuTQaqCYGKziehVvANGEbfvTZ7wkDnTpwlLN6FFeiEuVdlKAV9TPTHsen9iBCrtNGZlfTItrMPrQ0gkfmO5EuI4A7R7DAMkQ+MKBEujrRzOXwDv4gFIg28a9ETGn/Xc818= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770304328; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=5V+/E1d3Ny+m+i1Azb76Go6Sg043Ms9yZ6ftWKc1ce8=; b=grdtuWuPCGGXeaov8ygOMyeDQTh9QQFwYy7Z0aqsq00fEi0X099vgvn7+y2lpPRUCzp2KhsDhZ+aSgpZ0qHcHM8TFljAUXiMQy91Z7Cc9YSsWQRTdKhfiTKnisTpOFw1VuoomnV+c1/UfN2v3G16Frf8vjTLdeHbkff+mVkADnk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770304328418536.9660321881105; Thu, 5 Feb 2026 07:12:08 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id EE90643DC2; Thu, 5 Feb 2026 10:12:07 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 6E8F7441FE; Thu, 5 Feb 2026 09:59:58 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id C917F41C5F; Thu, 5 Feb 2026 09:59:41 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E0E2D41B43 for ; Thu, 5 Feb 2026 09:55:55 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-e0IcUe01Mzq9ysOkP5iGXA-1; Thu, 05 Feb 2026 09:55:54 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9FBE81800464 for ; Thu, 5 Feb 2026 14:55:53 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E56BC18003F6 for ; Thu, 5 Feb 2026 14:55:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770303355; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5V+/E1d3Ny+m+i1Azb76Go6Sg043Ms9yZ6ftWKc1ce8=; b=ez9K0GRa7+5jyAS+nr2Y7IKV+/NhiboOtgvVP4yXAZgXVX7d7++GJBkL7+CpuHgPjPq6OV Uyz+zAUvQP1IVPolMqNBqJqRmwoXHkcAWuSG56gb8g9u9SPhWoGt961uGY4jbBBvHUh1CF V7lZGhj88U4LWyGHqZtTxK/+NApEZTg= X-MC-Unique: e0IcUe01Mzq9ysOkP5iGXA-1 X-Mimecast-MFC-AGG-ID: e0IcUe01Mzq9ysOkP5iGXA_1770303353 To: devel@lists.libvirt.org Subject: [PATCH RFC 20/20] qemu: monitor: Use 'flat' mode of 'query-block' Date: Thu, 5 Feb 2026 15:55:28 +0100 Message-ID: <0529fe2e3a2db956e97a9ee8cc728217498aab8e.1770303113.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: L4JwY706DjzsUKzjReEveRl8e9ZD9wgRFAtqgvZsYTI_1770303353 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NBIZQBK2OOHJMRHZYKOMQDXLTPBYAYZU X-Message-ID-Hash: NBIZQBK2OOHJMRHZYKOMQDXLTPBYAYZU X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770304330378154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa We don't actually look at any of the information in 'backing-image' field so we can ask qemu not to send it to us. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 1 + src/qemu/qemu_monitor_json.c | 12 ++++++++++-- src/qemu/qemu_monitor_priv.h | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 1434da7f70..ffd8a281b9 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -585,6 +585,7 @@ qemuMonitorOpenInternal(virDomainObj *vm, if (priv) { mon->blockjobMaskProtocol =3D virQEMUCapsGet(priv->qemuCaps, QEMU_= CAPS_BLOCKJOB_BACKING_MASK_PROTOCOL); + mon->queryBlockFlat =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_Q= UERY_BLOCK_FLAT); } if (virSetCloseExec(mon->fd) < 0) { diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 971e8dd63f..6eff95f44a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2243,7 +2243,9 @@ qemuMonitorJSONQueryNamedBlockNodes(qemuMonitor *mon) * @mon: Monitor pointer * * This helper will attempt to make a "query-block" call and check for - * errors before returning with the reply. + * errors before returning with the reply. If qemu supports 'flat' mode + * (which ommits 'backing-image' field in the reply objects) we will enable + * it as no callers need that information. * * Returns: NULL on error, reply on success */ @@ -2252,8 +2254,14 @@ qemuMonitorJSONQueryBlock(qemuMonitor *mon) { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; + virTristateBool flat =3D VIR_TRISTATE_BOOL_ABSENT; + + if (mon->queryBlockFlat) + flat =3D VIR_TRISTATE_BOOL_YES; - if (!(cmd =3D qemuMonitorJSONMakeCommand("query-block", NULL))) + if (!(cmd =3D qemuMonitorJSONMakeCommand("query-block", + "T:flat", flat, + NULL))) return NULL; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0 || diff --git a/src/qemu/qemu_monitor_priv.h b/src/qemu/qemu_monitor_priv.h index 198105007e..ee644123ca 100644 --- a/src/qemu/qemu_monitor_priv.h +++ b/src/qemu/qemu_monitor_priv.h @@ -90,6 +90,9 @@ struct _qemuMonitor { /* use the backing-mask-protocol flag of block-commit/stream */ bool blockjobMaskProtocol; + + /* 'query-block' supports flat mode */ + bool queryBlockFlat; }; --=20 2.53.0