diff options
author | Guannan Ren <gren@redhat.com> | 2013-08-21 16:07:20 +0800 |
---|---|---|
committer | Jiri Denemark <jdenemar@redhat.com> | 2013-08-21 16:05:37 +0200 |
commit | ec6ed4d7c8f24cef96cb28a45b7f4baab02741fd (patch) | |
tree | 59996f54f70a396664cc7a085adacde4d50e686b /tests | |
parent | 60d87b704e7cb1251da46e825033eb3d35311ae2 (diff) | |
download | libvirt-python-v6-libvirt-0.10.2-26.el6.tar.gz libvirt-python-v6-libvirt-0.10.2-26.el6.tar.xz libvirt-python-v6-libvirt-0.10.2-26.el6.zip |
python: fix bindings that don't raise an exceptionlibvirt-0.10.2-29.el6libvirt-0.10.2-28.el6libvirt-0.10.2-27.el6libvirt-0.10.2-26.el6libvirt-0.10.2-25.el6libvirt-0.10.2-24.el6libvirt-0.10.2-23.el6
Resovles: https://bugzilla.redhat.com/show_bug.cgi?id=912170
(cherry picked from commit 4b143ab23173000d1afa258726be0ff38cf2b386)
For example:
>>> dom.memoryStats()
libvir: QEMU Driver error : Requested operation is not valid:\
domain is not running
There are six such python API functions like so.
The root reason is that generator.py script checks the type of return
value of a python stub function defined in libvirt-api.xml or
libvirt-override-api.xml to see whether to add the raise clause or not
in python wrapper code in libvirt.py.
The type of return value is supposed to be C types.
For those stub functions which return python non-integer data type like
string, list, tuple, dictionary, the existing type in functions varies
from each other which leads problem like this.
Currently, in generator.py, it maintains a buggy whitelist for stub functions
returning a list type. I think it is easy to forget adding new function name
in the whitelist.
This patch makes the value of type consistent with C type "char *"
in libvirt-override-api.xml. For python, any of types could be printed
as string, so I choose "char *" in this case. And the comment in xml
could explain it when adding new function definition.
<function name='virNodeGetCPUStats' file='python'>
...
- <return type='virNodeCPUStats' info='...'/>
+ <return type='char *' info='...'/>
...
</function>
Conflicts:
python/libvirt-override-api.xml
*no virDomainGetJobStats and virNodeGetCPUMap APIs in RHEL6.5
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions