Bug 999454

Summary: blockJobInfo python API run success but return None
Product: Red Hat Enterprise Linux 6 Reporter: Gunannan Ren <gren>
Component: libvirtAssignee: Eric Blake <eblake>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.5CC: cpelland, cwei, dyuan, eblake, eharney, gsun, honzhang, jdenemar, mzhan, rbalakri, xuzhang
Target Milestone: rcKeywords: Upstream, ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-30.el6 Doc Type: Bug Fix
Doc Text:
Cause: The libvirt python bindings for querying block job status were not distinguishing between an error and no status available. Consequence: Code that was polling for the completion of a block job had to deal with a python exception, and could not distinguish it from an actual error. Fix: The bindings now return an empty dictionary when there is no job and no error in determining that fact. Result: The binding can be used more reliably in managing block jobs.
Story Points: ---
Clone Of: 950419 Environment:
Last Closed: 2014-10-14 04:16:49 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: 912170, 912172, 950419    
Bug Blocks: 999077, 1038815    

Comment 4 Eric Blake 2013-10-10 18:01:02 UTC
The patch in comment 2 still applies.

Comment 13 Xuesong Zhang 2014-04-11 09:04:28 UTC
Verify this bug with the following package:
libvirt-0.10.2-31.el6.x86_64
libvirt-python-0.10.2-31.el6.x86_64

steps:
1. prpare a active block operations
1.1 prepare one qed image file.
# ll /var/lib/libvirt/images/qed.img 
-rw-r--r--. 1 qemu qemu 327680 Apr 11 04:17 /var/lib/libvirt/images/qed.img

1.2. create img backing file
# qemu-img create -f qed -b /var/lib/libvirt/images/qed.img
/var/lib/libvirt/images/qed1.img
Formatting '/var/lib/libvirt/images/qed1.img', fmt=qed size=8388608000
backing_file='/var/lib/libvirt/images/qed.img' cluster_size=0 table_size=0 

1.3. edit domain disk as using the backing file
# virsh edit rhel6.5
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='qed' cache='none'/>
      <source file='/var/lib/libvirt/images/qed1.img'/>
      <target dev='vdb' bus='virtio'/>
    </disk>
...

1.4. start domain
# virsh start rhel6.5

1.5 do blockpull with setting bandwidth
# virsh blockpull rhel6.5 vdb --bandwidth 1

2. check the blockjob info via virsh command
# virsh blockjob rhel6.5 vdb;echo $?

0

3. check the blockjob info via API, the result is as expected.
# python
Python 2.6.6 (r266:84292, Sep  4 2013, 07:46:00) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> con = libvirt.open('')
>>> dom = con.lookupByName('rhel6.5')
>>> dom.blockJobInfo('vdb', 0)
{}

So, change the status to verify.

Comment 16 errata-xmlrpc 2014-10-14 04:16:49 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.

http://rhn.redhat.com/errata/RHBA-2014-1374.html