mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Add support for another explicit IO error event
This introduces a new event type
VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
This event is the same as the previous VIR_DOMAIN_ID_IO_ERROR
event, but also includes a string describing the cause of
the event.
Thus there is a new callback definition for this event type
typedef void (*virConnectDomainEventIOErrorReasonCallback)(virConnectPtr conn,
virDomainPtr dom,
const char *srcPath,
const char *devAlias,
int action,
const char *reason,
void *opaque);
This is currently wired up to the QEMU block IO error events
* daemon/remote.c: Dispatch IO error events to client
* examples/domain-events/events-c/event-test.c: Watch for
IO error events
* include/libvirt/libvirt.h.in: Define new IO error event ID
and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
src/libvirt_private.syms: Extend API to handle IO error events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
for block IO errors and emit a libvirt IO error event
* src/remote/remote_driver.c: Receive and dispatch IO error
events to application
* src/remote/remote_protocol.x: Wire protocol definition for
IO error events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
src/qemu/qemu_monitor_json.c: Watch for BLOCK_IO_ERROR event
from QEMU monitor
This commit is contained in:
@@ -256,6 +256,43 @@ static int remoteRelayDomainEventIOError(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int remoteRelayDomainEventIOErrorReason(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virDomainPtr dom,
|
||||
const char *srcPath,
|
||||
const char *devAlias,
|
||||
int action,
|
||||
const char *reason,
|
||||
void *opaque)
|
||||
{
|
||||
struct qemud_client *client = opaque;
|
||||
remote_domain_event_io_error_reason_msg data;
|
||||
|
||||
if (!client)
|
||||
return -1;
|
||||
|
||||
REMOTE_DEBUG("Relaying domain io error %s %d %s %s %d %s",
|
||||
dom->name, dom->id, srcPath, devAlias, action, reason);
|
||||
|
||||
virMutexLock(&client->lock);
|
||||
|
||||
/* build return data */
|
||||
memset(&data, 0, sizeof data);
|
||||
make_nonnull_domain (&data.dom, dom);
|
||||
data.srcPath = (char*)srcPath;
|
||||
data.devAlias = (char*)devAlias;
|
||||
data.action = action;
|
||||
data.reason = (char*)reason;
|
||||
|
||||
remoteDispatchDomainEventSend (client,
|
||||
REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON,
|
||||
(xdrproc_t)xdr_remote_domain_event_io_error_reason_msg, &data);
|
||||
|
||||
virMutexUnlock(&client->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virDomainPtr dom,
|
||||
int phase,
|
||||
@@ -327,6 +364,7 @@ static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
|
||||
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventWatchdog),
|
||||
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventIOError),
|
||||
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventGraphics),
|
||||
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventIOErrorReason),
|
||||
};
|
||||
|
||||
verify(ARRAY_CARDINALITY(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
|
||||
|
||||
Reference in New Issue
Block a user