From nobody Tue Sep 9 03:20:57 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=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 1738081895670565.7890021417634; Tue, 28 Jan 2025 08:31:35 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 781B21810; Tue, 28 Jan 2025 11:31:34 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9B57F1713; Tue, 28 Jan 2025 11:28:53 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id AEF4617A5; Tue, 28 Jan 2025 11:28:47 -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 F141317EF for ; Tue, 28 Jan 2025 11:28:34 -0500 (EST) Received: from mx-prod-mc-04.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-556-gF1JzTGIPoeGtvZYyLkIng-1; Tue, 28 Jan 2025 11:28:32 -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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 72EB31955DDF for ; Tue, 28 Jan 2025 16:28:31 +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 A107619560AA for ; Tue, 28 Jan 2025 16:28:30 +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=1738081714; 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=htjsQhwyiBznDZijXrkUevoVj2qDu8XyyJYjaeD+oBY=; b=UPxsqZMRQrM6IGmDcugpUOBouoFRFQniC2AMVSta6SI2l/YZphWdBT15mWX+915hdFka1G LQ1Dp7gaCvyRi8DePdsRStvsP1kwN/jRUvpEQ/9ENExG8hAoZK3273fuBSFPSSoaYBMhKA GNn9q1LrDPbXl+vZEl0MoeJf0iGrCjw= X-MC-Unique: gF1JzTGIPoeGtvZYyLkIng-1 X-Mimecast-MFC-AGG-ID: gF1JzTGIPoeGtvZYyLkIng From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 07/15] virStorageSource: Add fields for storing last I/O error message Date: Tue, 28 Jan 2025 17:28:11 +0100 Message-ID: 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: v7uDcvUe-58Vh7StZoK8hPyW-4vvHoeTIJKfOD2w4c0_1738081711 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BSTOE5EYBXHQ3CJIG3BTVC3ZL3AZAVKW X-Message-ID-Hash: BSTOE5EYBXHQ3CJIG3BTVC3ZL3AZAVKW 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: 1738081897352019000 Content-Type: text/plain; charset="utf-8" Hypervisors may report a I/O error message (unstable; for human use) to libvirt. In order to store it with the appropriate virStorageSource so that it can be later queried we need to add fields to virStorageSource to store the timestamp and message. The message is deliberately not copied via virStorageSourceCopy. The messages are also not serialized to the status XML as losing them on a daemon restart as they're likely to be stale anyways. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- src/conf/storage_source_conf.c | 5 +++++ src/conf/storage_source_conf.h | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index 2b658dd485..ca956a1b7c 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -917,6 +917,8 @@ virStorageSourceCopy(const virStorageSource *src, def->nfs_uid =3D src->nfs_uid; def->nfs_gid =3D src->nfs_gid; + /* 'ioerror_timestamp' and 'ioerror_message' are deliberately not copi= ed */ + return g_steal_pointer(&def); } @@ -1203,6 +1205,9 @@ virStorageSourceClear(virStorageSource *def) g_clear_pointer(&def->fdtuple, g_object_unref); + VIR_FREE(def->ioerror_timestamp); + VIR_FREE(def->ioerror_message); + /* clear everything except the class header as the object APIs * will break otherwise */ memset((char *) def + sizeof(def->parent), 0, diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index 9463722518..e6cbb93c06 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -445,6 +445,12 @@ struct _virStorageSource { * to do this decision. */ bool seclabelSkipRemember; + + /* Last instance of hypervisor originated I/O error message and timest= amp. + * The error stored here is not designed to be stable. The message + * is also not copied via virStorageSourceCopy */ + char *ioerror_timestamp; + char *ioerror_message; }; G_DEFINE_AUTOPTR_CLEANUP_FUNC(virStorageSource, virObjectUnref); --=20 2.48.1