summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2010-03-18 13:01:48 +0000
committerDaniel P. Berrange <berrange@redhat.com>2010-03-26 13:52:03 +0000
commit79368a681c1215c7efffb8cd9727095dc50141e7 (patch)
tree7bd5511e66358d6f181c3caa62f6ad1a6aff2b91
parent42008501952c63609a29717e9695f308a339f61a (diff)
downloadlibvirt-python-split-79368a681c1215c7efffb8cd9727095dc50141e7.tar.gz
libvirt-python-split-79368a681c1215c7efffb8cd9727095dc50141e7.tar.xz
libvirt-python-split-79368a681c1215c7efffb8cd9727095dc50141e7.zip
Introduce a new public API for domain events
The current API for domain events has a number of problems - Only allows for domain lifecycle change events - Does not allow the same callback to be registered multiple times - Does not allow filtering of events to a specific domain This introduces a new more general purpose domain events API typedef enum { VIR_DOMAIN_EVENT_ID_LIFECYCLE = 0, /* virConnectDomainEventCallback */ ...more events later.. } int virConnectDomainEventRegisterAny(virConnectPtr conn, virDomainPtr dom, /* Optional, to filter */ int eventID, virConnectDomainEventGenericCallback cb, void *opaque, virFreeCallback freecb); int virConnectDomainEventDeregisterAny(virConnectPtr conn, int callbackID); Since different event types can received different data in the callback, the API is defined with a generic callback. Specific events will each have a custom signature for their callback. Thus when registering an event it is neccessary to cast the callback to the generic signature eg int myDomainEventCallback(virConnectPtr conn, virDomainPtr dom, int event, int detail, void *opaque) { ... } virConnectDomainEventRegisterAny(conn, NULL, VIR_DOMAIN_EVENT_ID_LIFECYCLE, VIR_DOMAIN_EVENT_CALLBACK(myDomainEventCallback) NULL, NULL); The VIR_DOMAIN_EVENT_CALLBACK() macro simply does a "bad" cast to the generic signature * include/libvirt/libvirt.h.in: Define new APIs for registering domain events * src/driver.h: Internal driver entry points for new events APIs * src/libvirt.c: Wire up public API to driver API for events APIs * src/libvirt_public.syms: Export new APIs * src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/opennebula/one_driver.c, src/openvz/openvz_driver.c, src/phyp/phyp_driver.c, src/qemu/qemu_driver.c, src/remote/remote_driver.c, src/test/test_driver.c, src/uml/uml_driver.c, src/vbox/vbox_tmpl.c, src/xen/xen_driver.c, src/xenapi/xenapi_driver.c: Stub out new API entries
-rwxr-xr-xgenerator.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/generator.py b/generator.py
index f7625fd..d8a44c7 100755
--- a/generator.py
+++ b/generator.py
@@ -169,6 +169,7 @@ skipped_modules = {
skipped_types = {
# 'int *': "usually a return type",
'virConnectDomainEventCallback': "No function types in python",
+ 'virConnectDomainEventGenericCallback': "No function types in python",
'virEventAddHandleFunc': "No function types in python",
}
@@ -330,6 +331,8 @@ skip_function = (
'virNodeGetSecurityModel', # Needs investigation...
'virConnectDomainEventRegister', # overridden in virConnect.py
'virConnectDomainEventDeregister', # overridden in virConnect.py
+ 'virConnectDomainEventRegisterAny', # overridden in virConnect.py
+ 'virConnectDomainEventDeregisterAny', # overridden in virConnect.py
'virSaveLastError', # We have our own python error wrapper
'virFreeError', # Only needed if we use virSaveLastError
'virStreamEventAddCallback',