Libvirt 1.2.6 is introducing a new block job event that passes disk information by target device rather than host file name. At the python level, we are just a passthrough, so we can reuse all the existing code and just wire up the new enum value. * libvirt-override-virConnect.py (_dispatchDomainEventBlockPullCallback): Rename... (_dispatchDomainEventBlockJobCallback): ...to this, and make generic to both events. * libvirt-override.c (libvirt_virConnectDomainEventBlockJobCallback): Match naming. (libvirt_virConnectDomainEventRegisterAny): Allow new registration. Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> --- libvirt-override-virConnect.py | 6 +++--- libvirt-override.c | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libvirt-override-virConnect.py b/libvirt-override-virConnect.py index c228eb2..31d71a3 100644 --- a/libvirt-override-virConnect.py +++ b/libvirt-override-virConnect.py @@ -113,14 +113,14 @@ authScheme, subject, opaque) return 0 - def _dispatchDomainEventBlockPullCallback(self, dom, path, type, status, cbData): - """Dispatches events to python user domain blockJob event callbacks + def _dispatchDomainEventBlockJobCallback(self, dom, disk, type, status, cbData): + """Dispatches events to python user domain blockJob/blockJob2 event callbacks """ try: cb = cbData["cb"] opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), path, type, status, opaque) + cb(self, virDomain(self, _obj=dom), disk, type, status, opaque) return 0 except AttributeError: pass diff --git a/libvirt-override.c b/libvirt-override.c index 8fd856b..eb1d5e2 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -6085,7 +6085,7 @@ libvirt_virConnectDomainEventGraphicsCallback(virConnectPtr conn ATTRIBUTE_UNUSE static int libvirt_virConnectDomainEventBlockJobCallback(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainPtr dom, - const char *path, + const char *disk, int type, int status, void *opaque) @@ -6114,9 +6114,9 @@ libvirt_virConnectDomainEventBlockJobCallback(virConnectPtr conn ATTRIBUTE_UNUSE /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, - (char*)"_dispatchDomainEventBlockPullCallback", + (char*)"_dispatchDomainEventBlockJobCallback", (char*)"OsiiO", - pyobj_dom, path, type, status, pyobj_cbData); + pyobj_dom, disk, type, status, pyobj_cbData); Py_DECREF(pyobj_cbData); Py_DECREF(pyobj_dom); @@ -6506,6 +6506,7 @@ libvirt_virConnectDomainEventDeviceRemovedCallback(virConnectPtr conn ATTRIBUTE_ } #endif /* LIBVIR_CHECK_VERSION(1, 1, 1) */ + static PyObject * libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) @@ -6561,6 +6562,9 @@ libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self, cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventGenericCallback); break; case VIR_DOMAIN_EVENT_ID_BLOCK_JOB: +#if LIBVIR_CHECK_VERSION(1, 2, 6) + case VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2: +#endif /* LIBVIR_CHECK_VERSION(1, 2, 6) */ cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventBlockJobCallback); break; case VIR_DOMAIN_EVENT_ID_DISK_CHANGE: -- 1.9.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list