Bug 1274145 - python event-test.py chokes on snapshot revert events
python event-test.py chokes on snapshot revert events
Status: NEW
Product: Virtualization Tools
Classification: Community
Component: libvirt-python (Show other bugs)
unspecified
x86_64 Linux
low Severity low
: ---
: ---
Assigned To: Libvirt Maintainers
LibvirtFirstBug
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-22 01:41 EDT by yafu
Modified: 2016-04-21 16:37 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
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 yafu 2015-10-22 01:41:35 EDT
Description of problem:
it reports error info while executing 'virsh snapshot-revert' with the libvirt-python script and 'virsh event' reports domain state with unclear reason.

Version-Release number of selected component (if applicable):
  kernel-3.10.0-324.x86_64.rpm
  qemu-kvm-rhev-2.3.0-29.el7.x86_64
  libvirt-daemon-1.2.17-13.el7.x86_64
  

How reproducible:
100%

Steps to Reproduce:
1.Create a snapshot:
  #virsh snapshot-create-as vm s1
2.Open another two terminal,in terminal 1 running the following command
  #python /usr/share/doc/libvirt-python-1.1.1/events-python/event-test.py
3.In terminal 2 running the following command:
  #virsh event --all --loop
4.Revert snapshot:
  #virsh snapshot-revert vm s1
5.Check the guest's relate info in host
 <1>In terminal 1 ,it  reports the following error.
   Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4686, in _dispatchDomainEventCallbacks
    cb(self, virDomain(self, _obj=dom), event, detail, opaque)
  File "/usr/share/doc/libvirt-python-1.2.17/examples/event-test.py", line 478, in myDomainEventCallback1
    domDetailToString(event, detail)))
  File "/usr/share/doc/libvirt-python-1.2.17/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 4697, in _dispatchDomainEventLifecycleCallback
    cb(self, virDomain(self, _obj=dom), event, detail, opaque)
  File "/usr/share/doc/libvirt-python-1.2.17/examples/event-test.py", line 483, in myDomainEventCallback2
    domDetailToString(event, detail)))
  File "/usr/share/doc/libvirt-python-1.2.17/examples/event-test.py", line 457, in domDetailToString
    return domEventStrings[event][detail]
 IndexError: tuple index out of range

  <2> In terminal 2, it reports "Resumed unknown":
   event 'lifecycle' for domain rhel7.1: Suspended Paused
   event 'lifecycle' for domain rhel7.1: Resumed Unpaused
   event 'lifecycle' for domain rhel7.1: *****Resumed unknown******

  <3> Can see the guest running status with the virsh domstate:
  #virsh  domstate vm --reason
     running (snapshot)

Actual results:
It reports error info while executing 'virsh snapshot-revert' with the libvirt-python script and 'virsh event' reports domain event with unclear reason.


Expected results:
shouldn't report the error in the libvirt-python script,and 'virsh event' should report the domain event with clear reason.
Comment 2 Pavel Hrdina 2016-02-18 15:51:53 EST
This is a minor issue in the example script, moving to upstream.
Comment 3 Cole Robinson 2016-04-21 16:37:13 EDT
Tagging as LibvirtFirstBug, this will be something for the GSOC pile.

Easy to reproduce: sudo ./examples/event-test.py , then fire up virt-manager, start a VM, create a snapshot, then revert to it. Not only should event-test be extended to handle whatever event is firing that it doesn't know about, we should find a way to have it not choke on such issues in the future. So some solution that isn't blindly trying to access a list index that might not exist

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