From 7ad073e29d8fa4d4758c78e3437492b855f034c6 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 18 Oct 2011 16:15:42 +0200 Subject: startupPolicy: Emit event on disk source dropping If a disk source gets dropped because it is not accessible, mgmt application might want to be informed about this. Therefore we need to emit an event. The event presented in this patch is however a bit superset of what written above. The reason is simple: an intention to be easily expanded, e.g. on 'user ejected disk in guest' events. Therefore, callback gets source string and disk alias (which should be unique among a domain) and reason (an integer); --- libvirt-override-virConnect.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libvirt-override-virConnect.py') diff --git a/libvirt-override-virConnect.py b/libvirt-override-virConnect.py index 65b5342..b908b32 100644 --- a/libvirt-override-virConnect.py +++ b/libvirt-override-virConnect.py @@ -125,6 +125,15 @@ except AttributeError: pass + def _dispatchDomainEventDiskChangeCallback(self, dom, oldSrcPath, newSrcPath, devAlias, reason, cbData): + """Dispatches event to python user domain diskChange event callbacks + """ + cb = cbData["cb"] + opaque = cbData["opaque"] + + cb(self, virDomain(self, _obj=dom), oldSrcPath, newSrcPath, devAlias, reason, opaque) + return 0; + def domainEventDeregisterAny(self, callbackID): """Removes a Domain Event Callback. De-registering for a domain callback will disable delivery of this event type """ -- cgit