libvirt/libvirt-virStorageSource-Add-fields-for-storing-last-I-O-error-message.patch
Jiri Denemark 62c343d5fa libvirt-10.10.0-6.el10
- build: Bump minimum glib2 version to 2.66.0 (RHEL-76802)
- qemuProcessHandleIOError: Refactor to extract 'priv' instead of 'driver' (RHEL-76802)
- qemu: Handle quirks of 'device' field of BLOCK_IO_ERROR event in monitor code (RHEL-76802)
- qemu: Rename 'diskAlias' to 'device' in qemu IO error event handling (RHEL-76802)
- qemuProcessHandleIOError: Rename local variables (RHEL-76802)
- qemuMonitorJSONHandleIOError: Do not munge 'reason' field of IO error event (RHEL-76802)
- qemuProcessHandleIOError: Prefer lookup by node name (RHEL-76802)
- qemuMonitorJSONHandleIOError: Propagate new 'qom-path' field (RHEL-76802)
- virStorageSource: Add fields for storing last I/O error message (RHEL-76802)
- qemuProcessHandleIOError: Populate I/O error reason to virStorageSource (RHEL-76802)
- qemuProcessHandleIOError: Log IO errors in the VM log file (RHEL-76802)
- libxlDomainGetMessages: Add existing flags to 'virCheckFlags' (RHEL-76802)
- virDomainObjGetMessages: Refactor using GPtrArray (RHEL-76802)
- virDomainGetMessages: Introduce VIR_DOMAIN_MESSAGE_IOERRORS (RHEL-76802)
- include: libvirt-domain: Reword documentation for @reason of VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON (RHEL-76802)
- include: libvirt-domain: Add 'message' @reason of VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON (RHEL-76802)
- qemuSnapshotForEachQcow2: Don't initialize 'nrollback' (RHEL-78186)
- qemu: process: Export qemuPrepareNVRAM for use in snapshot code (RHEL-78186)
- qemu: snapshot: Ensure that NVRAM image exists when taking inactive internal snapshot (RHEL-78186)
- qemuxmlconftest: Allow testing of the 'writable' flag for passed FDs for disks (RHEL-78353)
- qemuxmlconftest: Add testing of FDs with 'writable' flag in 'disk-source-fd' (RHEL-78353)
- qemu: domain: Initialize FD passthrough for a virStorageSource before using it (RHEL-78353)

Resolves: RHEL-76802, RHEL-78186, RHEL-78353
2025-02-07 15:07:04 +01:00

73 lines
2.6 KiB
Diff

From ea25e33134f5ff8b902f9795acbd2138418abb7f Mon Sep 17 00:00:00 2001
Message-ID: <ea25e33134f5ff8b902f9795acbd2138418abb7f.1738937224.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 27 Jan 2025 16:20:43 +0100
Subject: [PATCH] virStorageSource: Add fields for storing last I/O error
message
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 2f6c9fa4f6f4c0a36ffc2b24892eee78e1e4cf53)
https://issues.redhat.com/browse/RHEL-76802
---
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 = src->nfs_uid;
def->nfs_gid = src->nfs_gid;
+ /* 'ioerror_timestamp' and 'ioerror_message' are deliberately not copied */
+
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 timestamp.
+ * 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);
--
2.48.1