From nobody Tue Sep 9 02:56:17 2025 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=1737470762; cv=none; d=zohomail.com; s=zohoarc; b=Q0shDXimwoASKzCPiP1akvR3YGR1xjBg3w1paLtRsWLVkOTqw+gbSKnKOHgRxdKQUhwKpzk5xO2GJwMNtH0Jy6al2ayG2iWxrGlFjhFjORs3wiHpkxMjTFOrEl0PGZIe2cnd2KU1j54QlmvdcxP49v2s9S9egoFt6RpZ67Obx+A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737470762; h=Content-Type: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:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=gPvk5dk8ypxouLkHSUT9aSzzNd5McZPsuH61Xl5p+8M=; b=C1qIgHJs9tFqeNxzL5flWmAumkNaNn2dWQTbY6BKOLmOB4zXlwQtRi5LS5uHInTixhex+uSOHv9Q3ePmiZXMhAv9Xhe+17s0BA4JUb/b+3yx1ZKhWiRdn0cX9x7RHAfu6LFGfh4BfILUbHCGgAs15xfqVhTCrdWFitHfCMEhU9k= 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 1737470762263102.65770966563343; Tue, 21 Jan 2025 06:46:02 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id A10C61855; Tue, 21 Jan 2025 09:46:01 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id AB8EF17C1; Tue, 21 Jan 2025 09:45:37 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 006FE17B0; Tue, 21 Jan 2025 09:43:16 -0500 (EST) Received: from mail-106110.protonmail.ch (mail-106110.protonmail.ch [79.135.106.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 6C8BE17AF for ; Tue, 21 Jan 2025 09:43:16 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ldsoft.dev; s=protonmail3; t=1737470015; x=1737729215; bh=gPvk5dk8ypxouLkHSUT9aSzzNd5McZPsuH61Xl5p+8M=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=A2vkVQkKONT5lfNS4plJ/m0Aqf0FhMSRKO2vPlHpVO8vFRa6LBtjp77FEBvVUhc5m +58t/SXd/FpF9vvt0SMxLxefK30BB2BoFBq+kdFHj37jZqbjyd8ev9wos1yXRwOP5o QPdKzqaoRgaTwJuc/OBQ0mY2LJyNCRHIuK6aI9l1wulAKtpvwVIViDkFepu7G1cNnI 4AEI3q8vI74ZQHU3bpHKbHpSxE/PAfoGET9H6Wo0IAq6TBCbMMObXpXtOORcIVVN+N CCm1PZH3J+WBkzKjkRLQT2JNlftr1wV/4S1Ob9d2+rXONacTlegsEdOF6LG+ar7/Y8 C42JOxRv8DjQA== Date: Tue, 21 Jan 2025 14:33:30 +0000 To: devel@lists.libvirt.org Subject: [PATCH v2 2/2] qemu: Clarify block I/O throttle JSON parsing errors Message-ID: <20250121143252.121604-3-fabian@ldsoft.dev> In-Reply-To: <20250121143252.121604-1-fabian@ldsoft.dev> References: <20250121143252.121604-1-fabian@ldsoft.dev> Feedback-ID: 27156318:user:proton X-Pm-Message-ID: 730088a5535c9c40f0bfa81f3988e5945f70a340 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-MailFrom: fabian@ldsoft.dev X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 Message-ID-Hash: I26ZPPNJ2Y4GS3FA2SQUP62DW5HIDFQG X-Message-ID-Hash: I26ZPPNJ2Y4GS3FA2SQUP62DW5HIDFQG X-Mailman-Approved-At: Tue, 21 Jan 2025 14:45:34 -0500 CC: Fabian Leditzky X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Fabian Leditzky via Devel Reply-To: Fabian Leditzky X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1737470763092019000 Content-Type: text/plain; charset="utf-8" The original code incorrectly assumes that the 'inserted' entry is not in the right format (wrong JSON value type, not an 'Object') when virJSONValueObjectGetObject(temp_dev, "inserted") returns NULL. However, NULL is also returned when the 'inserted' entry is simply not present. This is the case when querying an empty CD-ROM device. With this patch, both conditions are reported accurately. Signed-off-by: Fabian Leditzky --- src/qemu/qemu_monitor_json.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9f417d27c6..06e7bb07a3 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4581,8 +4581,15 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_= throttle, =20 found =3D true; if (!(inserted =3D virJSONValueObjectGetObject(temp_dev, "inserted= "))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("block_io_throttle inserted entry was not in = expected format")); + if (virJSONValueObjectGet(temp_dev, "inserted")) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("block_io_throttle inserted entry was not= in expected format")); + } else { + /* caller should validate source presence prior, hence thi= s is an internal error */ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("block_io_throttle inserted entry is not = present")); + } + return -1; } GET_THROTTLE_STATS("bps", total_bytes_sec); --=20 2.48.1