to use new Description class Signed-off-by: Philipp Hahn <hahn@xxxxxxxxxxxxx> --- examples/event-test.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index 2436827..499f434 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -620,20 +620,20 @@ def myNetworkEventLifecycleCallback(conn, net, event, detail, opaque): ########################################################################## # Storage pool events ########################################################################## -def storageEventToString(event): - storageEventStrings = ( "Defined", - "Undefined", - "Started", - "Stopped", - "Created", - "Deleted", - ) - return storageEventStrings[event] +STORAGE_EVENTS = Description( + ("Defined", ()), + ("Undefined", ()), + ("Started", ()), + ("Stopped", ()), + ("Created", ()), + ("Deleted", ()), +) + def myStoragePoolEventLifecycleCallback(conn, pool, event, detail, opaque): - print("myStoragePoolEventLifecycleCallback: Storage pool %s %s %d" % (pool.name(), - storageEventToString(event), - detail)) + print("myStoragePoolEventLifecycleCallback: Storage pool %s %s %s" % ( + pool.name(), STORAGE_EVENTS[event], STORAGE_EVENTS[event][detail])) + def myStoragePoolEventRefreshCallback(conn, pool, opaque): print("myStoragePoolEventRefreshCallback: Storage pool %s" % pool.name()) -- 2.11.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list