Bug 1475227

Summary: 'pool-build' event can not be listened by 'pool-event'
Product: Red Hat Enterprise Linux 7 Reporter: jiyan <jiyan>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: jiyan <jiyan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: dyuan, jiyan, lmen, mprivozn, rbalakri, xuzhang, yisun
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-3.8.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 10:52:40 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:

Description jiyan 2017-07-26 08:43:42 UTC
Description of problem:
'pool-build' event can not be listened by 'pool-event'

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.9.0-16.el7_4.3.x86_64
kernel-3.10.0-693.el7.x86_64
libvirt-3.2.0-14.el7_4.2.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare a xml file to define a pool
# cat pool.xml 
<pool type='dir'>
  <name>test</name>
  <capacity unit='bytes'>160982630400</capacity>
  <allocation unit='bytes'>63092301824</allocation>
  <available unit='bytes'>97890328576</available>
  <source>
  </source>
  <target>
    <path>/home/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.Define pool
Terminal 1:
# virsh pool-event --event lifecycle

Terminal 2:
# virsh pool-define pool.xml 
Pool test defined from pool.xml

Check Terminal 1:
# virsh pool-event --event lifecycle
event 'lifecycle' for storage pool test: Defined
events received: 1

3.Build pool
Terminal 1:
# virsh pool-event --event lifecycle

Terminal 2:
# virsh pool-build test
Pool test built

Check Terminal 1:
# virsh pool-event --event lifecycle
                   <--- nothing displayed

Actual results:
As step 3 shows.

Expected results:
'pool-build' should be listened by 'pool-event'

Additional info:

Comment 2 Michal Privoznik 2017-09-20 09:59:41 UTC
commit b06521928cca0b55987bdc49360f8d78a56feb04
Author:     Julio Faracco <jcfaracco>
AuthorDate: Sat Sep 9 12:09:49 2017 -0300
Commit:     Michal Privoznik <mprivozn>
CommitDate: Wed Sep 20 11:52:56 2017 +0200

    storage: Add new events for *PoolBuild() and *PoolDelete().
    
    This commit adds new events for two methods and operations: *PoolBuild() and
    *PoolDelete(). Using the event-test and the commands set below we have the
    following outputs:
    
    $ sudo ./event-test
    Registering event callbacks
    myStoragePoolEventCallback EVENT: Storage pool test Defined 0
    myStoragePoolEventCallback EVENT: Storage pool test Created 0
    myStoragePoolEventCallback EVENT: Storage pool test Started 0
    myStoragePoolEventCallback EVENT: Storage pool test Stopped 0
    myStoragePoolEventCallback EVENT: Storage pool test Deleted 0
    myStoragePoolEventCallback EVENT: Storage pool test Undefined 0
    
    Another terminal:
    $ sudo virsh pool-define test.xml
    Pool test defined from test.xml
    
    $ sudo virsh pool-build test
    Pool test built
    
    $ sudo virsh pool-start test
    Pool test started
    
    $ sudo virsh pool-destroy test
    Pool test destroyed
    
    $ sudo virsh pool-delete test
    Pool test deleted
    
    $ sudo virsh pool-undefine test
    Pool test has been undefined
    
    This commits can be a solution for RHBZ #1475227.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1475227
    
    Signed-off-by: Julio Faracco <jcfaracco>
    Signed-off-by: Michal Privoznik <mprivozn>

v3.7.0-136-gb06521928

Comment 4 jiyan 2017-10-11 09:50:45 UTC
Test env components:
kernel-3.10.0-731.el7.x86_64
libvirt-3.8.0-1.el7.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.9.x86_64

Test scenario:
1.Prepare a xml file to define a pool
# cat pool.xml 
<pool type='dir'>
  <name>test</name>
  <capacity unit='bytes'>160982630400</capacity>
  <allocation unit='bytes'>63092301824</allocation>
  <available unit='bytes'>97890328576</available>
  <source>
  </source>
  <target>
    <path>/home/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.Define pool
Terminal 1:
# virsh pool-event --event lifecycle

Terminal 2:
# virsh pool-define pool.xml 
Pool test defined from pool.xml

Check Terminal 1:
# virsh pool-event --event lifecycle
event 'lifecycle' for storage pool test: Defined
events received: 1

3. Build pool
Terminal 1:
# virsh pool-event --event lifecycle
 
Terminal 2:
# virsh pool-build test
Pool test built

Check Terminal 1:
# virsh pool-event --event lifecycle
event 'lifecycle' for storage pool test: Created
events received: 1

4. Start pool
Terminal 1:
# virsh pool-event --event lifecycle
 
Terminal 2:
# virsh pool-start test
Pool test started

Check Terminal 1:
# virsh pool-event --event lifecycle
event 'lifecycle' for storage pool test: Started
events received: 1


5. Destroy pool
Terminal 1:
# virsh pool-event --event lifecycle
 
Terminal 2:
# virsh pool-destroy test
Pool test destroyed

Check Terminal 1:
# virsh pool-event --event lifecycle
event 'lifecycle' for storage pool test: Stopped
events received: 1

6. Delete pool
Terminal 1:
# virsh pool-event --event lifecycle

Terminal 2:
# virsh pool-delete test
Pool test deleted

Check Terminal 1:
# virsh pool-event --event lifecycle
event 'lifecycle' for storage pool test: Deleted
events received: 1

7. Undefine pool
Terminal 1:
# virsh pool-event --event lifecycle
 
Terminal 2:
# virsh pool-undefine test
Pool test has been undefined

Check Terminal 1:
# virsh pool-event --event lifecycle
event 'lifecycle' for storage pool test: Undefined
events received: 1

All the results are as expected, move this bug to be verified.

Comment 8 errata-xmlrpc 2018-04-10 10:52:40 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:0704