diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index c9018c0360..c910b31f91 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -4884,6 +4884,12 @@ typedef void (*virConnectDomainEventIOErrorCallback)(virConnectPtr conn, * The callback signature to use when registering for an event of type * VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON with virConnectDomainEventRegisterAny() * + * If the I/O error is known to be caused by an ENOSPC condition in + * the host (where resizing the disk to be larger will allow the guest + * to be resumed as if nothing happened), @reason will be "enospc". + * Otherwise, @reason will be "", although future strings may be added + * if determination of other error types becomes possible. + * */ typedef void (*virConnectDomainEventIOErrorReasonCallback)(virConnectPtr conn, virDomainPtr dom, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 90a125faa6..6504d15605 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -739,11 +739,13 @@ VIR_ENUM_IMPL(qemuMonitorIOErrorAction, VIR_DOMAIN_EVENT_IO_ERROR_LAST, "ignore", "stop", "report"); -static void qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr data) +static void +qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr data) { const char *device; const char *action; - const char *reason; + const char *reason = ""; + bool nospc = false; int actionID; /* Throughout here we try our best to carry on upon errors, @@ -759,14 +761,8 @@ static void qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr dat VIR_WARN("missing device in disk io error event"); } -#if 0 - if ((reason = virJSONValueObjectGetString(data, "reason")) == NULL) { - VIR_WARN("missing reason in disk io error event"); - reason = ""; - } -#else - reason = ""; -#endif + if (virJSONValueObjectGetBoolean(data, "nospace", &nospc) == 0 && nospc) + reason = "enospc"; if ((actionID = qemuMonitorIOErrorActionTypeFromString(action)) < 0) { VIR_WARN("unknown disk io error action '%s'", action);