[libvirt] [PATCH libvirt-python] event-test.py: Fix ERROR event

Philipp Hahn hahn at univention.de
Thu Nov 1 09:55:36 UTC 2018


ERROR_EVENTS translates the numeric 'action' argument to a description,
not the 'reason' argument which already contains a descriptive string
like 'enospc'.

> Traceback (most recent call last):
>   File "/usr/lib/python2.7/dist-packages/libvirt.py", line 4661, in _dispatchDomainEventIOErrorReasonCallback
>     reason, opaque)
>   File "libvirt-python/examples/event-test.py", line 536, in myDomainEventIOErrorReasonCallback
>     dom.name(), dom.ID(), srcpath, devalias, action, ERROR_EVENTS[reason]))
>   File "libvirt-python/examples/event-test.py", line 474, in __getitem__
>     data = self.args[item]
> TypeError: tuple indices must be integers, not str

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

diff --git a/examples/event-test.py b/examples/event-test.py
index eeb2777..dabf4b0 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -531,8 +531,8 @@ def myDomainEventIOErrorCallback(conn, dom, srcpath, devalias, action, opaque):
 
 
 def myDomainEventIOErrorReasonCallback(conn, dom, srcpath, devalias, action, reason, opaque):
-    print("myDomainEventIOErrorReasonCallback: Domain %s(%s) %s %s %d %s" % (
-        dom.name(), dom.ID(), srcpath, devalias, action, ERROR_EVENTS[reason]))
+    print("myDomainEventIOErrorReasonCallback: Domain %s(%s) %s %s %s %s" % (
+        dom.name(), dom.ID(), srcpath, devalias, ERROR_EVENTS[action], reason))
 
 
 def myDomainEventGraphicsCallback(conn, dom, phase, localAddr, remoteAddr, authScheme, subject, opaque):
-- 
2.11.0




More information about the libvir-list mailing list