libvirt/libvirt-qemuProcessHandleIOError-Populate-I-O-error-reason-to-virStorageSource.patch
Jiri Denemark 26e17db3c8 libvirt-10.10.0-6.el9
- build: Bump minimum glib2 version to 2.66.0 (RHEL-77884)
- qemuProcessHandleIOError: Refactor to extract 'priv' instead of 'driver' (RHEL-77884)
- qemu: Handle quirks of 'device' field of BLOCK_IO_ERROR event in monitor code (RHEL-77884)
- qemu: Rename 'diskAlias' to 'device' in qemu IO error event handling (RHEL-77884)
- qemuProcessHandleIOError: Rename local variables (RHEL-77884)
- qemuMonitorJSONHandleIOError: Do not munge 'reason' field of IO error event (RHEL-77884)
- qemuProcessHandleIOError: Prefer lookup by node name (RHEL-77884)
- qemuMonitorJSONHandleIOError: Propagate new 'qom-path' field (RHEL-77884)
- virStorageSource: Add fields for storing last I/O error message (RHEL-77884)
- qemuProcessHandleIOError: Populate I/O error reason to virStorageSource (RHEL-77884)
- qemuProcessHandleIOError: Log IO errors in the VM log file (RHEL-77884)
- libxlDomainGetMessages: Add existing flags to 'virCheckFlags' (RHEL-77884)
- virDomainObjGetMessages: Refactor using GPtrArray (RHEL-77884)
- virDomainGetMessages: Introduce VIR_DOMAIN_MESSAGE_IOERRORS (RHEL-77884)
- include: libvirt-domain: Reword documentation for @reason of VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON (RHEL-77884)
- include: libvirt-domain: Add 'message' @reason of VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON (RHEL-77884)
- qemuSnapshotForEachQcow2: Don't initialize 'nrollback' (RHEL-73315)
- qemu: process: Export qemuPrepareNVRAM for use in snapshot code (RHEL-73315)
- qemu: snapshot: Ensure that NVRAM image exists when taking inactive internal snapshot (RHEL-73315)
- qemuxmlconftest: Allow testing of the 'writable' flag for passed FDs for disks (RHEL-37519)
- qemuxmlconftest: Add testing of FDs with 'writable' flag in 'disk-source-fd' (RHEL-37519)
- qemu: domain: Initialize FD passthrough for a virStorageSource before using it (RHEL-37519)

Resolves: RHEL-37519, RHEL-73315, RHEL-77884
2025-02-07 15:56:31 +01:00

56 lines
2.1 KiB
Diff

From d67189b0a37a76b60bab7d9e1f527bf4d984be16 Mon Sep 17 00:00:00 2001
Message-ID: <d67189b0a37a76b60bab7d9e1f527bf4d984be16.1738940191.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 27 Jan 2025 19:17:16 +0100
Subject: [PATCH] qemuProcessHandleIOError: Populate I/O error reason to
virStorageSource
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Record the last I/O error reason and timestamp which happened with the
corresponding virStorageSource struct.
This will later allow querying the last error e.g. via the
virDomainGetMessages() API.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 300f7e9bd4ee4e043cac1a84059fe4a60b101cf1)
https://issues.redhat.com/browse/RHEL-77884
---
src/qemu/qemu_process.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c95b1ecd82..6b8a2af4ed 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -840,6 +840,7 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
const char *eventReason = "";
virDomainDiskDef *disk = NULL;
virStorageSource *src = NULL;
+ g_autofree char *timestamp = NULL;
virObjectLock(vm);
priv = QEMU_DOMAIN_PRIVATE(vm);
@@ -865,6 +866,15 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
ioErrorEvent = virDomainEventIOErrorNewFromObj(vm, eventPath, eventAlias, action);
ioErrorEvent2 = virDomainEventIOErrorReasonNewFromObj(vm, eventPath, eventAlias, action, eventReason);
+ if ((timestamp = virTimeStringNow()) != NULL) {
+ if (src) {
+ g_free(src->ioerror_timestamp);
+ g_free(src->ioerror_message);
+ src->ioerror_timestamp = g_steal_pointer(&timestamp);
+ src->ioerror_message = g_strdup(reason);
+ }
+ }
+
if (action == VIR_DOMAIN_EVENT_IO_ERROR_PAUSE &&
virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
VIR_WARN("Transitioned guest %s to paused state due to IO error", vm->def->name);
--
2.48.1