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

2018-11-01 Thread Michal Privoznik
On 11/01/2018 10:55 AM, Philipp Hahn wrote:
> 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 
> ---
>  examples/event-test.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

ACKed and pushed.

Michal

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


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

2018-11-01 Thread Philipp Hahn
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 
---
 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

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