Bug 1463188 - event-test.py gets traceback when guest shutdown
event-test.py gets traceback when guest shutdown
Status: ON_QA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt-python (Show other bugs)
7.4
x86_64 Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: Martin Kletzander
lcheng
: Upstream
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-20 07:06 EDT by yanqzhan@redhat.com
Modified: 2017-09-25 08:01 EDT (History)
9 users (show)

See Also:
Fixed In Version: libvirt-python-3.7.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description yanqzhan@redhat.com 2017-06-20 07:06:00 EDT
Description of problem:
libvirt(3.2.0-7) and qemu-kvm-rhev(2.9.0-9) make a change to distinguish whether the request is from host or guest when shutdown a guest, but "event-test.py" can not adapt to this now and gives traceback.

Version-Release number of selected component (if applicable):
*libvirt-python-3.2.0-3.el7.x86_64*
qemu-kvm-rhev-2.9.0-12.el7.x86_64
libvirt-3.2.0-10.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Shutdown a guest by "virsh shutdown"
# virsh event --loop --all
event 'lifecycle' for domain V: Shutdown Finished after guest request
event 'lifecycle' for domain V: Stopped Shutdown
# python `locate event-test.py`
Using uri:qemu:///system
myDomainEventAgentLifecycleCallback: Domain V(2) disconnected channel event
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4645, in _dispatchDomainEventCallbacks
    cb(self, virDomain(self, _obj=dom), event, detail, opaque)
  File "/usr/share/doc/libvirt-python-3.2.0/examples/event-test.py", line 478, in myDomainEventCallback1
    domDetailToString(event, detail)))
  File "/usr/share/doc/libvirt-python-3.2.0/examples/event-test.py", line 457, in domDetailToString
    return domEventStrings[event][detail]
IndexError: tuple index out of range
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4656, in _dispatchDomainEventLifecycleCallback
    cb(self, virDomain(self, _obj=dom), event, detail, opaque)
  File "/usr/share/doc/libvirt-python-3.2.0/examples/event-test.py", line 483, in myDomainEventCallback2
    domDetailToString(event, detail)))
  File "/usr/share/doc/libvirt-python-3.2.0/examples/event-test.py", line 457, in domDetailToString
    return domEventStrings[event][detail]
IndexError: tuple index out of range
myDomainEventCallback1 EVENT: Domain V(2) Stopped Shutdown
myDomainEventCallback2 EVENT: Domain V(2) Stopped Shutdown

2.Shutdown a guest by "kill -15 $pidof_qemu"
# virsh event --loop --all
event 'lifecycle' for domain V: Shutdown Finished after host request
event 'lifecycle' for domain V: Stopped Shutdown
# python `locate event-test.py`
Using uri:qemu:///system
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4645, in _dispatchDomainEventCallbacks
    cb(self, virDomain(self, _obj=dom), event, detail, opaque)
  File "/usr/share/doc/libvirt-python-3.2.0/examples/event-test.py", line 478, in myDomainEventCallback1
    domDetailToString(event, detail)))
  File "/usr/share/doc/libvirt-python-3.2.0/examples/event-test.py", line 457, in domDetailToString
    return domEventStrings[event][detail]
IndexError: tuple index out of range
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4656, in _dispatchDomainEventLifecycleCallback
    cb(self, virDomain(self, _obj=dom), event, detail, opaque)
  File "/usr/share/doc/libvirt-python-3.2.0/examples/event-test.py", line 483, in myDomainEventCallback2
    domDetailToString(event, detail)))
  File "/usr/share/doc/libvirt-python-3.2.0/examples/event-test.py", line 457, in domDetailToString
    return domEventStrings[event][detail]
IndexError: tuple index out of range
myDomainEventCallback1 EVENT: Domain V(3) Stopped Shutdown
myDomainEventCallback2 EVENT: Domain V(3) Stopped Shutdown


Actual results:
when working with qemu-kvm-rhev(>=2.9.0-9), event-test.py gets traceback when guest shutdown

Expected results:
event-test.py should be able to report the guest shutdown event and its reason(from host or guest) without error, just as libvirt "virsh event" does.

Additional info:
Comment 2 Martin Kletzander 2017-06-20 10:33:48 EDT
Fixed upstream with v3.4.0-1-g36430e115df2:
commit 36430e115df2b3d70936c4196b61e9b7824d09a3
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   2017-06-20 13:33:52 +0200

    Add details for shutdown event

Note You need to log in before you can comment on or make changes to this bug.