Following the patterns established by lifecycle events, this creates all the new RPC calls needed to pass callback IDs for every domain event, and changes the limits in client and server codes to use modern style when possible. I've tested all combinations: both 'old client and new server' and 'new client and old server' continue to work with the old RPCs, and 'new client and new server' benefit from server-side filtering with the new RPCs. * src/remote/remote_protocol.x (REMOTE_PROC_DOMAIN_EVENT_*): Add REMOTE_PROC_DOMAIN_EVENT_CALLBACK_* counterparts. * daemon/remote.c (remoteRelayDomainEvent*): Send callbackID via newer RPC when used with new-style registration. (remoteDispatchConnectDomainEventCallbackRegisterAny): Extend to cover all domain events. * src/remote/remote_driver.c (remoteDomainBuildEvent*): Add new Callback and Helper functions. (remoteEvents): Match order of RPC numbers, register new handlers. (remoteConnectDomainEventRegisterAny) (remoteConnectDomainEventDeregisterAny): Extend to cover all domain events. * src/remote_protocol-structs: Regenerate. Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> --- daemon/remote.c | 240 ++++++++++++++---- src/remote/remote_driver.c | 581 ++++++++++++++++++++++++++++++++++--------- src/remote/remote_protocol.x | 155 +++++++++++- src/remote_protocol-structs | 75 ++++++ 4 files changed, 886 insertions(+), 165 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 05fb708..2d5c9d1 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -179,16 +179,25 @@ remoteRelayDomainEventReboot(virConnectPtr conn ATTRIBUTE_UNUSED, if (callback->callbackID < 0) return -1; - VIR_DEBUG("Relaying domain reboot event %s %d, callback %d", - dom->name, dom->id, callback->callbackID); + VIR_DEBUG("Relaying domain reboot event %s %d, callback %d legacy %d", + dom->name, dom->id, callback->callbackID, callback->legacy); /* build return data */ memset(&data, 0, sizeof(data)); make_nonnull_domain(&data.dom, dom); - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_REBOOT, - (xdrproc_t)xdr_remote_domain_event_reboot_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_REBOOT, + (xdrproc_t)xdr_remote_domain_event_reboot_msg, &data); + } else { + remote_domain_event_callback_reboot_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_REBOOT, + (xdrproc_t)xdr_remote_domain_event_callback_reboot_msg, &msg); + } return 0; } @@ -206,17 +215,27 @@ remoteRelayDomainEventRTCChange(virConnectPtr conn ATTRIBUTE_UNUSED, if (callback->callbackID < 0) return -1; - VIR_DEBUG("Relaying domain rtc change event %s %d %lld, callback %d", - dom->name, dom->id, offset, callback->callbackID); + VIR_DEBUG("Relaying domain rtc change event %s %d %lld, callback %d legacy %d", + dom->name, dom->id, offset, + callback->callbackID, callback->legacy); /* build return data */ memset(&data, 0, sizeof(data)); make_nonnull_domain(&data.dom, dom); data.offset = offset; - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE, - (xdrproc_t)xdr_remote_domain_event_rtc_change_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE, + (xdrproc_t)xdr_remote_domain_event_rtc_change_msg, &data); + } else { + remote_domain_event_callback_rtc_change_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RTC_CHANGE, + (xdrproc_t)xdr_remote_domain_event_callback_rtc_change_msg, &msg); + } return 0; } @@ -242,9 +261,18 @@ remoteRelayDomainEventWatchdog(virConnectPtr conn ATTRIBUTE_UNUSED, make_nonnull_domain(&data.dom, dom); data.action = action; - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_WATCHDOG, - (xdrproc_t)xdr_remote_domain_event_watchdog_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_WATCHDOG, + (xdrproc_t)xdr_remote_domain_event_watchdog_msg, &data); + } else { + remote_domain_event_callback_watchdog_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WATCHDOG, + (xdrproc_t)xdr_remote_domain_event_callback_watchdog_msg, &msg); + } return 0; } @@ -276,9 +304,18 @@ remoteRelayDomainEventIOError(virConnectPtr conn ATTRIBUTE_UNUSED, make_nonnull_domain(&data.dom, dom); data.action = action; - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_IO_ERROR, - (xdrproc_t)xdr_remote_domain_event_io_error_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_IO_ERROR, + (xdrproc_t)xdr_remote_domain_event_io_error_msg, &data); + } else { + remote_domain_event_callback_io_error_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR, + (xdrproc_t)xdr_remote_domain_event_callback_io_error_msg, &msg); + } return 0; error: @@ -317,9 +354,18 @@ remoteRelayDomainEventIOErrorReason(virConnectPtr conn ATTRIBUTE_UNUSED, make_nonnull_domain(&data.dom, dom); - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON, - (xdrproc_t)xdr_remote_domain_event_io_error_reason_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON, + (xdrproc_t)xdr_remote_domain_event_io_error_reason_msg, &data); + } else { + remote_domain_event_callback_io_error_reason_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR_REASON, + (xdrproc_t)xdr_remote_domain_event_callback_io_error_reason_msg, &msg); + } return 0; @@ -382,9 +428,18 @@ remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED, } make_nonnull_domain(&data.dom, dom); - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_GRAPHICS, - (xdrproc_t)xdr_remote_domain_event_graphics_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_GRAPHICS, + (xdrproc_t)xdr_remote_domain_event_graphics_msg, &data); + } else { + remote_domain_event_callback_graphics_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GRAPHICS, + (xdrproc_t)xdr_remote_domain_event_callback_graphics_msg, &msg); + } return 0; @@ -429,9 +484,18 @@ remoteRelayDomainEventBlockJob(virConnectPtr conn ATTRIBUTE_UNUSED, data.status = status; make_nonnull_domain(&data.dom, dom); - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB, - (xdrproc_t)xdr_remote_domain_event_block_job_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB, + (xdrproc_t)xdr_remote_domain_event_block_job_msg, &data); + } else { + remote_domain_event_callback_block_job_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BLOCK_JOB, + (xdrproc_t)xdr_remote_domain_event_callback_block_job_msg, &msg); + } return 0; error: @@ -458,9 +522,18 @@ remoteRelayDomainEventControlError(virConnectPtr conn ATTRIBUTE_UNUSED, memset(&data, 0, sizeof(data)); make_nonnull_domain(&data.dom, dom); - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR, - (xdrproc_t)xdr_remote_domain_event_control_error_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR, + (xdrproc_t)xdr_remote_domain_event_control_error_msg, &data); + } else { + remote_domain_event_callback_control_error_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CONTROL_ERROR, + (xdrproc_t)xdr_remote_domain_event_callback_control_error_msg, &msg); + } return 0; } @@ -506,9 +579,18 @@ remoteRelayDomainEventDiskChange(virConnectPtr conn ATTRIBUTE_UNUSED, make_nonnull_domain(&data.dom, dom); - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE, - (xdrproc_t)xdr_remote_domain_event_disk_change_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE, + (xdrproc_t)xdr_remote_domain_event_disk_change_msg, &data); + } else { + remote_domain_event_callback_disk_change_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DISK_CHANGE, + (xdrproc_t)xdr_remote_domain_event_callback_disk_change_msg, &msg); + } return 0; @@ -544,9 +626,18 @@ remoteRelayDomainEventTrayChange(virConnectPtr conn ATTRIBUTE_UNUSED, make_nonnull_domain(&data.dom, dom); - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE, - (xdrproc_t)xdr_remote_domain_event_tray_change_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE, + (xdrproc_t)xdr_remote_domain_event_tray_change_msg, &data); + } else { + remote_domain_event_callback_tray_change_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TRAY_CHANGE, + (xdrproc_t)xdr_remote_domain_event_callback_tray_change_msg, &msg); + } return 0; } @@ -570,9 +661,18 @@ remoteRelayDomainEventPMWakeup(virConnectPtr conn ATTRIBUTE_UNUSED, memset(&data, 0, sizeof(data)); make_nonnull_domain(&data.dom, dom); - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP, - (xdrproc_t)xdr_remote_domain_event_pmwakeup_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP, + (xdrproc_t)xdr_remote_domain_event_pmwakeup_msg, &data); + } else { + remote_domain_event_callback_pmwakeup_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMWAKEUP, + (xdrproc_t)xdr_remote_domain_event_callback_pmwakeup_msg, &msg); + } return 0; } @@ -596,9 +696,18 @@ remoteRelayDomainEventPMSuspend(virConnectPtr conn ATTRIBUTE_UNUSED, memset(&data, 0, sizeof(data)); make_nonnull_domain(&data.dom, dom); - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND, - (xdrproc_t)xdr_remote_domain_event_pmsuspend_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND, + (xdrproc_t)xdr_remote_domain_event_pmsuspend_msg, &data); + } else { + remote_domain_event_callback_pmsuspend_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND, + (xdrproc_t)xdr_remote_domain_event_callback_pmsuspend_msg, &msg); + } return 0; } @@ -623,9 +732,18 @@ remoteRelayDomainEventBalloonChange(virConnectPtr conn ATTRIBUTE_UNUSED, make_nonnull_domain(&data.dom, dom); data.actual = actual; - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE, - (xdrproc_t)xdr_remote_domain_event_balloon_change_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE, + (xdrproc_t)xdr_remote_domain_event_balloon_change_msg, &data); + } else { + remote_domain_event_callback_balloon_change_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BALLOON_CHANGE, + (xdrproc_t)xdr_remote_domain_event_callback_balloon_change_msg, &msg); + } return 0; } @@ -650,9 +768,18 @@ remoteRelayDomainEventPMSuspendDisk(virConnectPtr conn ATTRIBUTE_UNUSED, memset(&data, 0, sizeof(data)); make_nonnull_domain(&data.dom, dom); - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND_DISK, - (xdrproc_t)xdr_remote_domain_event_pmsuspend_disk_msg, &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND_DISK, + (xdrproc_t)xdr_remote_domain_event_pmsuspend_disk_msg, &data); + } else { + remote_domain_event_callback_pmsuspend_disk_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK, + (xdrproc_t)xdr_remote_domain_event_callback_pmsuspend_disk_msg, &msg); + } return 0; } @@ -680,10 +807,20 @@ remoteRelayDomainEventDeviceRemoved(virConnectPtr conn ATTRIBUTE_UNUSED, make_nonnull_domain(&data.dom, dom); - remoteDispatchObjectEventSend(callback->client, remoteProgram, - REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMOVED, - (xdrproc_t)xdr_remote_domain_event_device_removed_msg, - &data); + if (callback->legacy) { + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMOVED, + (xdrproc_t)xdr_remote_domain_event_device_removed_msg, + &data); + } else { + remote_domain_event_callback_device_removed_msg msg = { callback->callbackID, + data }; + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED, + (xdrproc_t)xdr_remote_domain_event_callback_device_removed_msg, + &msg); + } return 0; } @@ -3514,8 +3651,7 @@ remoteDispatchConnectDomainEventCallbackRegisterAny(virNetServerPtr server ATTRI !(dom = get_nonnull_domain(priv->conn, *args->dom))) goto cleanup; - /* FIXME: support all domain events */ - if (args->eventID != VIR_DOMAIN_EVENT_ID_LIFECYCLE) { + if (args->eventID >= VIR_DOMAIN_EVENT_ID_LAST || args->eventID < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported event ID %d"), args->eventID); goto cleanup; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 35baaeb..4cdce81 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -218,67 +218,136 @@ remoteDomainBuildEventReboot(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virNetClientPtr client ATTRIBUTE_UNUSED, void *evdata, void *opaque); static void +remoteDomainBuildEventCallbackReboot(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque); + +static void remoteDomainBuildEventRTCChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void +remoteDomainBuildEventCallbackRTCChange(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); + +static void remoteDomainBuildEventWatchdog(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void +remoteDomainBuildEventCallbackWatchdog(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); + +static void remoteDomainBuildEventIOError(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void +remoteDomainBuildEventCallbackIOError(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); + +static void remoteDomainBuildEventIOErrorReason(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void +remoteDomainBuildEventCallbackIOErrorReason(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); + +static void remoteDomainBuildEventGraphics(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void +remoteDomainBuildEventCallbackGraphics(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); + +static void remoteDomainBuildEventControlError(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); +static void +remoteDomainBuildEventCallbackControlError(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); static void remoteDomainBuildEventBlockJob(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); +static void +remoteDomainBuildEventCallbackBlockJob(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); + static void remoteDomainBuildEventDiskChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); +static void +remoteDomainBuildEventCallbackDiskChange(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); static void remoteDomainBuildEventTrayChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); +static void +remoteDomainBuildEventCallbackTrayChange(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); static void remoteDomainBuildEventPMWakeup(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); +static void +remoteDomainBuildEventCallbackPMWakeup(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); static void remoteDomainBuildEventPMSuspend(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void +remoteDomainBuildEventCallbackPMSuspend(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); + +static void remoteDomainBuildEventBalloonChange(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); static void +remoteDomainBuildEventCallbackBalloonChange(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); + +static void remoteDomainBuildEventPMSuspendDisk(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); +static void +remoteDomainBuildEventCallbackPMSuspendDisk(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); static void remoteDomainBuildEventDeviceRemoved(virNetClientProgramPtr prog, virNetClientPtr client, void *evdata, void *opaque); +static void +remoteDomainBuildEventCallbackDeviceRemoved(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); static void remoteNetworkBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, @@ -286,18 +355,18 @@ remoteNetworkBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, void *evdata, void *opaque); static virNetClientProgramEvent remoteEvents[] = { - { REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE, - remoteDomainBuildEventRTCChange, - sizeof(remote_domain_event_rtc_change_msg), - (xdrproc_t)xdr_remote_domain_event_rtc_change_msg }, - { REMOTE_PROC_DOMAIN_EVENT_REBOOT, - remoteDomainBuildEventReboot, - sizeof(remote_domain_event_reboot_msg), - (xdrproc_t)xdr_remote_domain_event_reboot_msg }, { REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE, remoteDomainBuildEventLifecycle, sizeof(remote_domain_event_lifecycle_msg), (xdrproc_t)xdr_remote_domain_event_lifecycle_msg }, + { REMOTE_PROC_DOMAIN_EVENT_REBOOT, + remoteDomainBuildEventReboot, + sizeof(remote_domain_event_reboot_msg), + (xdrproc_t)xdr_remote_domain_event_reboot_msg }, + { REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE, + remoteDomainBuildEventRTCChange, + sizeof(remote_domain_event_rtc_change_msg), + (xdrproc_t)xdr_remote_domain_event_rtc_change_msg }, { REMOTE_PROC_DOMAIN_EVENT_WATCHDOG, remoteDomainBuildEventWatchdog, sizeof(remote_domain_event_watchdog_msg), @@ -306,14 +375,14 @@ static virNetClientProgramEvent remoteEvents[] = { remoteDomainBuildEventIOError, sizeof(remote_domain_event_io_error_msg), (xdrproc_t)xdr_remote_domain_event_io_error_msg }, - { REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON, - remoteDomainBuildEventIOErrorReason, - sizeof(remote_domain_event_io_error_reason_msg), - (xdrproc_t)xdr_remote_domain_event_io_error_reason_msg }, { REMOTE_PROC_DOMAIN_EVENT_GRAPHICS, remoteDomainBuildEventGraphics, sizeof(remote_domain_event_graphics_msg), (xdrproc_t)xdr_remote_domain_event_graphics_msg }, + { REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON, + remoteDomainBuildEventIOErrorReason, + sizeof(remote_domain_event_io_error_reason_msg), + (xdrproc_t)xdr_remote_domain_event_io_error_reason_msg }, { REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR, remoteDomainBuildEventControlError, sizeof(remote_domain_event_control_error_msg), @@ -367,6 +436,66 @@ static virNetClientProgramEvent remoteEvents[] = { remoteDomainBuildEventCallbackLifecycle, sizeof(remote_domain_event_callback_lifecycle_msg), (xdrproc_t)xdr_remote_domain_event_callback_lifecycle_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_REBOOT, + remoteDomainBuildEventCallbackReboot, + sizeof(remote_domain_event_callback_reboot_msg), + (xdrproc_t)xdr_remote_domain_event_callback_reboot_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RTC_CHANGE, + remoteDomainBuildEventCallbackRTCChange, + sizeof(remote_domain_event_callback_rtc_change_msg), + (xdrproc_t)xdr_remote_domain_event_callback_rtc_change_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WATCHDOG, + remoteDomainBuildEventCallbackWatchdog, + sizeof(remote_domain_event_callback_watchdog_msg), + (xdrproc_t)xdr_remote_domain_event_callback_watchdog_msg}, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR, + remoteDomainBuildEventCallbackIOError, + sizeof(remote_domain_event_callback_io_error_msg), + (xdrproc_t)xdr_remote_domain_event_callback_io_error_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GRAPHICS, + remoteDomainBuildEventCallbackGraphics, + sizeof(remote_domain_event_callback_graphics_msg), + (xdrproc_t)xdr_remote_domain_event_callback_graphics_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR_REASON, + remoteDomainBuildEventCallbackIOErrorReason, + sizeof(remote_domain_event_callback_io_error_reason_msg), + (xdrproc_t)xdr_remote_domain_event_callback_io_error_reason_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CONTROL_ERROR, + remoteDomainBuildEventCallbackControlError, + sizeof(remote_domain_event_callback_control_error_msg), + (xdrproc_t)xdr_remote_domain_event_callback_control_error_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BLOCK_JOB, + remoteDomainBuildEventCallbackBlockJob, + sizeof(remote_domain_event_callback_block_job_msg), + (xdrproc_t)xdr_remote_domain_event_callback_block_job_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DISK_CHANGE, + remoteDomainBuildEventCallbackDiskChange, + sizeof(remote_domain_event_callback_disk_change_msg), + (xdrproc_t)xdr_remote_domain_event_callback_disk_change_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TRAY_CHANGE, + remoteDomainBuildEventCallbackTrayChange, + sizeof(remote_domain_event_callback_tray_change_msg), + (xdrproc_t)xdr_remote_domain_event_callback_tray_change_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMWAKEUP, + remoteDomainBuildEventCallbackPMWakeup, + sizeof(remote_domain_event_callback_pmwakeup_msg), + (xdrproc_t)xdr_remote_domain_event_callback_pmwakeup_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND, + remoteDomainBuildEventCallbackPMSuspend, + sizeof(remote_domain_event_callback_pmsuspend_msg), + (xdrproc_t)xdr_remote_domain_event_callback_pmsuspend_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BALLOON_CHANGE, + remoteDomainBuildEventCallbackBalloonChange, + sizeof(remote_domain_event_callback_balloon_change_msg), + (xdrproc_t)xdr_remote_domain_event_callback_balloon_change_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK, + remoteDomainBuildEventCallbackPMSuspendDisk, + sizeof(remote_domain_event_callback_pmsuspend_disk_msg), + (xdrproc_t)xdr_remote_domain_event_callback_pmsuspend_disk_msg }, + { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED, + remoteDomainBuildEventCallbackDeviceRemoved, + sizeof(remote_domain_event_callback_device_removed_msg), + (xdrproc_t)xdr_remote_domain_event_callback_device_removed_msg }, }; enum virDrvOpenRemoteFlags { @@ -4609,13 +4738,11 @@ remoteDomainBuildEventCallbackLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UN static void -remoteDomainBuildEventReboot(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, - virNetClientPtr client ATTRIBUTE_UNUSED, - void *evdata, void *opaque) +remoteDomainBuildEventRebootHelper(virConnectPtr conn, + remote_domain_event_reboot_msg *msg, + int callbackID) { - virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; - remote_domain_event_reboot_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4626,18 +4753,33 @@ remoteDomainBuildEventReboot(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, event = virDomainEventRebootNewFromDom(dom); virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); } - - static void -remoteDomainBuildEventRTCChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, - virNetClientPtr client ATTRIBUTE_UNUSED, - void *evdata, void *opaque) +remoteDomainBuildEventReboot(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_reboot_msg *msg = evdata; + remoteDomainBuildEventRebootHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackReboot(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_callback_reboot_msg *msg = evdata; + remoteDomainBuildEventRebootHelper(conn, &msg->msg, msg->callbackID); +} + +static void +remoteDomainBuildEventRTCChangeHelper(virConnectPtr conn, + remote_domain_event_rtc_change_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_rtc_change_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4648,18 +4790,33 @@ remoteDomainBuildEventRTCChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, event = virDomainEventRTCChangeNewFromDom(dom, msg->offset); virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); } - - static void -remoteDomainBuildEventWatchdog(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, - virNetClientPtr client ATTRIBUTE_UNUSED, - void *evdata, void *opaque) +remoteDomainBuildEventRTCChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_rtc_change_msg *msg = evdata; + remoteDomainBuildEventRTCChangeHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackRTCChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_callback_rtc_change_msg *msg = evdata; + remoteDomainBuildEventRTCChangeHelper(conn, &msg->msg, msg->callbackID); +} + +static void +remoteDomainBuildEventWatchdogHelper(virConnectPtr conn, + remote_domain_event_watchdog_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_watchdog_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4670,18 +4827,33 @@ remoteDomainBuildEventWatchdog(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, event = virDomainEventWatchdogNewFromDom(dom, msg->action); virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); } - - static void -remoteDomainBuildEventIOError(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, - virNetClientPtr client ATTRIBUTE_UNUSED, - void *evdata, void *opaque) +remoteDomainBuildEventWatchdog(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_watchdog_msg *msg = evdata; + remoteDomainBuildEventWatchdogHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackWatchdog(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_callback_watchdog_msg *msg = evdata; + remoteDomainBuildEventWatchdogHelper(conn, &msg->msg, msg->callbackID); +} + +static void +remoteDomainBuildEventIOErrorHelper(virConnectPtr conn, + remote_domain_event_io_error_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_io_error_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4695,18 +4867,33 @@ remoteDomainBuildEventIOError(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, msg->action); virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); } - - static void -remoteDomainBuildEventIOErrorReason(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, - virNetClientPtr client ATTRIBUTE_UNUSED, - void *evdata, void *opaque) +remoteDomainBuildEventIOError(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_io_error_msg *msg = evdata; + remoteDomainBuildEventIOErrorHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackIOError(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_callback_io_error_msg *msg = evdata; + remoteDomainBuildEventIOErrorHelper(conn, &msg->msg, msg->callbackID); +} + +static void +remoteDomainBuildEventIOErrorReasonHelper(virConnectPtr conn, + remote_domain_event_io_error_reason_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_io_error_reason_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4722,17 +4909,33 @@ remoteDomainBuildEventIOErrorReason(virNetClientProgramPtr prog ATTRIBUTE_UNUSED virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); } - static void -remoteDomainBuildEventBlockJob(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, - virNetClientPtr client ATTRIBUTE_UNUSED, - void *evdata, void *opaque) +remoteDomainBuildEventIOErrorReason(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_io_error_reason_msg *msg = evdata; + remoteDomainBuildEventIOErrorReasonHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackIOErrorReason(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_callback_io_error_reason_msg *msg = evdata; + remoteDomainBuildEventIOErrorReasonHelper(conn, &msg->msg, msg->callbackID); +} + +static void +remoteDomainBuildEventBlockJobHelper(virConnectPtr conn, + remote_domain_event_block_job_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_block_job_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4745,17 +4948,33 @@ remoteDomainBuildEventBlockJob(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); } - static void -remoteDomainBuildEventGraphics(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, +remoteDomainBuildEventBlockJob(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virNetClientPtr client ATTRIBUTE_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_block_job_msg *msg = evdata; + remoteDomainBuildEventBlockJobHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackBlockJob(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_callback_block_job_msg *msg = evdata; + remoteDomainBuildEventBlockJobHelper(conn, &msg->msg, msg->callbackID); +} + +static void +remoteDomainBuildEventGraphicsHelper(virConnectPtr conn, + remote_domain_event_graphics_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_graphics_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; virDomainEventGraphicsAddressPtr localAddr = NULL; @@ -4801,7 +5020,7 @@ remoteDomainBuildEventGraphics(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); return; error: @@ -4826,16 +5045,31 @@ error: virDomainFree(dom); return; } - - static void -remoteDomainBuildEventControlError(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, - virNetClientPtr client ATTRIBUTE_UNUSED, - void *evdata, void *opaque) +remoteDomainBuildEventGraphics(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_graphics_msg *msg = evdata; + remoteDomainBuildEventGraphicsHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackGraphics(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_callback_graphics_msg *msg = evdata; + remoteDomainBuildEventGraphicsHelper(conn, &msg->msg, msg->callbackID); +} + +static void +remoteDomainBuildEventControlErrorHelper(virConnectPtr conn, + remote_domain_event_control_error_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_control_error_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4847,18 +5081,34 @@ remoteDomainBuildEventControlError(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); +} +static void +remoteDomainBuildEventControlError(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_control_error_msg *msg = evdata; + remoteDomainBuildEventControlErrorHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackControlError(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_callback_control_error_msg *msg = evdata; + remoteDomainBuildEventControlErrorHelper(conn, &msg->msg, msg->callbackID); } static void -remoteDomainBuildEventDiskChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, - virNetClientPtr client ATTRIBUTE_UNUSED, - void *evdata, void *opaque) +remoteDomainBuildEventDiskChangeHelper(virConnectPtr conn, + remote_domain_event_disk_change_msg *msg, + int callbackID) { - virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; - remote_domain_event_disk_change_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4874,18 +5124,34 @@ remoteDomainBuildEventDiskChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); } - - static void -remoteDomainBuildEventTrayChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, +remoteDomainBuildEventDiskChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virNetClientPtr client ATTRIBUTE_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_disk_change_msg *msg = evdata; + remoteDomainBuildEventDiskChangeHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackDiskChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_callback_disk_change_msg *msg = evdata; + remoteDomainBuildEventDiskChangeHelper(conn, &msg->msg, msg->callbackID); +} + + +static void +remoteDomainBuildEventTrayChangeHelper(virConnectPtr conn, + remote_domain_event_tray_change_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_tray_change_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4899,17 +5165,33 @@ remoteDomainBuildEventTrayChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); } - static void -remoteDomainBuildEventPMWakeup(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, - virNetClientPtr client ATTRIBUTE_UNUSED, - void *evdata, void *opaque) +remoteDomainBuildEventTrayChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_tray_change_msg *msg = evdata; + remoteDomainBuildEventTrayChangeHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackTrayChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_callback_tray_change_msg *msg = evdata; + remoteDomainBuildEventTrayChangeHelper(conn, &msg->msg, msg->callbackID); +} + +static void +remoteDomainBuildEventPMWakeupHelper(virConnectPtr conn, + remote_domain_event_pmwakeup_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_pmwakeup_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4921,17 +5203,33 @@ remoteDomainBuildEventPMWakeup(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); } - static void -remoteDomainBuildEventPMSuspend(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, - virNetClientPtr client ATTRIBUTE_UNUSED, - void *evdata, void *opaque) +remoteDomainBuildEventPMWakeup(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_pmwakeup_msg *msg = evdata; + remoteDomainBuildEventPMWakeupHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackPMWakeup(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_callback_pmwakeup_msg *msg = evdata; + remoteDomainBuildEventPMWakeupHelper(conn, &msg->msg, msg->callbackID); +} + +static void +remoteDomainBuildEventPMSuspendHelper(virConnectPtr conn, + remote_domain_event_pmsuspend_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_pmsuspend_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4943,18 +5241,34 @@ remoteDomainBuildEventPMSuspend(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); +} +static void +remoteDomainBuildEventPMSuspend(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_pmsuspend_msg *msg = evdata; + remoteDomainBuildEventPMSuspendHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackPMSuspend(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_callback_pmsuspend_msg *msg = evdata; + remoteDomainBuildEventPMSuspendHelper(conn, &msg->msg, msg->callbackID); } static void -remoteDomainBuildEventBalloonChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, - virNetClientPtr client ATTRIBUTE_UNUSED, - void *evdata, void *opaque) +remoteDomainBuildEventBalloonChangeHelper(virConnectPtr conn, + remote_domain_event_balloon_change_msg *msg, + int callbackID) { - virConnectPtr conn = opaque; struct private_data *priv = conn->privateData; - remote_domain_event_balloon_change_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4965,18 +5279,34 @@ remoteDomainBuildEventBalloonChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED event = virDomainEventBalloonChangeNewFromDom(dom, msg->actual); virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); } - - static void -remoteDomainBuildEventPMSuspendDisk(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, +remoteDomainBuildEventBalloonChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virNetClientPtr client ATTRIBUTE_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_balloon_change_msg *msg = evdata; + remoteDomainBuildEventBalloonChangeHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackBalloonChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_callback_balloon_change_msg *msg = evdata; + remoteDomainBuildEventBalloonChangeHelper(conn, &msg->msg, msg->callbackID); +} + + +static void +remoteDomainBuildEventPMSuspendDiskHelper(virConnectPtr conn, + remote_domain_event_pmsuspend_disk_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_pmsuspend_disk_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -4988,18 +5318,34 @@ remoteDomainBuildEventPMSuspendDisk(virNetClientProgramPtr prog ATTRIBUTE_UNUSED virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); } - - static void -remoteDomainBuildEventDeviceRemoved(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, +remoteDomainBuildEventPMSuspendDisk(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, virNetClientPtr client ATTRIBUTE_UNUSED, void *evdata, void *opaque) { virConnectPtr conn = opaque; + remote_domain_event_pmsuspend_disk_msg *msg = evdata; + remoteDomainBuildEventPMSuspendDiskHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackPMSuspendDisk(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_callback_pmsuspend_disk_msg *msg = evdata; + remoteDomainBuildEventPMSuspendDiskHelper(conn, &msg->msg, msg->callbackID); +} + + +static void +remoteDomainBuildEventDeviceRemovedHelper(virConnectPtr conn, + remote_domain_event_device_removed_msg *msg, + int callbackID) +{ struct private_data *priv = conn->privateData; - remote_domain_event_device_removed_msg *msg = evdata; virDomainPtr dom; virObjectEventPtr event = NULL; @@ -5011,7 +5357,25 @@ remoteDomainBuildEventDeviceRemoved(virNetClientProgramPtr prog ATTRIBUTE_UNUSED virDomainFree(dom); - remoteEventQueue(priv, event, -1); + remoteEventQueue(priv, event, callbackID); +} +static void +remoteDomainBuildEventDeviceRemoved(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_device_removed_msg *msg = evdata; + remoteDomainBuildEventDeviceRemovedHelper(conn, msg, -1); +} +static void +remoteDomainBuildEventCallbackDeviceRemoved(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, + virNetClientPtr client ATTRIBUTE_UNUSED, + void *evdata, void *opaque) +{ + virConnectPtr conn = opaque; + remote_domain_event_callback_device_removed_msg *msg = evdata; + remoteDomainBuildEventDeviceRemovedHelper(conn, &msg->msg, msg->callbackID); } @@ -5341,25 +5705,20 @@ remoteConnectDomainEventRegisterAny(virConnectPtr conn, int callbackID; int count; remote_nonnull_domain domain; - bool serverFilter; remoteDriverLock(priv); - serverFilter = priv->serverEventFilter; - /* FIXME support more than just lifecycle events */ - serverFilter &= eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE; - if ((count = virDomainEventStateRegisterClient(conn, priv->eventState, dom, eventID, callback, opaque, freecb, false, &callbackID, - serverFilter)) < 0) + priv->serverEventFilter)) < 0) goto done; /* If this is the first callback for this eventID, we need to enable * events on the server */ if (count == 1) { - if (serverFilter) { + if (priv->serverEventFilter) { remote_connect_domain_event_callback_register_any_args args; remote_connect_domain_event_callback_register_any_ret ret; @@ -5426,10 +5785,8 @@ remoteConnectDomainEventDeregisterAny(virConnectPtr conn, /* If that was the last callback for this eventID, we need to disable * events on the server */ - /* FIXME support more than just lifecycle events */ if (count == 0) { - if (priv->serverEventFilter && - eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE) { + if (priv->serverEventFilter) { remote_connect_domain_event_callback_deregister_any_args args; args.callbackID = remoteID; diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 96838ba..5a82395 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -2268,16 +2268,28 @@ struct remote_connect_domain_event_callback_deregister_any_args { struct remote_domain_event_reboot_msg { remote_nonnull_domain dom; }; +struct remote_domain_event_callback_reboot_msg { + int callbackID; + remote_domain_event_reboot_msg msg; +}; struct remote_domain_event_rtc_change_msg { remote_nonnull_domain dom; hyper offset; }; +struct remote_domain_event_callback_rtc_change_msg { + int callbackID; + remote_domain_event_rtc_change_msg msg; +}; struct remote_domain_event_watchdog_msg { remote_nonnull_domain dom; int action; }; +struct remote_domain_event_callback_watchdog_msg { + int callbackID; + remote_domain_event_watchdog_msg msg; +}; struct remote_domain_event_io_error_msg { remote_nonnull_domain dom; @@ -2285,6 +2297,10 @@ struct remote_domain_event_io_error_msg { remote_nonnull_string devAlias; int action; }; +struct remote_domain_event_callback_io_error_msg { + int callbackID; + remote_domain_event_io_error_msg msg; +}; struct remote_domain_event_io_error_reason_msg { remote_nonnull_domain dom; @@ -2293,6 +2309,10 @@ struct remote_domain_event_io_error_reason_msg { int action; remote_nonnull_string reason; }; +struct remote_domain_event_callback_io_error_reason_msg { + int callbackID; + remote_domain_event_io_error_reason_msg msg; +}; struct remote_domain_event_graphics_address { int family; @@ -2315,6 +2335,10 @@ struct remote_domain_event_graphics_msg { remote_nonnull_string authScheme; remote_domain_event_graphics_identity subject<REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX>; }; +struct remote_domain_event_callback_graphics_msg { + int callbackID; + remote_domain_event_graphics_msg msg; +}; struct remote_domain_event_block_job_msg { remote_nonnull_domain dom; @@ -2322,6 +2346,10 @@ struct remote_domain_event_block_job_msg { int type; int status; }; +struct remote_domain_event_callback_block_job_msg { + int callbackID; + remote_domain_event_block_job_msg msg; +}; struct remote_domain_event_disk_change_msg { remote_nonnull_domain dom; @@ -2330,29 +2358,53 @@ struct remote_domain_event_disk_change_msg { remote_nonnull_string devAlias; int reason; }; +struct remote_domain_event_callback_disk_change_msg { + int callbackID; + remote_domain_event_disk_change_msg msg; +}; struct remote_domain_event_tray_change_msg { remote_nonnull_domain dom; remote_nonnull_string devAlias; int reason; }; +struct remote_domain_event_callback_tray_change_msg { + int callbackID; + remote_domain_event_tray_change_msg msg; +}; struct remote_domain_event_pmwakeup_msg { remote_nonnull_domain dom; }; +struct remote_domain_event_callback_pmwakeup_msg { + int callbackID; + remote_domain_event_pmwakeup_msg msg; +}; struct remote_domain_event_pmsuspend_msg { remote_nonnull_domain dom; }; +struct remote_domain_event_callback_pmsuspend_msg { + int callbackID; + remote_domain_event_pmsuspend_msg msg; +}; struct remote_domain_event_balloon_change_msg { remote_nonnull_domain dom; unsigned hyper actual; }; +struct remote_domain_event_callback_balloon_change_msg { + int callbackID; + remote_domain_event_balloon_change_msg msg; +}; struct remote_domain_event_pmsuspend_disk_msg { remote_nonnull_domain dom; }; +struct remote_domain_event_callback_pmsuspend_disk_msg { + int callbackID; + remote_domain_event_pmsuspend_disk_msg msg; +}; struct remote_domain_managed_save_args { remote_nonnull_domain dom; @@ -2631,6 +2683,10 @@ struct remote_domain_migrate_confirm3_args { struct remote_domain_event_control_error_msg { remote_nonnull_domain dom; }; +struct remote_domain_event_callback_control_error_msg { + int callbackID; + remote_domain_event_control_error_msg msg; +}; struct remote_domain_get_control_info_args { remote_nonnull_domain dom; @@ -2850,10 +2906,17 @@ struct remote_domain_migrate_confirm3_params_args { int cancelled; }; +/* The device removed event is the last event where we have to support + * dual forms for back-compat to older clients; all future events can + * use just the modern form with callbackID. */ struct remote_domain_event_device_removed_msg { remote_nonnull_domain dom; remote_nonnull_string devAlias; }; +struct remote_domain_event_callback_device_removed_msg { + int callbackID; + remote_domain_event_device_removed_msg msg; +}; struct remote_connect_get_cpu_model_names_args { remote_nonnull_string arch; @@ -5100,5 +5163,95 @@ enum remote_procedure { * @generate: both * @acl: none */ - REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE = 318 + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE = 318, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_REBOOT = 319, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RTC_CHANGE = 320, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WATCHDOG = 321, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR = 322, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GRAPHICS = 323, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR_REASON = 324, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CONTROL_ERROR = 325, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BLOCK_JOB = 326, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DISK_CHANGE = 327, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TRAY_CHANGE = 328, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMWAKEUP = 329, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND = 330, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BALLOON_CHANGE = 331, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK = 332, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED = 333 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 39d3981..fdff787 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -1724,20 +1724,36 @@ struct remote_connect_domain_event_callback_deregister_any_args { struct remote_domain_event_reboot_msg { remote_nonnull_domain dom; }; +struct remote_domain_event_callback_reboot_msg { + int callbackID; + remote_domain_event_reboot_msg msg; +}; struct remote_domain_event_rtc_change_msg { remote_nonnull_domain dom; int64_t offset; }; +struct remote_domain_event_callback_rtc_change_msg { + int callbackID; + remote_domain_event_rtc_change_msg msg; +}; struct remote_domain_event_watchdog_msg { remote_nonnull_domain dom; int action; }; +struct remote_domain_event_callback_watchdog_msg { + int callbackID; + remote_domain_event_watchdog_msg msg; +}; struct remote_domain_event_io_error_msg { remote_nonnull_domain dom; remote_nonnull_string srcPath; remote_nonnull_string devAlias; int action; }; +struct remote_domain_event_callback_io_error_msg { + int callbackID; + remote_domain_event_io_error_msg msg; +}; struct remote_domain_event_io_error_reason_msg { remote_nonnull_domain dom; remote_nonnull_string srcPath; @@ -1745,6 +1761,10 @@ struct remote_domain_event_io_error_reason_msg { int action; remote_nonnull_string reason; }; +struct remote_domain_event_callback_io_error_reason_msg { + int callbackID; + remote_domain_event_io_error_reason_msg msg; +}; struct remote_domain_event_graphics_address { int family; remote_nonnull_string node; @@ -1765,12 +1785,20 @@ struct remote_domain_event_graphics_msg { remote_domain_event_graphics_identity * subject_val; } subject; }; +struct remote_domain_event_callback_graphics_msg { + int callbackID; + remote_domain_event_graphics_msg msg; +}; struct remote_domain_event_block_job_msg { remote_nonnull_domain dom; remote_nonnull_string path; int type; int status; }; +struct remote_domain_event_callback_block_job_msg { + int callbackID; + remote_domain_event_block_job_msg msg; +}; struct remote_domain_event_disk_change_msg { remote_nonnull_domain dom; remote_string oldSrcPath; @@ -1778,24 +1806,48 @@ struct remote_domain_event_disk_change_msg { remote_nonnull_string devAlias; int reason; }; +struct remote_domain_event_callback_disk_change_msg { + int callbackID; + remote_domain_event_disk_change_msg msg; +}; struct remote_domain_event_tray_change_msg { remote_nonnull_domain dom; remote_nonnull_string devAlias; int reason; }; +struct remote_domain_event_callback_tray_change_msg { + int callbackID; + remote_domain_event_tray_change_msg msg; +}; struct remote_domain_event_pmwakeup_msg { remote_nonnull_domain dom; }; +struct remote_domain_event_callback_pmwakeup_msg { + int callbackID; + remote_domain_event_pmwakeup_msg msg; +}; struct remote_domain_event_pmsuspend_msg { remote_nonnull_domain dom; }; +struct remote_domain_event_callback_pmsuspend_msg { + int callbackID; + remote_domain_event_pmsuspend_msg msg; +}; struct remote_domain_event_balloon_change_msg { remote_nonnull_domain dom; uint64_t actual; }; +struct remote_domain_event_callback_balloon_change_msg { + int callbackID; + remote_domain_event_balloon_change_msg msg; +}; struct remote_domain_event_pmsuspend_disk_msg { remote_nonnull_domain dom; }; +struct remote_domain_event_callback_pmsuspend_disk_msg { + int callbackID; + remote_domain_event_pmsuspend_disk_msg msg; +}; struct remote_domain_managed_save_args { remote_nonnull_domain dom; u_int flags; @@ -2064,6 +2116,10 @@ struct remote_domain_migrate_confirm3_args { struct remote_domain_event_control_error_msg { remote_nonnull_domain dom; }; +struct remote_domain_event_callback_control_error_msg { + int callbackID; + remote_domain_event_control_error_msg msg; +}; struct remote_domain_get_control_info_args { remote_nonnull_domain dom; u_int flags; @@ -2330,6 +2386,10 @@ struct remote_domain_event_device_removed_msg { remote_nonnull_domain dom; remote_nonnull_string devAlias; }; +struct remote_domain_event_callback_device_removed_msg { + int callbackID; + remote_domain_event_device_removed_msg msg; +}; struct remote_connect_get_cpu_model_names_args { remote_nonnull_string arch; int need_results; @@ -2677,4 +2737,19 @@ enum remote_procedure { REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_REGISTER_ANY = 316, REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_DEREGISTER_ANY = 317, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE = 318, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_REBOOT = 319, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RTC_CHANGE = 320, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WATCHDOG = 321, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR = 322, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GRAPHICS = 323, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR_REASON = 324, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CONTROL_ERROR = 325, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BLOCK_JOB = 326, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DISK_CHANGE = 327, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TRAY_CHANGE = 328, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMWAKEUP = 329, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND = 330, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BALLOON_CHANGE = 331, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK = 332, + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED = 333, }; -- 1.8.4.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list