From nobody Tue Sep 9 19:03:26 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=1735900161; cv=none; d=zohomail.com; s=zohoarc; b=XZTeKI7CGBJYdIbU2lUkmQxV1SnCk9zCoQY9Z+aGeZVwgHpK1ZRq/O+pI6JQ6k9wZSHy565d88kVTh+d//Z6jlgkncj6j4belnv2SJu0gyS7cX35uzVLx7CB4Q0/ZtCjg0VHoVDuDUaLcV68I6PHptoVflQfxqCiF43mgN+xKA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1735900161; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=ZC8P75PydxWLb8WS3aEwLRZEe4XsDC2ZS02jvWg67pI=; b=GpMw81J/96QOZoXn/m51FRGm2eICpZYnkpby4tu+qW917X+uA3pMEsraUtp96s1vCqkxWUiE3rwhqMI4DKctRD4RzTkAnuH+JGexULJvUMsRgmhi7uTdYL7aiMGmVWLqbhiGfZtqlQ9CHpGrX6sUusYJUr41hfhJRdwpsG56Ftk= 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 1735900160608309.1417834035216; Fri, 3 Jan 2025 02:29:20 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id D20839B4; Fri, 3 Jan 2025 05:29:18 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A4AD99FD; Fri, 3 Jan 2025 05:24:34 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id C45E29FB; Thu, 2 Jan 2025 10:22:00 -0500 (EST) Received: from mail-4327.protonmail.ch (mail-4327.protonmail.ch [185.70.43.27]) (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 250DD97F for ; Thu, 2 Jan 2025 10:21:59 -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_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 X-Greylist: delayed 430 seconds by postgrey-1.37 at lists.libvirt.org; Thu, 02 Jan 2025 10:21:59 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ldsoft.dev; s=protonmail3; t=1735830879; x=1736090079; bh=ZC8P75PydxWLb8WS3aEwLRZEe4XsDC2ZS02jvWg67pI=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=tzTRkxwTXLtE4TKSqoQ0fAEPTZ+bH3aAhNLBWu0F5c6Tm5FBy4Ho5vdQWs6gsD13H SOPxG1R1IrSKd8C5lVeuqY0y6IrlKimJnufUdSGnRap3MSZvdLTe/bZnBu6VG5TpHn GNbNXjikXHzPt1/h8FDUYx9tJfAgMuamU7/k3BNaMyEM5kLN/KejtDMLbqlE8T/Oyh dVXFrIPcmjc7igudcMwFATyL707aFRD8dLg7QCx8u3X87qN+4SN9s5dxOn24B6UCMI wQDLpK0nsSOA9pSnegmDSkmRNMTgUzb1WaH9KrHAYTuHxDUZlcjjr6/nUVvTirZ2r/ xa4WRoDGxRxuQ== Date: Thu, 02 Jan 2025 15:14:35 +0000 To: devel@lists.libvirt.org Subject: [PATCH] qemu monitor: Fix incorrect error message condition Message-ID: <20250102151431.22323-1-fabian@ldsoft.dev> Feedback-ID: 27156318:user:proton X-Pm-Message-ID: 19f16c822fc1e099f70d059845d399228b753be7 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: PNHOLXDG73PJ5EWZFA2KMXSE4P6UCWWY X-Message-ID-Hash: PNHOLXDG73PJ5EWZFA2KMXSE4P6UCWWY X-Mailman-Approved-At: Fri, 03 Jan 2025 10:24:18 -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: 1735900161748116600 Content-Type: text/plain; charset="utf-8" Fixes 'block_io_throttle inserted entry was not in expected format' error message spam. Without this patch, libvirtd writes an error message every time this function runs for a domain which has CD-ROM drives without a media attached. The 'inserted' key is not present when the drive is empty. 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. Signed-off-by: Fabian Leditzky --- src/qemu/qemu_monitor_json.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9f417d27c6..baf934c2af 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4581,8 +4581,16 @@ 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")); + /* + * Ensure that we only print the error message when the 'inser= ted' key is actually the wrong type/format. + * Some device types (e.g. SATA CD-ROM) will have no 'inserted= ' key present if no media is present. + * Avoid spamming this error in such cases. + */ + if (virJSONValueObjectGet(temp_dev, "inserted")) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("block_io_throttle inserted entry was not= in expected format")); + } + return -1; } GET_THROTTLE_STATS("bps", total_bytes_sec); --=20 2.47.1