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

Philipp Hahn posted 22 patches 6 years, 2 months ago
[libvirt] [PATCH libvirt-python v2 11/22] event-test.py: Convert WATCHDOG 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 46a8db8..004a263 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -494,6 +494,7 @@ DOM_EVENTS = Description(
 )
 BLOCK_JOB_TYPES = Description("unknown", "Pull", "Copy", "Commit", "ActiveCommit")
 BLOCK_JOB_STATUS = Description("Completed", "Failed", "Canceled", "Ready")
+WATCHDOG_ACTIONS = Description("none", "Pause", "Reset", "Poweroff", "Shutdown", "Debug", "Inject NMI")
 
 def agentLifecycleStateToString(state):
     agentStates = ( "unknown", "connected", "disconnected", )
@@ -515,8 +516,11 @@ def myDomainEventRebootCallback(conn, dom, opaque):
 def myDomainEventRTCChangeCallback(conn, dom, utcoffset, opaque):
     print("myDomainEventRTCChangeCallback: Domain %s(%s) %d" % (dom.name(), dom.ID(), utcoffset))
 
+
 def myDomainEventWatchdogCallback(conn, dom, action, opaque):
-    print("myDomainEventWatchdogCallback: Domain %s(%s) %d" % (dom.name(), dom.ID(), action))
+    print("myDomainEventWatchdogCallback: Domain %s(%s) %s" % (
+        dom.name(), dom.ID(), WATCHDOG_ACTIONS[action]))
+
 
 def myDomainEventIOErrorCallback(conn, dom, srcpath, devalias, action, opaque):
     print("myDomainEventIOErrorCallback: Domain %s(%s) %s %s %d" % (dom.name(), dom.ID(), srcpath, devalias, action))
-- 
2.11.0

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