libvirt/SOURCES/libvirt-qemuProcessHandleIOError-Log-IO-errors-in-the-VM-log-file.patch
2025-05-13 09:18:07 +03:00

49 lines
2.0 KiB
Diff

From 0ad096e3448a2b6e366995220f4266af34dd9010 Mon Sep 17 00:00:00 2001
Message-ID: <0ad096e3448a2b6e366995220f4266af34dd9010.1738940191.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Fri, 24 Jan 2025 17:01:34 +0100
Subject: [PATCH] qemuProcessHandleIOError: Log IO errors in the VM log file
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add a log entry to the VM log file for every time we receive an IO error
event from qemu. The log entry is as follows:
2025-01-24 16:03:28.928+0000: IO error device='virtio-disk0' node-name='libvirt-1-storage' reason='other: Input/output error'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 18f8d572be4caaa0c55a8d68a4048ef2360a03c5)
https://issues.redhat.com/browse/RHEL-77884
---
src/qemu/qemu_process.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 6b8a2af4ed..409734d948 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -829,7 +829,7 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
const char *nodename,
int action,
bool nospace,
- const char *reason G_GNUC_UNUSED)
+ const char *reason)
{
qemuDomainObjPrivate *priv;
virObjectEvent *ioErrorEvent = NULL;
@@ -867,6 +867,9 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
ioErrorEvent2 = virDomainEventIOErrorReasonNewFromObj(vm, eventPath, eventAlias, action, eventReason);
if ((timestamp = virTimeStringNow()) != NULL) {
+ qemuDomainLogAppendMessage(priv->driver, vm, "%s: IO error device='%s' node-name='%s' reason='%s'\n",
+ timestamp, NULLSTR(eventAlias), NULLSTR(nodename), NULLSTR(reason));
+
if (src) {
g_free(src->ioerror_timestamp);
g_free(src->ioerror_message);
--
2.48.1