[libvirt] [PATCH libvirt-python v2 16/22] event-test.py: Convert TRAY events

Philipp Hahn posted 22 patches 6 years, 2 months ago
[libvirt] [PATCH libvirt-python v2 16/22] event-test.py: Convert TRAY events
Posted by Philipp Hahn 6 years, 2 months ago
to use new Description class

Signed-off-by: Philipp Hahn <hahn@univention.de>
---
 examples/event-test.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/examples/event-test.py b/examples/event-test.py
index 218103d..5426ecd 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -500,6 +500,7 @@ AGENT_STATES = Description("unknown", "connected", "disconnected")
 AGENT_REASONS = Description("unknown", "domain started", "channel event")
 GRAPHICS_PHASES = Description("Connect", "Initialize", "Disconnect")
 DISK_EVENTS = Description("Change missing on start", "Drop missing on start")
+TRAY_EVENTS = Description("Opened", "Closed")
 
 
 def myDomainEventCallback(conn, dom, event, detail, opaque):
@@ -549,7 +550,9 @@ def myDomainEventDiskChangeCallback(conn, dom, oldSrcPath, newSrcPath, devAlias,
 
 def myDomainEventTrayChangeCallback(conn, dom, devAlias, reason, opaque):
     print("myDomainEventTrayChangeCallback: Domain %s(%s) tray change devAlias: %s reason: %s" % (
-            dom.name(), dom.ID(), devAlias, reason))
+        dom.name(), dom.ID(), devAlias, TRAY_EVENTS[reason]))
+
+
 def myDomainEventPMWakeupCallback(conn, dom, reason, opaque):
     print("myDomainEventPMWakeupCallback: Domain %s(%s) system pmwakeup" % (
             dom.name(), dom.ID()))
-- 
2.11.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list