[libvirt] [PATCH libvirt-python 1/2] event-test.py: Sync list of domain lifecycle events

Philipp Hahn posted 2 patches 6 years, 2 months ago
There is a newer version of this series
[libvirt] [PATCH libvirt-python 1/2] event-test.py: Sync list of domain lifecycle events
Posted by Philipp Hahn 6 years, 2 months ago
Add new events to prevent crash:
> raceback (most recent call last):
>   File "/usr/lib/python2.7/dist-packages/libvirt.py", line 4601, in _dispatchDomainEventCallbacks
>     cb(self, virDomain(self, _obj=dom), event, detail, opaque)
>   File "libvirt-python/examples/event-test.py", line 505, in myDomainEventCallback1
>     domDetailToString(event, detail)))
>   File "libvirt-python/examples/event-test.py", line 484, in domDetailToString
>     return domEventStrings[event][detail]
> IndexError: tuple index out of range

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

diff --git a/examples/event-test.py b/examples/event-test.py
index 281e661..04310e1 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -471,11 +471,11 @@ def domEventToString(event):
 
 def domDetailToString(event, detail):
     domEventStrings = (
-        ( "Added", "Updated" ),
-        ( "Removed", ),
+        ( "Added", "Updated", "Renamed", "Snapshot" ),
+        ( "Removed", "Renamed", ),
         ( "Booted", "Migrated", "Restored", "Snapshot", "Wakeup" ),
-        ( "Paused", "Migrated", "IOError", "Watchdog", "Restored", "Snapshot", "API error" ),
-        ( "Unpaused", "Migrated", "Snapshot" ),
+        ( "Paused", "Migrated", "IOError", "Watchdog", "Restored", "Snapshot", "API error", "Postcopy", "Postcopy failed" ),
+        ( "Unpaused", "Migrated", "Snapshot", "Postcopy" ),
         ( "Shutdown", "Destroyed", "Crashed", "Migrated", "Saved", "Failed", "Snapshot"),
         ( "Finished", "On guest request", "On host request"),
         ( "Memory", "Disk" ),
-- 
2.11.0

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