[PATCH v2 09/15] qemuProcessHandleIOError: Log IO errors in the VM log file

Peter Krempa posted 15 patches 7 months, 1 week ago
[PATCH v2 09/15] qemuProcessHandleIOError: Log IO errors in the VM log file
Posted by Peter Krempa 7 months, 1 week ago
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>
---
 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 d73c52542b..e9342287ab 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
Re: [PATCH v2 09/15] qemuProcessHandleIOError: Log IO errors in the VM log file
Posted by Daniel P. Berrangé 7 months, 1 week ago
On Tue, Jan 28, 2025 at 05:28:13PM +0100, Peter Krempa wrote:
> 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>
> ---
>  src/qemu/qemu_process.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|