From afab4824ebe8b5a03dcdd3aa6b70359224219cd2 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Thu, 6 Sep 2012 16:56:08 +0200 Subject: [PATCH] Fix PMSuspend and PMWakeup events The unused reason parameter of PM{Suspend,Wakeup} event callbacks was completely ignored in lot of places and those events were not actually working at all. --- daemon/remote.c | 2 ++ examples/domain-events/events-c/event-test.c | 4 ++-- python/libvirt-override.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 90564399a5..5d2dd441f7 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -536,6 +536,7 @@ static int remoteRelayDomainEventTrayChange(virConnectPtr conn ATTRIBUTE_UNUSED, static int remoteRelayDomainEventPMWakeup(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainPtr dom, + int reason ATTRIBUTE_UNUSED, void *opaque) { virNetServerClientPtr client = opaque; remote_domain_event_pmwakeup_msg data; @@ -558,6 +559,7 @@ static int remoteRelayDomainEventPMWakeup(virConnectPtr conn ATTRIBUTE_UNUSED, static int remoteRelayDomainEventPMSuspend(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainPtr dom, + int reason ATTRIBUTE_UNUSED, void *opaque) { virNetServerClientPtr client = opaque; remote_domain_event_pmsuspend_msg data; diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index 347ee5a1aa..fc4d5750d9 100644 --- a/examples/domain-events/events-c/event-test.c +++ b/examples/domain-events/events-c/event-test.c @@ -377,7 +377,7 @@ static int myDomainEventPMWakeupCallback(virConnectPtr conn ATTRIBUTE_UNUSED, int reason ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED) { - printf("%s EVENT: Domain %s(%d) system pmwakeup", + printf("%s EVENT: Domain %s(%d) system pmwakeup\n", __func__, virDomainGetName(dom), virDomainGetID(dom)); return 0; } @@ -387,7 +387,7 @@ static int myDomainEventPMSuspendCallback(virConnectPtr conn ATTRIBUTE_UNUSED, int reason ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED) { - printf("%s EVENT: Domain %s(%d) system pmsuspend", + printf("%s EVENT: Domain %s(%d) system pmsuspend\n", __func__, virDomainGetName(dom), virDomainGetID(dom)); return 0; } diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 1e3ad89f10..ee6a776452 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -5331,7 +5331,7 @@ libvirt_virConnectDomainEventPMWakeupCallback(virConnectPtr conn ATTRIBUTE_UNUSE /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, (char*)"_dispatchDomainEventPMWakeupCallback", - (char*)"OO", + (char*)"OiO", pyobj_dom, reason, pyobj_cbData); @@ -5378,7 +5378,7 @@ libvirt_virConnectDomainEventPMSuspendCallback(virConnectPtr conn ATTRIBUTE_UNUS /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, (char*)"_dispatchDomainEventPMSuspendCallback", - (char*)"OO", + (char*)"OiO", pyobj_dom, reason, pyobj_cbData);