]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuProcessHandleIOError: Log IO errors in the VM log file
authorPeter Krempa <pkrempa@redhat.com>
Fri, 24 Jan 2025 16:01:34 +0000 (17:01 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 4 Feb 2025 13:40:55 +0000 (14:40 +0100)
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>
src/qemu/qemu_process.c

index d73c52542b1909f873d817885b8aa08a45ea5fd3..e9342287ab917778b59e7040d579594578b469b0 100644 (file)
@@ -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);