diff options
author | Philipp Hahn <hahn@univention.de> | 2018-09-21 15:35:13 +0200 |
---|---|---|
committer | Michal Privoznik <mprivozn@redhat.com> | 2018-09-24 09:06:00 +0200 |
commit | 808625fac70aca0ef5b431c3e026a3f82c6e418d (patch) | |
tree | a2c9200cfe141f161054774a5e92f4b7250bd0cc /examples | |
parent | 616c7c3482850eb41b2ec14ca14a5c6b4ae1d761 (diff) | |
download | libvirt-python-808625fac70aca0ef5b431c3e026a3f82c6e418d.tar.gz |
event-test.py: Convert STORAGE events
to use new Description class
Signed-off-by: Philipp Hahn <hahn@univention.de>
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/event-test.py | 24 |
1 files 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()) |