mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-06 11:49:29 +00:00
qemuProcessHandleIOError: Populate I/O error reason to virStorageSource
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>
This commit is contained in:
parent
2f6c9fa4f6
commit
300f7e9bd4
@ -840,6 +840,7 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
|
|||||||
const char *eventReason = "";
|
const char *eventReason = "";
|
||||||
virDomainDiskDef *disk = NULL;
|
virDomainDiskDef *disk = NULL;
|
||||||
virStorageSource *src = NULL;
|
virStorageSource *src = NULL;
|
||||||
|
g_autofree char *timestamp = NULL;
|
||||||
|
|
||||||
virObjectLock(vm);
|
virObjectLock(vm);
|
||||||
priv = QEMU_DOMAIN_PRIVATE(vm);
|
priv = QEMU_DOMAIN_PRIVATE(vm);
|
||||||
@ -865,6 +866,15 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
|
|||||||
ioErrorEvent = virDomainEventIOErrorNewFromObj(vm, eventPath, eventAlias, action);
|
ioErrorEvent = virDomainEventIOErrorNewFromObj(vm, eventPath, eventAlias, action);
|
||||||
ioErrorEvent2 = virDomainEventIOErrorReasonNewFromObj(vm, eventPath, eventAlias, action, eventReason);
|
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(×tamp);
|
||||||
|
src->ioerror_message = g_strdup(reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (action == VIR_DOMAIN_EVENT_IO_ERROR_PAUSE &&
|
if (action == VIR_DOMAIN_EVENT_IO_ERROR_PAUSE &&
|
||||||
virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
|
virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
|
||||||
VIR_WARN("Transitioned guest %s to paused state due to IO error", vm->def->name);
|
VIR_WARN("Transitioned guest %s to paused state due to IO error", vm->def->name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user