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 /libvirt-override-api.xml | |
parent | 60d87b704e7cb1251da46e825033eb3d35311ae2 (diff) | |
download | libvirt-python-v6-libvirt-0.10.2-27.el6.tar.gz libvirt-python-v6-libvirt-0.10.2-27.el6.tar.xz libvirt-python-v6-libvirt-0.10.2-27.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 'libvirt-override-api.xml')
-rw-r--r-- | libvirt-override-api.xml | 113 |
1 files changed, 61 insertions, 52 deletions
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index b76fb4e..a057715 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -1,5 +1,14 @@ <?xml version="1.0"?> <api name='libvir-python'> + <!-- This file lists libvirt API functions whose Python stubs are + written by hand in libvirt-override.c, but the Python-level code + are still automatically generated by the generator.py script. + + The type of return value is supposed to be C type. If a function's + stub will return a python non-integer data type like string, list, + tuple, dictionary, etc, please use "char *" as the type of its return + value. + --> <symbols> <function name="virConnectGetVersion" file='python'> <info>Returns the running hypervisor version of the connection host</info> @@ -14,34 +23,34 @@ <function name="virConnectListDomainsID" file='python'> <info>Returns the list of the ID of the domains on the hypervisor</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> - <return type='int *' info="the list of ID or None in case of error"/> + <return type='char *' info="the list of ID or None in case of error"/> </function> <function name='virConnectListDefinedDomains' file='python'> <info>list the defined domains, stores the pointers to the names in @names</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> - <return type='str *' info='the list of Names or None in case of error'/> + <return type='char *' info='the list of Names or None in case of error'/> </function> <function name='virConnectListAllDomains' file='python'> <info>returns list of all defined domains</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='flags' type='unsigned int' info='optional flags'/> - <return type='domain *' info='the list of domains or None in case of error'/> + <return type='char *' info='the list of domains or None in case of error'/> </function> <function name='virConnectListNetworks' file='python'> <info>list the networks, stores the pointers to the names in @names</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> - <return type='str *' info='the list of Names or None in case of error'/> + <return type='char *' info='the list of Names or None in case of error'/> </function> <function name='virConnectListDefinedNetworks' file='python'> <info>list the defined networks, stores the pointers to the names in @names</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> - <return type='str *' info='the list of Names or None in case of error'/> + <return type='char *' info='the list of Names or None in case of error'/> </function> <function name='virConnectListAllNetworks' file='python'> <info>returns list of all networks</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='flags' type='unsigned int' info='optional flags'/> - <return type='network *' info='the list of networks or None in case of error'/> + <return type='char *' info='the list of networks or None in case of error'/> </function> <function name='virDomainLookupByUUID' file='python'> <info>Try to lookup a domain on the given hypervisor based on its UUID.</info> @@ -57,48 +66,48 @@ </function> <function name='virDomainGetInfo' file='python'> <info>Extract information about a domain. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted.</info> - <return type='int *' info='the list of information or None in case of error'/> + <return type='char *' info='the list of information or None in case of error'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> </function> <function name='virDomainGetState' file='python'> <info>Extract domain state.</info> - <return type='int *' info='the list containing state and reason or None in case of error'/> + <return type='char *' info='the list containing state and reason or None in case of error'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> <arg name='flags' type='unsigned int' info='additional flags'/> </function> <function name='virDomainGetControlInfo' file='python'> <info>Extract details about current state of control interface to a domain.</info> - <return type='int *' info='the list of information or None in case of error'/> + <return type='char *' info='the list of information or None in case of error'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> <arg name='flags' type='unsigned int' info='additional flags'/> </function> <function name='virDomainGetBlockInfo' file='python'> <info>Extract information about a domain block device size</info> - <return type='int *' info='the list of information or None in case of error'/> + <return type='char *' info='the list of information or None in case of error'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> <arg name='path' type='const char *' info='path to the block device or file'/> <arg name='flags' type='unsigned int' info='currently unused'/> </function> <function name='virDomainGetJobInfo' file='python'> <info>Extract information about an active job being processed for a domain.</info> - <return type='int *' info='the list of information or None in case of error'/> + <return type='char *' info='the list of information or None in case of error'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> </function> <function name='virNodeGetInfo' file='python'> <info>Extract hardware information about the Node.</info> - <return type='int *' info='the list of information or None in case of error'/> + <return type='char *' info='the list of information or None in case of error'/> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> </function> <function name='virNodeGetCPUStats' file='python'> <info>Extract node's CPU statistics.</info> - <return type='virNodeCPUStats' info='dictionary mapping field names to values or None in case of error'/> + <return type='char *' info='dictionary mapping field names to values or None in case of error'/> <arg name='conn' type='virConnectPtr' info='pointer to hypervisor connection'/> <arg name='cpuNum' type='int' info='number of node cpu. (VIR_NODE_CPU_STATS_ALL_CPUS means total cpu statistics)'/> <arg name='flags' type='unsigned int' info='additional flags'/> </function> <function name='virNodeGetMemoryStats' file='python'> <info>Extract node's memory statistics.</info> - <return type='virNodeMemoryStats' info='dictionary mapping field names to values or None in case of error'/> + <return type='char *' info='dictionary mapping field names to values or None in case of error'/> <arg name='conn' type='virConnectPtr' info='pointer to hypervisor connection'/> <arg name='cellNum' type='int' info='number of node cell. (VIR_NODE_MEMORY_STATS_ALL_CELLS means total cell statistics)'/> <arg name='flags' type='unsigned int' info='additional flags'/> @@ -150,13 +159,13 @@ </function> <function name='virDomainBlockStats' file='python'> <info>Extracts block device statistics for a domain</info> - <return type='virDomainBlockStats' info='a tuple of statistics'/> + <return type='char *' info='a tuple of statistics'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> <arg name='path' type='char *' info='the path for the block device'/> </function> <function name='virDomainBlockStatsFlags' file='python'> <info>Extracts block device statistics parameters of a running domain</info> - <return type='str *' info='None in case of error, returns a dictionary of params'/> + <return type='char *' info='None in case of error, returns a dictionary of params'/> <arg name='domain' type='virDomainPtr' info='pointer to domain object'/> <arg name='path' type='char *' info='the path for the block device'/> <arg name='flags' type='int' info='flags (unused; pass 0)'/> @@ -169,20 +178,20 @@ [{cpu_time:xxx}, {cpu_time:xxx}, ...] If it is True or 1, it returns total domain CPU statistics in the format of [{cpu_time:xxx, user_time:xxx, system_time:xxx}]</info> - <return type='str *' info='returns a list of dictionary in case of success, None in case of error'/> + <return type='char *' info='returns a list of dictionary in case of success, None in case of error'/> <arg name='domain' type='virDomainPtr' info='pointer to domain object'/> <arg name='total' type='bool' info='on true, return total domain CPU statistics, false return per-cpu info'/> <arg name='flags' type='int' info='flags (unused; pass 0)'/> </function> <function name='virDomainInterfaceStats' file='python'> <info>Extracts interface device statistics for a domain</info> - <return type='virDomainInterfaceStats' info='a tuple of statistics'/> + <return type='char *' info='a tuple of statistics'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> <arg name='path' type='char *' info='the path for the interface device'/> </function> <function name='virDomainMemoryStats' file='python'> <info>Extracts memory statistics for a domain</info> - <return type='virDomainMemoryStats' info='a dictionary of statistics'/> + <return type='char *' info='a dictionary of statistics'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> </function> <function name="virNodeGetCellsFreeMemory" file='python'> @@ -190,16 +199,16 @@ <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='startCell' type='int' info='first cell in the list'/> <arg name='maxCells' type='int' info='number of cell in the list'/> - <return type='int *' info="the list available memory in the cells"/> + <return type='char *' info="the list available memory in the cells"/> </function> <function name='virDomainGetSchedulerParameters' file='python'> <info>Get the scheduler parameters, the @params array will be filled with the values.</info> - <return type='str *' info='None in case of error, returns a dictionary of params.'/> + <return type='char *' info='None in case of error, returns a dictionary of params.'/> <arg name='domain' type='virDomainPtr' info='pointer to domain object'/> </function> <function name='virDomainGetSchedulerParametersFlags' file='python'> <info>Get the scheduler parameters</info> - <return type='str *' info='None in case of error, returns a dictionary of params'/> + <return type='char *' info='None in case of error, returns a dictionary of params'/> <arg name='domain' type='virDomainPtr' info='pointer to domain object'/> <arg name='flags' type='int' info='an OR'ed set of virDomainModificationImpact'/> </function> @@ -230,7 +239,7 @@ </function> <function name='virDomainGetVcpuPinInfo' file='python'> <info>Query the CPU affinity setting of all virtual CPUs of domain</info> - <return type='unsigned char *' info='the array of cpumap'/> + <return type='char *' info='the array of cpumap'/> <arg name='domain' type='virDomainPtr' info='pointer to domain object, or NULL for Domain0'/> <arg name='flags' type='int' info='an OR'ed set of virDomainModificationImpact'/> </function> @@ -256,7 +265,7 @@ </function> <function name='virDomainGetBlkioParameters' file='python'> <info>Get the blkio parameters</info> - <return type='str *' info='None in case of error, returns a dictionary of params'/> + <return type='char *' info='None in case of error, returns a dictionary of params'/> <arg name='domain' type='virDomainPtr' info='pointer to domain object'/> <arg name='flags' type='int' info='an OR'ed set of virDomainModificationImpact'/> </function> @@ -269,7 +278,7 @@ </function> <function name='virDomainGetMemoryParameters' file='python'> <info>Get the memory parameters</info> - <return type='str *' info='None in case of error, returns a dictionary of params'/> + <return type='char *' info='None in case of error, returns a dictionary of params'/> <arg name='domain' type='virDomainPtr' info='pointer to domain object'/> <arg name='flags' type='int' info='an OR'ed set of virDomainModificationImpact'/> </function> @@ -282,7 +291,7 @@ </function> <function name='virDomainGetNumaParameters' file='python'> <info>Get the NUMA parameters</info> - <return type='str *' info='returns a dictionary of params in case of success, None in case of error'/> + <return type='char *' info='returns a dictionary of params in case of success, None in case of error'/> <arg name='domain' type='virDomainPtr' info='pointer to domain object'/> <arg name='flags' type='int' info='an OR'ed set of virDomainModificationImpact'/> </function> @@ -299,44 +308,44 @@ <arg name='dom' type='virDomainPtr' info='pointer to the domain'/> <arg name='device' type='const char *' info='interface name'/> <arg name='flags' type='unsigned int' info='an OR'ed set of virDomainModificationImpact'/> - <return type='str *' info='the bandwidth tunables value or None in case of error'/> + <return type='char *' info='the bandwidth tunables value or None in case of error'/> </function> <function name='virConnectListStoragePools' file='python'> <info>list the storage pools, stores the pointers to the names in @names</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> - <return type='str *' info='the list of Names of None in case of error'/> + <return type='char *' info='the list of Names of None in case of error'/> </function> <function name='virConnectListDefinedStoragePools' file='python'> <info>list the defined storage pool, stores the pointers to the names in @names</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> - <return type='str *' info='the list of Names of None in case of error'/> + <return type='char *' info='the list of Names of None in case of error'/> </function> <function name='virConnectListAllStoragePools' file='python'> <info>returns list of all storage pools</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='flags' type='unsigned int' info='optional flags'/> - <return type='pool *' info='the list of pools or None in case of error'/> + <return type='char *' info='the list of pools or None in case of error'/> </function> <function name='virStoragePoolListVolumes' file='python'> <info>list the storage volumes, stores the pointers to the names in @names</info> <arg name='pool' type='virStoragePoolPtr' info='pointer to the storage pool'/> - <return type='str *' info='the list of Names or None in case of error'/> + <return type='char *' info='the list of Names or None in case of error'/> </function> <function name='virStoragePoolListAllVolumes' file='python'> <info>return list of storage volume objects</info> <arg name='pool' type='virStoragePoolPtr' info='pointer to the storage pool'/> <arg name='flags' type='unsigned int' info='optional flags'/> - <return type='volume *' info='the list of volumes or None in case of error'/> + <return type='char *' info='the list of volumes or None in case of error'/> </function> <function name='virStoragePoolGetInfo' file='python'> <info>Extract information about a storage pool. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted.</info> - <return type='int *' info='the list of information or None in case of error'/> + <return type='char *' info='the list of information or None in case of error'/> <arg name='pool' type='virStoragePoolPtr' info='a storage pool object'/> </function> <function name='virStorageVolGetInfo' file='python'> <info>Extract information about a storage volume. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted.</info> - <return type='int *' info='the list of information or None in case of error'/> + <return type='char *' info='the list of information or None in case of error'/> <arg name='vol' type='virStorageVolPtr' info='a storage vol object'/> </function> <function name='virNodeListDevices' file='python'> @@ -344,18 +353,18 @@ <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='cap' type='const unsigned char *' info='capability name'/> <arg name='flags' type='unsigned int' info='flags (unused; pass 0)'/> - <return type='str *' info='the list of Names or None in case of error'/> + <return type='char *' info='the list of Names or None in case of error'/> </function> <function name='virConnectListAllNodeDevices' file='python'> <info>returns list of all host node devices</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='flags' type='unsigned int' info='optional flags'/> - <return type='device *' info='the list of host node device or None in case of error'/> + <return type='char *' info='the list of host node device or None in case of error'/> </function> <function name='virNodeDeviceListCaps' file='python'> <info>list the node device's capabilities</info> <arg name='dev' type='virNodeDevicePtr' info='pointer to the node device'/> - <return type='str *' info='the list of Names or None in case of error'/> + <return type='char *' info='the list of Names or None in case of error'/> </function> <function name='virSecretGetValue' file='libvirt' module='libvirt'> <info>Fetches the value associated with a secret.</info> @@ -366,13 +375,13 @@ <function name='virConnectListSecrets' file='libvirt' module='libvirt'> <info>List the defined secret IDs</info> <arg name='conn' type='virConnectPtr' info='virConnect connection'/> - <return type='str *' info='the list of secret IDs or None in case of error'/> + <return type='char *' info='the list of secret IDs or None in case of error'/> </function> <function name='virConnectListAllSecrets' file='python'> <info>returns list of all interfaces</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='flags' type='unsigned int' info='optional flags'/> - <return type='secret *' info='the list of secrets or None in case of error'/> + <return type='char *' info='the list of secrets or None in case of error'/> </function> <function name='virSecretSetValue' file='libvirt' module='libvirt'> <info>Associates a value with a secret.</info> @@ -400,13 +409,13 @@ <function name='virConnectListNWFilters' file='libvirt' module='libvirt'> <info>List the defined network filters</info> <arg name='conn' type='virConnectPtr' info='virConnect connection'/> - <return type='str *' info='the list of network filter IDs or None in case of error'/> + <return type='char *' info='the list of network filter IDs or None in case of error'/> </function> <function name='virConnectListAllNWFilters' file='python'> <info>returns list of all network fitlers</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='flags' type='unsigned int' info='optional flags'/> - <return type='nwfilter *' info='the list of network filters or None in case of error'/> + <return type='char *' info='the list of network filters or None in case of error'/> </function> <function name='virNWFilterLookupByUUID' file='python'> <info>Try to lookup a network filter on the given hypervisor based on its UUID.</info> @@ -427,18 +436,18 @@ <function name='virConnectListInterfaces' file='python'> <info>list the running interfaces, stores the pointers to the names in @names</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> - <return type='str *' info='the list of Names of None in case of error'/> + <return type='char *' info='the list of Names of None in case of error'/> </function> <function name='virConnectListDefinedInterfaces' file='python'> <info>list the defined interfaces, stores the pointers to the names in @names</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> - <return type='str *' info='the list of Names of None in case of error'/> + <return type='char *' info='the list of Names of None in case of error'/> </function> <function name='virConnectListAllInterfaces' file='python'> <info>returns list of all interfaces</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='flags' type='unsigned int' info='optional flags'/> - <return type='interface *' info='the list of interfaces or None in case of error'/> + <return type='char *' info='the list of interfaces or None in case of error'/> </function> <function name='virConnectBaselineCPU' file='python'> <info>Computes the most feature-rich CPU which is compatible with all given host CPUs.</info> @@ -451,25 +460,25 @@ <info>collect the list of snapshot names for the given domain</info> <arg name='dom' type='virDomainPtr' info='pointer to the domain'/> <arg name='flags' type='unsigned int' info='flags'/> - <return type='str *' info='the list of Names or None in case of error'/> + <return type='char *' info='the list of Names or None in case of error'/> </function> <function name='virDomainListAllSnapshots' file='python'> <info>returns the list of snapshots for the given domain</info> <arg name='dom' type='virDomainPtr' info='pointer to the domain'/> <arg name='flags' type='unsigned int' info='flags'/> - <return type='snapshot *' info='the list of snapshots or None in case of error'/> + <return type='char *' info='the list of snapshots or None in case of error'/> </function> <function name='virDomainSnapshotListChildrenNames' file='python'> <info>collect the list of child snapshot names for the given snapshot</info> <arg name='snapshot' type='virDomainSnapshotPtr' info='pointer to the snapshot'/> <arg name='flags' type='unsigned int' info='flags'/> - <return type='str *' info='the list of Names or None in case of error'/> + <return type='char *' info='the list of Names or None in case of error'/> </function> <function name='virDomainSnapshotListAllChildren' file='python'> <info>returns the list of child snapshots for the given snapshot</info> <arg name='snapshot' type='virDomainSnapshotPtr' info='pointer to the snapshot'/> <arg name='flags' type='unsigned int' info='flags'/> - <return type='snapshot *' info='the list of snapshots or None in case of error'/> + <return type='char *' info='the list of snapshots or None in case of error'/> </function> <function name='virDomainRevertToSnapshot' file='python'> <info>revert the domain to the given snapshot</info> @@ -483,7 +492,7 @@ <arg name='dom' type='virDomainPtr' info='pointer to the domain'/> <arg name='path' type='const char *' info='Fully-qualified filename of disk'/> <arg name='flags' type='unsigned int' info='fine-tuning flags, currently unused, pass 0.'/> - <return type='virDomainBlockJobInfo' info='A dictionary containing job information.' /> + <return type='char *' info='A dictionary containing job information.' /> </function> <function name='virDomainMigrateGetMaxSpeed' file='python'> <info>Get currently configured maximum migration speed for a domain</info> @@ -504,7 +513,7 @@ <arg name='dom' type='virDomainPtr' info='pointer to the domain'/> <arg name='disk' type='const char *' info='disk name'/> <arg name='flags' type='unsigned int' info='an OR'ed set of virDomainModificationImpact'/> - <return type='str *' info='the I/O tunables value or None in case of error'/> + <return type='char *' info='the I/O tunables value or None in case of error'/> </function> <function name='virDomainBlockPeek' file='python'> <info>Read the contents of domain's disk device</info> @@ -525,7 +534,7 @@ </function> <function name='virDomainGetDiskErrors' file='python'> <info>Extract errors on disk devices.</info> - <return type='virDomainDiskErrorPtr' info='dictionary of disks and their errors or None in case of error'/> + <return type='char *' info='dictionary of disks and their errors or None in case of error'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> <arg name='flags' type='unsigned int' info='unused, always pass 0'/> </function> @@ -538,7 +547,7 @@ </function> <function name='virNodeGetMemoryParameters' file='python'> <info>Get the node memory parameters</info> - <return type='str *' info='None in case of error, returns a dictionary of params'/> + <return type='char *' info='None in case of error, returns a dictionary of params'/> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='flags' type='int' info='unused, always pass 0'/> </function> |