1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-07-25 04:58:57 +03:00

event-test.py: Sync list of domain lifecycle events

Add new events to prevent crash:
> Traceback (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>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Philipp Hahn
2018-09-20 08:10:43 +02:00
committed by Michal Privoznik
parent fc4000152e
commit d5342a9803

View File

@ -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" ),