diff options
-rw-r--r-- | libvirt-override-virConnect.py | 102 | ||||
-rw-r--r-- | libvirt-override-virStream.py | 2 | ||||
-rw-r--r-- | libvirt-override.c | 24 | ||||
-rw-r--r-- | libvirt-override.py | 4 |
4 files changed, 59 insertions, 73 deletions
diff --git a/libvirt-override-virConnect.py b/libvirt-override-virConnect.py index 362be75..5be9659 100644 --- a/libvirt-override-virConnect.py +++ b/libvirt-override-virConnect.py @@ -33,7 +33,7 @@ ret = libvirtmod.virConnectDomainEventRegister(self._o, self) if ret == -1: raise libvirtError ('virConnectDomainEventRegister() failed', conn=self) - def dispatchDomainEventCallbacks(self, dom, event, detail): + def _dispatchDomainEventCallbacks(self, dom, event, detail): """Dispatches events to python user domain event callbacks """ try: @@ -43,7 +43,7 @@ except AttributeError: pass - def dispatchDomainEventLifecycleCallback(self, dom, event, detail, cbData): + def _dispatchDomainEventLifecycleCallback(self, dom, event, detail, cbData): """Dispatches events to python user domain lifecycle event callbacks """ cb = cbData["cb"] @@ -52,89 +52,75 @@ cb(self, virDomain(self, _obj=dom), event, detail, opaque) return 0 - def dispatchDomainEventGenericCallback(self, dom, cbData): + def _dispatchDomainEventGenericCallback(self, dom, cbData): """Dispatches events to python user domain generic event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), opaque) + return 0 - def dispatchDomainEventRTCChangeCallback(self, dom, offset, cbData): + def _dispatchDomainEventRTCChangeCallback(self, dom, offset, cbData): """Dispatches events to python user domain RTC change event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), offset ,opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), offset ,opaque) + return 0 - def dispatchDomainEventWatchdogCallback(self, dom, action, cbData): + def _dispatchDomainEventWatchdogCallback(self, dom, action, cbData): """Dispatches events to python user domain watchdog event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), action, opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), action, opaque) + return 0 - def dispatchDomainEventIOErrorCallback(self, dom, srcPath, devAlias, action, cbData): + def _dispatchDomainEventIOErrorCallback(self, dom, srcPath, devAlias, + action, cbData): """Dispatches events to python user domain IO error event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action, opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action, opaque) + return 0 - def dispatchDomainEventIOErrorReasonCallback(self, dom, srcPath, devAlias, action, reason, cbData): + def _dispatchDomainEventIOErrorReasonCallback(self, dom, srcPath, + devAlias, action, reason, + cbData): """Dispatches events to python user domain IO error event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action, reason, opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action, + reason, opaque) + return 0 - def dispatchDomainEventGraphicsCallback(self, dom, phase, localAddr, remoteAddr, authScheme, subject, cbData): + def _dispatchDomainEventGraphicsCallback(self, dom, phase, localAddr, + remoteAddr, authScheme, subject, + cbData): """Dispatches events to python user domain graphics event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), phase, localAddr, remoteAddr, authScheme, subject, opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), phase, localAddr, remoteAddr, + authScheme, subject, opaque) + return 0 - def dispatchDomainEventBlockPullCallback(self, dom, path, status, cbData): + def _dispatchDomainEventBlockPullCallback(self, dom, path, status, cbData): """Dispatches events to python user domain blockPull event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), path, status, opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), path, status, opaque) + return 0 def domainEventDeregisterAny(self, callbackID): """Removes a Domain Event Callback. De-registering for a diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py index 82e1648..92e6fb1 100644 --- a/libvirt-override-virStream.py +++ b/libvirt-override-virStream.py @@ -9,7 +9,7 @@ libvirtmod.virStreamFree(self._o) self._o = None - def dispatchStreamEventCallback(self, events, cbData): + def _dispatchStreamEventCallback(self, events, cbData): """ Dispatches events to python user's stream event callbacks """ diff --git a/libvirt-override.c b/libvirt-override.c index 58d594a..e7426a5 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -2609,7 +2609,7 @@ libvirt_virConnectDomainEventCallback(virConnectPtr conn ATTRIBUTE_UNUSED, /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn_inst, - (char*)"dispatchDomainEventCallbacks", + (char*)"_dispatchDomainEventCallbacks", (char*)"Oii", pyobj_dom_inst, event, @@ -2735,7 +2735,7 @@ libvirt_virEventAddHandleFunc (int fd, LIBVIRT_ENSURE_THREAD_STATE; /* Lookup the python callback */ - python_cb = libvirt_lookupPythonFunc("eventInvokeHandleCallback"); + python_cb = libvirt_lookupPythonFunc("_eventInvokeHandleCallback"); if (!python_cb) { goto cleanup; } @@ -2862,7 +2862,7 @@ libvirt_virEventAddTimeoutFunc(int timeout, LIBVIRT_ENSURE_THREAD_STATE; /* Lookup the python callback */ - python_cb = libvirt_lookupPythonFunc("eventInvokeTimeoutCallback"); + python_cb = libvirt_lookupPythonFunc("_eventInvokeTimeoutCallback"); if (!python_cb) { goto cleanup; } @@ -3252,7 +3252,7 @@ libvirt_virConnectDomainEventLifecycleCallback(virConnectPtr conn ATTRIBUTE_UNUS /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, - (char*)"dispatchDomainEventLifecycleCallback", + (char*)"_dispatchDomainEventLifecycleCallback", (char*)"OiiO", pyobj_dom, event, detail, @@ -3298,7 +3298,7 @@ libvirt_virConnectDomainEventGenericCallback(virConnectPtr conn ATTRIBUTE_UNUSED /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, - (char*)"dispatchDomainEventGenericCallback", + (char*)"_dispatchDomainEventGenericCallback", (char*)"OO", pyobj_dom, pyobj_cbData); @@ -3343,7 +3343,7 @@ libvirt_virConnectDomainEventRTCChangeCallback(virConnectPtr conn ATTRIBUTE_UNUS /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, - (char*)"dispatchDomainEventRTCChangeCallback", + (char*)"_dispatchDomainEventRTCChangeCallback", (char*)"OLO", pyobj_dom, (PY_LONG_LONG)utcoffset, @@ -3390,7 +3390,7 @@ libvirt_virConnectDomainEventWatchdogCallback(virConnectPtr conn ATTRIBUTE_UNUSE /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, - (char*)"dispatchDomainEventWatchdogCallback", + (char*)"_dispatchDomainEventWatchdogCallback", (char*)"OiO", pyobj_dom, action, @@ -3439,7 +3439,7 @@ libvirt_virConnectDomainEventIOErrorCallback(virConnectPtr conn ATTRIBUTE_UNUSED /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, - (char*)"dispatchDomainEventIOErrorCallback", + (char*)"_dispatchDomainEventIOErrorCallback", (char*)"OssiO", pyobj_dom, srcPath, devAlias, action, @@ -3489,7 +3489,7 @@ libvirt_virConnectDomainEventIOErrorReasonCallback(virConnectPtr conn ATTRIBUTE_ /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, - (char*)"dispatchDomainEventIOErrorReasonCallback", + (char*)"_dispatchDomainEventIOErrorReasonCallback", (char*)"OssisO", pyobj_dom, srcPath, devAlias, action, reason, @@ -3575,7 +3575,7 @@ libvirt_virConnectDomainEventGraphicsCallback(virConnectPtr conn ATTRIBUTE_UNUSE /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, - (char*)"dispatchDomainEventGraphicsCallback", + (char*)"_dispatchDomainEventGraphicsCallback", (char*)"OiOOsOO", pyobj_dom, phase, pyobj_local, pyobj_remote, @@ -3624,7 +3624,7 @@ libvirt_virConnectDomainEventBlockPullCallback(virConnectPtr conn ATTRIBUTE_UNUS /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, - (char*)"dispatchDomainEventBlockPullCallback", + (char*)"_dispatchDomainEventBlockPullCallback", (char*)"OsiO", pyobj_dom, path, status, pyobj_cbData); @@ -3780,7 +3780,7 @@ libvirt_virStreamEventCallback(virStreamPtr st ATTRIBUTE_UNUSED, /* Call the pure python dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_stream, - (char *)"dispatchStreamEventCallback", + (char *)"_dispatchStreamEventCallback", (char *)"iO", events, pyobj_cbData); diff --git a/libvirt-override.py b/libvirt-override.py index 8df9dc1..98241d6 100644 --- a/libvirt-override.py +++ b/libvirt-override.py @@ -117,7 +117,7 @@ def getVersion (name = None): # # Invoke an EventHandle callback # -def eventInvokeHandleCallback(watch, fd, event, opaque, opaquecompat=None): +def _eventInvokeHandleCallback(watch, fd, event, opaque, opaquecompat=None): """ Invoke the Event Impl Handle Callback in C """ @@ -137,7 +137,7 @@ def eventInvokeHandleCallback(watch, fd, event, opaque, opaquecompat=None): # # Invoke an EventTimeout callback # -def eventInvokeTimeoutCallback(timer, opaque, opaquecompat=None): +def _eventInvokeTimeoutCallback(timer, opaque, opaquecompat=None): """ Invoke the Event Impl Timeout Callback in C """ |