
On Tue, Oct 04, 2016 at 10:43:31AM +0200, Kashyap Chamarthy wrote:
Last night I was trying to check whether blockJobInfo() method will raise an error when it returns 'None' in v1.2.5 libvirt Python bindings. (Eric Blake confirmed on IRC: "the python bindings have, as a general rule, always raised a libvirtError if the C binding code returns None").
Before asking on IRC, I built the bindings and the below is what I noticed.
Let's first see what's in current Git master:
$ less build/libvirt.py [...] def blockJobInfo(self, path, flags=0): """Get progress information for a block job """ ret = libvirtmod.virDomainGetBlockJobInfo(self._o, path, flags) if ret is None: raise libvirtError ('virDomainGetBlockJobInfo() failed', dom=self) return ret [...]
Now try to find out what is present in v1.2.5 by quickly building the bindings for that tag:
$ git checkout v1.2.5 $ python setup.py build
Hmm, once built, there's no blockJobInfo() method in build/libvirt.py! (When I mentioned this on #virt, OFTC, Cole confirmed he could reproduce the behavior, too. Not sure if it's a regression in v1.2.5.)
I guess that your libvirt version which was used to generate libvirt-python bindings is too new for libvirt-python-v1.2.5. In general libvirt-python is build-able using libvirt with the same version or older. If you build libvirt-python with newer libvirt the result is undefined, so the build may fail or it may generate wrong files. In your case you have probably libvirt-v1.2.10 or newer, where libvirt.h file was split into separate header files and libvirt-python-v1.2.5 simply don't know about this change. Pavel