[PATCH 5/5] qemuProcessHandleIOError: Log IO errors in the VM log file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_process.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 95d0a40f84..e813c11f7e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -836,6 +836,7 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
     virStorageSource *errsrc = NULL;
     const char *srcPath = "";
     const char *devAlias = "";
+    g_autofree char *timestamp = NULL;

     virObjectLock(vm);
     priv = QEMU_DOMAIN_PRIVATE(vm);
@@ -884,6 +885,11 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
     }
     virObjectUnlock(vm);

+    if ((timestamp = virTimeStringNow()) != NULL) {
+        qemuDomainLogAppendMessage(priv->driver, vm, "%s: IO error device='%s' node-name='%s' reason='%s'\n",
+                                   timestamp, NULLSTR(devAlias), NULLSTR(nodename), NULLSTR(reason));
+    }
+
     virObjectEventStateQueue(priv->driver->domainEventState, ioErrorEvent);
     virObjectEventStateQueue(priv->driver->domainEventState, ioErrorEvent2);
     virObjectEventStateQueue(priv->driver->domainEventState, lifecycleEvent);
-- 
2.48.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux