--- examples/event-test.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/examples/event-test.py b/examples/event-test.py index 1bcea07..e06ebc6 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -584,6 +584,20 @@ def myStoragePoolEventRefreshCallback(conn, pool, opaque): print("myStoragePoolEventRefreshCallback: Storage pool %s" % pool.name()) ########################################################################## +# Node decice events +########################################################################## +def nodeDeviceEventToString(event): + nodeDeviceEventStrings = ( "Created", + "Deleted", + ) + return nodeDeviceEventStrings[event] + +def myNodeDeviceEventLifecycleCallback(conn, dev, event, detail, opaque): + print("myNodeDeviceEventLifecycleCallback: Node device %s %s %d" % (dev.name(), + nodeDeviceEventToString(event), + detail)) + +########################################################################## # Set up and run the program ########################################################################## @@ -678,6 +692,8 @@ def main(): vc.storagePoolEventRegisterAny(None, libvirt.VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, myStoragePoolEventLifecycleCallback, None) vc.storagePoolEventRegisterAny(None, libvirt.VIR_STORAGE_POOL_EVENT_ID_REFRESH, myStoragePoolEventRefreshCallback, None) + vc.nodeDeviceEventRegisterAny(None, libvirt.VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE, myNodeDeviceEventLifecycleCallback, None) + vc.setKeepAlive(5, 3) # The rest of your app would go here normally, but for sake -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list