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

Philipp Hahn hahn at univention.de
Fri Sep 21 13:35:09 UTC 2018


to use new Description class

Signed-off-by: Philipp Hahn <hahn at 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




More information about the libvir-list mailing list