Bug 994317

Summary: There is something wrong with python bindings while the guest os happens kernel panic
Product: Red Hat Enterprise Linux 7 Reporter: zhenfeng wang <zhwang>
Component: libvirtAssignee: Giuseppe Scrivano <gscrivan>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, dallan, dyuan, mzhan, ydu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 994327 (view as bug list) Environment:
Last Closed: 2013-08-14 16:24:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 994327    

Description zhenfeng wang 2013-08-07 03:37:14 UTC
Description of problem:
it report error info while check the guest status with the libvirt-python script
 when the guest os happens kernel panic

Version-Release number of selected component (if applicable):
libvirt-1.1.1-2.el7.x86_64
kernel-3.10.0-4.el7.x86_64
qemu-kvm-1.5.2-2.el7.x86_64

How reproducible:
100%

Steps
1.Prepare a guest with the following xml
#virsh dumpxml rhel7
--
 <on_crash>coredump-destroy</on_crash>
--
2.In terminal 1 running the following command
#python /usr/share/doc/libvirt-python-1.1.1/events-python/event-test.py qemu:///system

3.Start the guest in  terminal 2, then, login the guest and run the following command in the guest while the guest start completely
#sync
# printf '%b' '\x01' | dd of=/dev/port seek=$((16#505)) bs=1 count=1

4.Check the guest's relate info in host
 <1>In terminal 1 ,i didn't see the crashd event in the domain event handler,it just report the following error.

# python /usr/share/doc/libvirt-python-1.1.1/events-python/event-test.py qemu:///system
Using uri:qemu:///system
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3854, in _dispatchDomainEventLifecycleCallback
    cb(self, virDomain(self, _obj=dom), event, detail, opaque)
  File "/usr/share/doc/libvirt-python-1.1.1/events-python/event-test.py", line 463, in myDomainEventCallback2
    eventToString(event),
  File "/usr/share/doc/libvirt-python-1.1.1/events-python/event-test.py", line 441, in eventToString
    return eventStrings[event]
IndexError: tuple index out of range
myDomainEventCallback2 EVENT: Domain rhel7raw(-1) Stopped Crashed

<2> Can see the guest crashed status with the virsh domstate
# virsh  domstate rhel7raw --reason
shut off (crashed)

Actual results:
it report error info while check the guest status with the libvirt-python script
 when the guest os happens kernel panic
Expected results:
shouldn't report the error ,and should report the guest's status correctly

Comment 2 Giuseppe Scrivano 2013-08-14 16:15:43 UTC
I am setting up the complete environment here to to test it since I am not able to trigger that notification with my current setup.

By looking at the code, it seems to be a missing value in the "eventStrings" enum for the event-test.py application.

So my bet is that the patch will not be anything more than this one-line:

diff --git a/examples/domain-events/events-python/event-test.py b/examples/domain-events/events-python/event-test.py
index b7c10d1..b916845 100644
--- a/examples/domain-events/events-python/event-test.py
+++ b/examples/domain-events/events-python/event-test.py
@@ -437,7 +437,8 @@ def eventToString(event):
                      "Resumed",
                      "Stopped",
                      "Shutdown",
-                     "PMSuspended" )
+                     "PMSuspended",
+                     "Crashed" )
     return eventStrings[event]

Comment 4 Dave Allan 2013-08-14 16:24:50 UTC
Ok, thanks, I'll close as WONTFIX.

Comment 5 Giuseppe Scrivano 2013-08-14 22:03:50 UTC
there is a patch upstream:

https://www.redhat.com/archives/libvir-list/2013-August/msg00638.html