mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
event: pass reason for PM events
Commit57ddcc23(v0.9.11) introduced the pmwakeup event, with an optional 'reason' field reserved for possible future expansion. But it failed to wire the field through RPC, so even if we do add a reason in the future, we will be unable to get it back to the user. Worse, commit7ba5defb(v1.0.0) repeated the same mistake with the pmsuspend_disk event. As long as we are adding new RPC calls, we might as well fix the events to actually match the signature so that we don't have to add yet another RPC in the future if we do decide to start using the reason field. * src/remote/remote_protocol.x (remote_domain_event_callback_pmwakeup_msg) (remote_domain_event_callback_pmsuspend_msg) (remote_domain_event_callback_pmsuspend_disk_msg): Add reason field. * daemon/remote.c (remoteRelayDomainEventPMWakeup) (remoteRelayDomainEventPMSuspend) (remoteRelayDomainEventPMSuspendDisk): Pass reason to client. * src/conf/domain_event.h (virDomainEventPMWakeupNewFromDom) (virDomainEventPMSuspendNewFromDom) (virDomainEventPMSuspendDiskNewFromDom): Require additional parameter. * src/conf/domain_event.c (virDomainEventPMClass): New class. (virDomainEventPMDispose): New function. (virDomainEventPMWakeupNew*, virDomainEventPMSuspendNew*) (virDomainEventPMSuspendDiskNew*) (virDomainEventDispatchDefaultFunc): Use new class. * src/remote/remote_driver.c (remoteDomainBuildEvent*PM*): Pass reason through. * src/remote_protocol-structs: Regenerate. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
+6
-6
@@ -714,7 +714,7 @@ remoteRelayDomainEventTrayChange(virConnectPtr conn,
|
||||
static int
|
||||
remoteRelayDomainEventPMWakeup(virConnectPtr conn,
|
||||
virDomainPtr dom,
|
||||
int reason ATTRIBUTE_UNUSED,
|
||||
int reason,
|
||||
void *opaque)
|
||||
{
|
||||
daemonClientEventCallbackPtr callback = opaque;
|
||||
@@ -737,7 +737,7 @@ remoteRelayDomainEventPMWakeup(virConnectPtr conn,
|
||||
(xdrproc_t)xdr_remote_domain_event_pmwakeup_msg, &data);
|
||||
} else {
|
||||
remote_domain_event_callback_pmwakeup_msg msg = { callback->callbackID,
|
||||
data };
|
||||
reason, data };
|
||||
|
||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMWAKEUP,
|
||||
@@ -750,7 +750,7 @@ remoteRelayDomainEventPMWakeup(virConnectPtr conn,
|
||||
static int
|
||||
remoteRelayDomainEventPMSuspend(virConnectPtr conn,
|
||||
virDomainPtr dom,
|
||||
int reason ATTRIBUTE_UNUSED,
|
||||
int reason,
|
||||
void *opaque)
|
||||
{
|
||||
daemonClientEventCallbackPtr callback = opaque;
|
||||
@@ -773,7 +773,7 @@ remoteRelayDomainEventPMSuspend(virConnectPtr conn,
|
||||
(xdrproc_t)xdr_remote_domain_event_pmsuspend_msg, &data);
|
||||
} else {
|
||||
remote_domain_event_callback_pmsuspend_msg msg = { callback->callbackID,
|
||||
data };
|
||||
reason, data };
|
||||
|
||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND,
|
||||
@@ -824,7 +824,7 @@ remoteRelayDomainEventBalloonChange(virConnectPtr conn,
|
||||
static int
|
||||
remoteRelayDomainEventPMSuspendDisk(virConnectPtr conn,
|
||||
virDomainPtr dom,
|
||||
int reason ATTRIBUTE_UNUSED,
|
||||
int reason,
|
||||
void *opaque)
|
||||
{
|
||||
daemonClientEventCallbackPtr callback = opaque;
|
||||
@@ -847,7 +847,7 @@ remoteRelayDomainEventPMSuspendDisk(virConnectPtr conn,
|
||||
(xdrproc_t)xdr_remote_domain_event_pmsuspend_disk_msg, &data);
|
||||
} else {
|
||||
remote_domain_event_callback_pmsuspend_disk_msg msg = { callback->callbackID,
|
||||
data };
|
||||
reason, data };
|
||||
|
||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK,
|
||||
|
||||
Reference in New Issue
Block a user