summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPhilipp Hahn <hahn@univention.de>2018-09-21 15:35:14 +0200
committerMichal Privoznik <mprivozn@redhat.com>2018-09-24 09:06:00 +0200
commitc0235d01e78fb73d2be326abdd6cf734c13f122b (patch)
tree4bcbb43fbb43672d08ab26d4f15b12f95549681e /examples
parent808625fac70aca0ef5b431c3e026a3f82c6e418d (diff)
downloadlibvirt-python-c0235d01e78fb73d2be326abdd6cf734c13f122b.tar.gz
event-test.py: Convert DEVICE events
to use new Description class Signed-off-by: Philipp Hahn <hahn@univention.de>
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/event-test.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/event-test.py b/examples/event-test.py
index 499f434..0a1d06d 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -641,16 +641,16 @@ def myStoragePoolEventRefreshCallback(conn, pool, opaque):
##########################################################################
# Node device events
##########################################################################
-def nodeDeviceEventToString(event):
- nodeDeviceEventStrings = ( "Created",
- "Deleted",
- )
- return nodeDeviceEventStrings[event]
+DEVICE_EVENTS = Description(
+ ("Created", ()),
+ ("Deleted", ()),
+)
+
def myNodeDeviceEventLifecycleCallback(conn, dev, event, detail, opaque):
- print("myNodeDeviceEventLifecycleCallback: Node device %s %s %d" % (dev.name(),
- nodeDeviceEventToString(event),
- detail))
+ print("myNodeDeviceEventLifecycleCallback: Node device %s %s %s" % (
+ dev.name(), DEVICE_EVENTS[event], DEVICE_EVENTS[event][detail]))
+
def myNodeDeviceEventUpdateCallback(conn, dev, opaque):
print("myNodeDeviceEventUpdateCallback: Node device %s" % dev.name())