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 1578337 - event-test.py gets traceback when pool-build or pool-delete
Summary: event-test.py gets traceback when pool-build or pool-delete
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt-python
Version: 7.5
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: lcheng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-15 10:26 UTC by Yanqiu Zhang
Modified: 2018-10-30 11:10 UTC (History)
9 users (show)

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


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1475227 0 unspecified CLOSED 'pool-build' event can not be listened by 'pool-event' 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHEA-2018:3204 0 None None None 2018-10-30 11:10:41 UTC

Internal Links: 1475227

Description Yanqiu Zhang 2018-05-15 10:26:55 UTC
Description of problem:
libvirt(3.8.0-1) added new events for *PoolBuild() and *PoolDelete(), but "event-test.py" can not adapt to this now and gives traceback.

Version-Release number of selected component (if applicable):
libvirt-python-3.9.0-1.el7.x86_64
libvirt-3.9.0-14.el7_5.5.x86_64
qemu-kvm-rhev-2.10.0-21.el7_5.2.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare a storage pool:
# mkdir /tmp/test
# virsh pool-define test-pool.xml 
# cat test-pool.xml 
<pool type='dir'>
  <name>test-pool</name>
  <capacity unit='bytes'>160982630400</capacity>
  <allocation unit='bytes'>63092301824</allocation>
  <available unit='bytes'>97890328576</available>
  <source>
  </source>
  <target>
    <path>/tmp/test</path>
    <permissions>
      <mode>0711</mode>
      <owner>0</owner>
      <group>0</group>
      <label>system_u:object_r:virt_image_t:s0</label>
    </permissions>
  </target>
</pool>

2.Try to get pool-build event by event-test.py:
[terminal 1]# virsh pool-build test-pool
Pool test-pool built

[terminal 2]# python `locate event-test.py` --loop --all
Using uri 'qemu:///system' and event loop '--all'
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 5025, in _dispatchStoragePoolEventLifecycleCallback
    cb(self, virStoragePool(self, _obj=pool), event, detail, opaque)
  File "/usr/share/doc/libvirt-python-3.9.0/examples/event-test.py", line 613, in myStoragePoolEventLifecycleCallback
    storageEventToString(event),
  File "/usr/share/doc/libvirt-python-3.9.0/examples/event-test.py", line 609, in storageEventToString
    return storageEventStrings[event]
IndexError: tuple index out of range

3.Try to get pool-delete event by event-test.py:
[terminal 1]# virsh pool-delete test-pool
Pool test-pool deleted

[terminal 2]# python `locate event-test.py` --loop --all
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 5025, in _dispatchStoragePoolEventLifecycleCallback
    cb(self, virStoragePool(self, _obj=pool), event, detail, opaque)
  File "/usr/share/doc/libvirt-python-3.9.0/examples/event-test.py", line 613, in myStoragePoolEventLifecycleCallback
    storageEventToString(event),
  File "/usr/share/doc/libvirt-python-3.9.0/examples/event-test.py", line 609, in storageEventToString
    return storageEventStrings[event]
IndexError: tuple index out of range


Actual results:
As in step2&3, event-test.py gets traceback when pool-build or pool-delete

Expected results:
    myStoragePoolEventCallback EVENT: Storage pool test Created 0
    myStoragePoolEventCallback EVENT: Storage pool test Deleted 0

Additional info:

Comment 1 Michal Privoznik 2018-05-22 11:49:30 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2018-May/msg01591.html

Comment 2 Michal Privoznik 2018-05-22 12:24:23 UTC
To POST:

commit bae22e3eb7c33ec65bb77e5efeeca925ee787be9
Author:     Michal Privoznik <mprivozn>
AuthorDate: Tue May 22 13:47:05 2018 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Tue May 22 14:22:46 2018 +0200

    event-test.py: Sync list of storage lifecycle events
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1578337
    
    Since libvirt 3.8.0 we have 6 events: defined, undefined,
    started, stopped, created, deleted. However, the last two were
    missing in a string list that translates libvirt events (int)
    into human readable strings.
    
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Pavel Hrdina <phrdina>

v4.3.0-7-gbae22e3

Comment 4 lcheng 2018-06-26 03:59:42 UTC
Verify on libvirt-python-4.4.0-1.el7.x86_64. Don't find error. So move to VERIFIED.

# mkdir /tmp/test
# vim test-pool.xml

On terminal 1, execute virsh pool command.
# virsh pool-define test-pool.xml
Pool test-pool defined from test-pool.xml

# virsh pool-build test-pool
Pool test-pool built

# virsh pool-start test-pool
Pool test-pool started

# virsh pool-refresh test-pool
Pool test-pool refreshed

# virsh pool-destroy test-pool
Pool test-pool destroyed

# virsh pool-undefine test-pool
Pool test-pool has been undefined

# virsh pool-define test-pool.xml
Pool test-pool defined from test-pool.xml

# virsh pool-build test-pool
Pool test-pool built

# virsh pool-delete test-pool
Pool test-pool deleted

On terminal 2, get storage lifecycle events.
# python /usr/share/doc/libvirt-python-4.4.0/examples/event-test.py
Using uri 'qemu:///system' and event loop 'poll'
myStoragePoolEventLifecycleCallback: Storage pool test-pool Defined 0
myStoragePoolEventLifecycleCallback: Storage pool test-pool Created 0
myStoragePoolEventLifecycleCallback: Storage pool test-pool Started 0
myStoragePoolEventRefreshCallback: Storage pool test-pool
myStoragePoolEventLifecycleCallback: Storage pool test-pool Stopped 0
myStoragePoolEventLifecycleCallback: Storage pool test-pool Undefined 0
myStoragePoolEventLifecycleCallback: Storage pool test-pool Defined 0
myStoragePoolEventLifecycleCallback: Storage pool test-pool Created 0
myStoragePoolEventLifecycleCallback: Storage pool test-pool Deleted 0

Comment 6 errata-xmlrpc 2018-10-30 11:10:24 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:3204


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