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

Philipp Hahn posted 22 patches 6 years, 2 months ago
[libvirt] [PATCH libvirt-python v2 14/22] event-test.py: Convert GRAPHICS 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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/examples/event-test.py b/examples/event-test.py
index b559ede..d8ba8c9 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -498,6 +498,7 @@ WATCHDOG_ACTIONS = Description("none", "Pause", "Reset", "Poweroff", "Shutdown",
 ERROR_EVENTS = Description("None", "Pause", "Report")
 AGENT_STATES = Description("unknown", "connected", "disconnected")
 AGENT_REASONS = Description("unknown", "domain started", "channel event")
+GRAPHICS_PHASES = Description("Connect", "Initialize", "Disconnect")
 
 
 def myDomainEventCallback(conn, dom, event, detail, opaque):
@@ -527,7 +528,10 @@ def myDomainEventIOErrorReasonCallback(conn, dom, srcpath, devalias, action, rea
 
 
 def myDomainEventGraphicsCallback(conn, dom, phase, localAddr, remoteAddr, authScheme, subject, opaque):
-    print("myDomainEventGraphicsCallback: Domain %s(%s) %d %s" % (dom.name(), dom.ID(), phase, authScheme))
+    print("myDomainEventGraphicsCallback: Domain %s(%s) %s %s" % (
+        dom.name(), dom.ID(), GRAPHICS_PHASES[phase], authScheme))
+
+
 def myDomainEventControlErrorCallback(conn, dom, opaque):
     print("myDomainEventControlErrorCallback: Domain %s(%s)" % (dom.name(), dom.ID()))
 
-- 
2.11.0

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