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

Philipp Hahn posted 22 patches 6 years, 2 months ago
[libvirt] [PATCH libvirt-python v2 15/22] event-test.py: Convert DISK 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 d8ba8c9..218103d 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -499,6 +499,7 @@ 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")
+DISK_EVENTS = Description("Change missing on start", "Drop missing on start")
 
 
 def myDomainEventCallback(conn, dom, event, detail, opaque):
@@ -543,7 +544,9 @@ def myDomainEventBlockJobCallback(conn, dom, disk, type, status, opaque):
 
 def myDomainEventDiskChangeCallback(conn, dom, oldSrcPath, newSrcPath, devAlias, reason, opaque):
     print("myDomainEventDiskChangeCallback: Domain %s(%s) disk change oldSrcPath: %s newSrcPath: %s devAlias: %s reason: %s" % (
-            dom.name(), dom.ID(), oldSrcPath, newSrcPath, devAlias, reason))
+        dom.name(), dom.ID(), oldSrcPath, newSrcPath, devAlias, DISK_EVENTS[reason]))
+
+
 def myDomainEventTrayChangeCallback(conn, dom, devAlias, reason, opaque):
     print("myDomainEventTrayChangeCallback: Domain %s(%s) tray change devAlias: %s reason: %s" % (
             dom.name(), dom.ID(), devAlias, reason))
-- 
2.11.0

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