[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 2/5] python: add API exports for virConnectListAllDomains()



On 05/20/2012 09:56 AM, Peter Krempa wrote:
> This patch adds export of the new API function
> virConnectListAllDomains() to the libvirt-python bindings. The
> virConnect object now has method "listAllDomains" that takes only the
> flags parameter and returns a python list of virDomain object
> corresponding to virDomainPtrs returned by the underlying api.
> 
> The implementation is done manually as the generator does not support
> wrapping list of virDomainPtrs into virDomain objects.
> ---
>  python/libvirt-override-api.xml       |   12 ++++++--
>  python/libvirt-override-virConnect.py |   12 ++++++++
>  python/libvirt-override.c             |   49 ++++++++++++++++++++++++++++++++-
>  3 files changed, 69 insertions(+), 4 deletions(-)

Just noticed another thing:


> +    <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'/>

This does not expose any way to trigger the underlying C code of passing
NULL as a means of just counting.  That might be useful, so maybe we need:

conn.numOfAllDomains

in python code, which wraps virConnectListAllDomains but passes NULL and
returns just an integer instead of a list.  After all, if we make RPC
more efficient for just counting when passing NULL, then it is feasible
to write python code that could benefit from that efficiency.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]