From nobody Mon Feb 9 14:05:29 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1738082035396398.030483120064; Tue, 28 Jan 2025 08:33:55 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9D8991C31; Tue, 28 Jan 2025 11:33:54 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 519EA188F; Tue, 28 Jan 2025 11:29:12 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 471911802; Tue, 28 Jan 2025 11:29:00 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 267201AF4 for ; Tue, 28 Jan 2025 11:28:43 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-HNTkS2QWNES4bCymtEYLBg-1; Tue, 28 Jan 2025 11:28:41 -0500 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 85FFA19560B8 for ; Tue, 28 Jan 2025 16:28:40 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.2]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B3B1019560AA for ; Tue, 28 Jan 2025 16:28:39 +0000 (UTC) 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, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738081722; 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=hpalaE2JRH9irMKv3OE9Cm5oY9UKPV9I4rm2VXWLq18=; b=S2Gof3ToxsDAtZRvR4X4zWDdevRF7x29CL7l2CoOvJ1C08dxBXHfRUdRwxpQEvcHsJOK6k mmwMEk7e2F4I/Apx3Sqt9MwCM/lmJVr2QopK+25B2GJ1O4b8QYoYhKKgC8H43GlWVo81RZ 4Ilg9krXUD1iQ/I5OJcFrGCqBCBwNu4= X-MC-Unique: HNTkS2QWNES4bCymtEYLBg-1 X-Mimecast-MFC-AGG-ID: HNTkS2QWNES4bCymtEYLBg From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 14/15] include: libvirt-domain: Add 'hypervisor-message' @reason of VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON Date: Tue, 28 Jan 2025 17:28:18 +0100 Message-ID: <0206940a21d7dc7d8a6209c504fff6beed012ada.1738081457.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: WH5lsvT8V3tye574C0u_MIrvcMeTmaG7NDT-XrCIAus_1738081720 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: XRDUXMFAA2POHXBRNCZJUPVK7W5QQOBK X-Message-ID-Hash: XRDUXMFAA2POHXBRNCZJUPVK7W5QQOBK X-MailFrom: pkrempa@redhat.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header 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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1738082036481019000 Content-Type: text/plain; charset="utf-8" In case when the hypervisor does report the reason for the I/O error as an unstable string to display to users we can add a @reason possibility for the I/O error event noting that the error is available. Add 'hypervisor-message' as a reason enumeration value and document it to instruct users to look at the logs or virDomainGetMessages(). The resulting event looks like: event 'io-error' for domain 'cd': /dev/mapper/errdev0 (virtio-disk0) repor= t due to hypervisor-message Users then can look at the virDomainGetMessages() API: I/O error: disk=3D'vda', index=3D'1', path=3D'/dev/mapper/errdev0', timest= amp=3D'2025-01-28 15:47:52.776+0000', message'Input/output error' Or at the VM log file: 2025-01-28 15:47:52.776+0000: IO error device=3D'virtio-disk0' node-name= =3D'libvirt-1-storage' reason=3D'Input/output error' Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- include/libvirt/libvirt-domain.h | 4 ++++ src/qemu/qemu_process.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 941e67aab1..2615d7b76a 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -4812,6 +4812,10 @@ typedef void (*virConnectDomainEventIOErrorCallback)= (virConnectPtr conn, * - "enospc": The I/O error is known to be caused by an ENOSPC condition = in * the host. Resizing the disk source to be larger will allow = the * guest to be resumed as if nothing happened. + * - "hypervisor-message": The hypervisor reported a string description of= the + * I/O error. The errors are usually logged into t= he + * domain log file or the last instance of the err= or + * string can be queried via virDomainGetMessages(= ). * * Since: 0.8.1 */ diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e9342287ab..cf6e0517ef 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -862,6 +862,8 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED, if (nospace) eventReason =3D "enospc"; + else if (reason) + eventReason =3D "hypervisor-message"; ioErrorEvent =3D virDomainEventIOErrorNewFromObj(vm, eventPath, eventA= lias, action); ioErrorEvent2 =3D virDomainEventIOErrorReasonNewFromObj(vm, eventPath,= eventAlias, action, eventReason); --=20 2.48.1