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

Philipp Hahn hahn at univention.de
Thu Sep 20 06:10:43 UTC 2018


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 at 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




More information about the libvir-list mailing list