The event test is too useful to make it always drag in libvirt_qemu. So I don't want this applied. However, it makes testing my event addition much easier. --- examples/event-test.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/examples/event-test.py b/examples/event-test.py index 101dbc0..ab56299 100644 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -10,6 +10,7 @@ import sys import getopt import os import libvirt +import libvirt_qemu import select import errno import time @@ -528,6 +529,16 @@ def myNetworkEventLifecycleCallback(conn, net, event, detail, opaque): netDetailToString(event, detail))) ########################################################################## +# qemu monitor events +########################################################################## +def myDomainQemuMonitorCallback(conn, dom, event, seconds, micros, details, opaque): + if details is None: + details = "" + print("myDomainQemuMonitorCallback: Domain %s(%s) %d.%06d %s %s" %(dom.name(), dom.ID(), + seconds, micros, + event, details)) + +########################################################################## # Set up and run the program ########################################################################## @@ -579,7 +590,7 @@ def main(): else: virEventLoopNativeStart() - vc = libvirt.openReadOnly(uri) + vc = libvirt.open(uri) # Close connection on exit (to test cleanup paths) old_exitfunc = getattr(sys, 'exitfunc', None) @@ -609,6 +620,8 @@ def main(): vc.networkEventRegisterAny(None, libvirt.VIR_NETWORK_EVENT_ID_LIFECYCLE, myNetworkEventLifecycleCallback, None) + libvirt_qemu.qemuMonitorEventRegister(vc, None, None, myDomainQemuMonitorCallback, None) + vc.setKeepAlive(5, 3) # The rest of your app would go here normally, but for sake -- 1.8.5.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list