RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1463188 - event-test.py gets traceback when guest shutdown
Summary: event-test.py gets traceback when guest shutdown
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt-python
Version: 7.4
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: lcheng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-20 11:06 UTC by Yanqiu Zhang
Modified: 2018-04-10 11:08 UTC (History)
9 users (show)

Fixed In Version: libvirt-python-3.7.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 11:07:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1384007 0 high CLOSED The lifecycle event for Guest OS Shutdown is not distinguishable from a qemu process that was quit with SIG_TERM 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1418927 0 unspecified CLOSED The lifecycle event for Guest OS Shutdown is not distinguishable from a qemu process that was quit with SIG_TERM 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHEA-2018:0707 0 None None None 2018-04-10 11:08:26 UTC

Internal Links: 1384007 1418927

Description Yanqiu Zhang 2017-06-20 11:06:00 UTC
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 14:33:48 UTC
Fixed upstream with v3.4.0-1-g36430e115df2:
commit 36430e115df2b3d70936c4196b61e9b7824d09a3
Author: Martin Kletzander <mkletzan>
Date:   2017-06-20 13:33:52 +0200

    Add details for shutdown event

Comment 4 lcheng 2017-10-23 07:14:37 UTC
I can reproduce this bug on libvirt-python-3.2.0-3.el7.x86_64 and verify on libvirt-python-3.8.0-1.el7.x86_64.

1. Shutdown a guest by 'virsh shutdown'.
On console 1, shutdown a guest.
# virsh shutdown virtlab_test
Domain virtlab_test is being shutdown

On console 2, run 'virsh event'.
# virsh event --loop --all
event 'agent-lifecycle' for domain virtlab_test: state: 'disconnected' reason: 'channel event'
event 'lifecycle' for domain virtlab_test: Shutdown Finished after guest request
event 'lifecycle' for domain virtlab_test: Stopped Shutdown

On console 3, run 'python event-test.py'.
# python /usr/share/doc/libvirt-python-3.8.0/examples/event-test.py
Using uri 'qemu:///system' and event loop 'poll'
myDomainEventAgentLifecycleCallback: Domain virtlab_test(1) disconnected channel event
myDomainEventCallback1 EVENT: Domain virtlab_test(1) Shutdown On guest request
myDomainEventCallback2 EVENT: Domain virtlab_test(1) Shutdown On guest request
myNodeDeviceEventLifecycleCallback: Node device  net_vnet0_fe_52_00_45_c3_8a Deleted 0
myDomainEventCallback1 EVENT: Domain virtlab_test(1) Stopped Shutdown
myDomainEventCallback2 EVENT: Domain virtlab_test(1) Stopped Shutdown


2. Shutdown a guest by 'kill $PID'.
On console 1, shutdown a guest.
# kill 31883

On console 2, run 'virsh event'.
# virsh event --loop --all
event 'lifecycle' for domain virtlab_test: Shutdown Finished after host request
event 'lifecycle' for domain virtlab_test: Stopped Shutdown

On console 3, run 'python event-test.py'.
# python /usr/share/doc/libvirt-python-3.8.0/examples/event-test.py
Using uri 'qemu:///system' and event loop 'poll'
myDomainEventAgentLifecycleCallback: Domain virtlab_test(4) connected channel event
myDomainEventCallback1 EVENT: Domain virtlab_test(4) Shutdown On host request
myDomainEventCallback2 EVENT: Domain virtlab_test(4) Shutdown On host request
myNodeDeviceEventLifecycleCallback: Node device  net_vnet0_fe_52_00_45_c3_8a Deleted 0
myDomainEventCallback1 EVENT: Domain virtlab_test(4) Stopped Shutdown
myDomainEventCallback2 EVENT: Domain virtlab_test(4) Stopped Shutdown


So move to VERIFIED.

Comment 7 errata-xmlrpc 2018-04-10 11:07:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0707


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