qemuProcessHandleIOError: Log IO errors in the VM log file

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>
This commit is contained in:
Peter Krempa 2025-01-24 17:01:34 +01:00
parent 300f7e9bd4
commit 18f8d572be

View 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);