Bug 845958 - libvirt domain event handler can not catch domain pmsuspend and get error when pmwakeup
libvirt domain event handler can not catch domain pmsuspend and get error whe...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.4
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Jiri Denemark
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-06 05:44 EDT by Huang Wenlong
Modified: 2013-10-20 17:45 EDT (History)
7 users (show)

See Also:
Fixed In Version: libvirt-0.10.2-0rc1.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-21 02:21:08 EST
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 Huang Wenlong 2012-08-06 05:44:18 EDT
Description of problem:
libvirt domain event handler can not catch domain pmsuspend and get error when pmwakeup

Version-Release number of selected component (if applicable):
libvirt-0.10.0-0rc0.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.298.el6_3.x86_64


How reproducible:
100%

Steps to Reproduce:
First need add <loader>/usr/share/seabios/bios-pm.bin</loader> in the domain xml then restart domain 

1.# python /usr/share/doc/libvirt-python-*/events-python/event-test.py
Using uri:qemu:///system


2.   in the domain run
#pm-suspend

3. in the host

# virsh list
 Id    Name                           State
----------------------------------------------------
 3     ga                             pmsuspended

4. move mouse will wakeup  domain or virsh pmwakeup domain

virsh # dompmwakeup ga
Domain ga successfully woken up


3.  event-test.py will get error  but wakeup success

Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 3425, in _dispatchDomainEventCallbacks
    cb(self,dom,event,detail,opaque)
  File "/usr/share/doc/libvirt-python-0.10.0/events-python/event-test.py", line 457, in myDomainEventCallback1
    detailToString(event, detail))
  File "/usr/share/doc/libvirt-python-0.10.0/events-python/event-test.py", line 452, in detailToString
    return eventStrings[event][detail]
IndexError: tuple index out of range
Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 3436, in _dispatchDomainEventLifecycleCallback
    cb(self, virDomain(self, _obj=dom), event, detail, opaque)
  File "/usr/share/doc/libvirt-python-0.10.0/events-python/event-test.py", line 462, in myDomainEventCallback2
    detailToString(event, detail))
  File "/usr/share/doc/libvirt-python-0.10.0/events-python/event-test.py", line 452, in detailToString
    return eventStrings[event][detail]
IndexError: tuple index out of range
myDomainEventRebootCallback: Domain ga(3)





Actual results:
can not catch suspend event and wake up pop up error  in  event handler

Expected results:
catch suspend event no error report when wakeup domain

Additional info:
no error in libvirtd.log
Comment 2 Jiri Denemark 2012-08-08 10:19:53 EDT
This is trivial, the event-test.py is just needs updating to cover all possible event details.
Comment 3 Jiri Denemark 2012-08-08 10:21:26 EDT
Patch sent upstream: https://www.redhat.com/archives/libvir-list/2012-August/msg00517.html
Comment 4 Jiri Denemark 2012-08-09 10:02:39 EDT
Fixed upstream by v0.10.0-rc0-63-g462c211:

commit 462c211232b85c52897819a4c91beb0c95d21bc7
Author: Jiri Denemark <jdenemar@redhat.com>
Date:   Wed Aug 8 16:17:31 2012 +0200

    examples: Update strings for event details
Comment 6 Huang Wenlong 2012-08-23 03:15:35 EDT
Hi, Jiri 

I test it with 
libvirt-0.10.0-0rc1.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.303.el6.x86_64


domain handler can catch the pmwakeup event , but it can not catch the pmsuspend event still in this version ,so I assign this bug.


1) check virsh list  after run pm-suspend  in the domain
# virsh list 
 Id    Name                           State
----------------------------------------------------
 7     f17                            pmsuspended


#python /usr/share/doc/libvirt-python-*/events-python/event-test.py
Using uri:qemu:///system

myDomainEventCallback1 EVENT: Domain f17(7) Started Wakeup
myDomainEventCallback2 EVENT: Domain f17(7) Started Wakeup
myDomainEventRebootCallback: Domain f17(7)
Comment 7 Jiri Denemark 2012-08-23 09:58:45 EDT
Ah, great, the pmsuspended state was added without an equivalent lifecycle event.
Comment 8 Jiri Denemark 2012-09-07 04:32:38 EDT
So there were more issue than what I have hoped for. They should all be fixed upstream by v0.10.1-57-gafab482, v0.10.1-58-gfc4115e, and v0.10.1-59-ge2a7f97:

commit afab4824ebe8b5a03dcdd3aa6b70359224219cd2
Author: Jiri Denemark <jdenemar@redhat.com>
Date:   Thu Sep 6 16:56:08 2012 +0200

    Fix PMSuspend and PMWakeup events
    
    The unused reason parameter of PM{Suspend,Wakeup} event callbacks was
    completely ignored in lot of places and those events were not actually
    working at all.

commit fc4115e8d693635d5569e01b432a9cde03341f0c
Author: Jiri Denemark <jdenemar@redhat.com>
Date:   Thu Sep 6 17:00:43 2012 +0200

    Add PMSUSPENDED life cycle event
    
    While PMSUSPENDED state was added a long time ago, we didn't have
    corresponding life cycle event.

commit e2a7f97b2b1cee9d0dd628ac03a30a33041a98bb
Author: Jiri Denemark <jdenemar@redhat.com>
Date:   Thu Sep 6 17:02:47 2012 +0200

    examples: Fix event detail printing in python test
    
    If there is only one detail string for a particular event, we need to pu
    comma after the string otherwise the string itself will be taken as a
    list and only its first character will be printed out. For example,
    
        myDomainEventCallback1 EVENT: Domain fedora17(12) Shutdown F
    
    instead of the desired
    
        myDomainEventCallback1 EVENT: Domain fedora17(12) Shutdown Finished
Comment 9 Huang Wenlong 2012-09-19 05:00:07 EDT
Verify this bug with : 
libvirt-0.10.2-0rc1.el6.x86_64


virsh # list
 Id    Name                           State
----------------------------------------------------
 3     q64                            running

virsh # dompmsuspend q64 mem
Domain q64 successfully suspended
virsh # list
 Id    Name                           State
----------------------------------------------------
 3     q64                            pmsuspended

virsh # dompmwakeup q64
Domain q64 successfully woken up
virsh # list
 Id    Name                           State
----------------------------------------------------
 3     q64                            running

# python /usr/share/doc/libvirt-python-0.10.2/events-python/event-test.py
Using uri:qemu:///system

myDomainEventPMSuspendCallback: Domain q64(3) system pmsuspend
myDomainEventCallback1 EVENT: Domain q64(3) PMSuspended Memory
myDomainEventCallback2 EVENT: Domain q64(3) PMSuspended Memory
myDomainEventPMWakeupCallback: Domain q64(3) system pmwakeup
myDomainEventCallback1 EVENT: Domain q64(3) Started Wakeup
myDomainEventCallback2 EVENT: Domain q64(3) Started Wakeup
Comment 10 Huang Wenlong 2012-09-19 05:11:33 EDT
Hi,Jiri 

I found libvirt event handler can not differentiate "shutdown guest" and "dompmsuspend disk" and  "start guest" and "pmwakeup guest" , their events is the same


myDomainEventCallback1 EVENT: Domain q64(3) Shutdown Finished
myDomainEventCallback2 EVENT: Domain q64(3) Shutdown Finished
myDomainEventCallback1 EVENT: Domain q64(3) Stopped Shutdown
myDomainEventCallback2 EVENT: Domain q64(3) Stopped Shutdown
myDomainEventCallback1 EVENT: Domain q64(4) Started Booted
myDomainEventCallback2 EVENT: Domain q64(4) Started Booted
myDomainEventGraphicsCallback: Domain q64(4) 0 none
myDomainEventGraphicsCallback: Domain q64(4) 1 none

Is there a bug to trace this issue ?
Comment 11 Jiri Denemark 2012-09-19 05:51:19 EDT
Yes, that's a separate issue tracked by bug 839661.
Comment 12 Huang Wenlong 2012-09-19 06:12:22 EDT
(In reply to comment #11)
> Yes, that's a separate issue tracked by bug 839661.

Thanks very much .
Comment 13 errata-xmlrpc 2013-02-21 02:21:08 EST
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.

http://rhn.redhat.com/errata/RHSA-2013-0276.html

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