Don't register events unless libvirt is new enough

Python callbacks for custom event loops changed signature, so only use
newer impls.
This commit is contained in:
Cole Robinson 2011-07-19 12:36:16 -04:00
parent 5f7d061e6f
commit 26c49f7d6e

View File

@ -19,6 +19,7 @@
# #
import threading import threading
import logging
import gobject import gobject
@ -234,6 +235,11 @@ def glib_event_timeout_remove(timer):
state.lock.release() state.lock.release()
def register_event_impl(): def register_event_impl():
if (hasattr(libvirt, "eventInvokeHandleCallback") and
not hasattr(libvirt, "_eventInvokeHandleCallback")):
logging.debug("Libvirt version is not new enough for our event loop "
"impl. Skipping registration.")
return
libvirt.virEventRegisterImpl(glib_event_handle_add, libvirt.virEventRegisterImpl(glib_event_handle_add,
glib_event_handle_update, glib_event_handle_update,
glib_event_handle_remove, glib_event_handle_remove,