summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPhilipp Hahn <hahn@univention.de>2018-09-21 15:35:13 +0200
committerMichal Privoznik <mprivozn@redhat.com>2018-09-24 09:06:00 +0200
commit808625fac70aca0ef5b431c3e026a3f82c6e418d (patch)
treea2c9200cfe141f161054774a5e92f4b7250bd0cc /examples
parent616c7c3482850eb41b2ec14ca14a5c6b4ae1d761 (diff)
downloadlibvirt-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-xexamples/event-test.py24
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())