libvirt/python
Peter Krempa 747f64eeaf lib: Add public api to enable atomic listing of guest
This patch adds a new public api that lists domains. The new approach is
different from those used before. There are key points to this:

1) The list is acquired atomically and contains both active and inactive
domains (guests). This eliminates the need to call two different list
APIs, where the state might change in between the calls.

2) The returned list consists of virDomainPtrs instead of names or ID's
that have to be converted to virDomainPtrs anyways using separate calls
for each one of them. This is more convenient and saves hypervisor calls.

3) The returned list is auto-allocated. This saves a lot of hassle for
the users.

4) Built in support for filtering. The API call supports various
filtering flags that modify the output list according to user needs.

Available filter groups:
    Domain status:
    VIR_CONNECT_LIST_DOMAINS_ACTIVE, VIR_CONNECT_LIST_DOMAINS_INACTIVE

    Domain persistence:
    VIR_CONNECT_LIST_DOMAINS_PERSISTENT,
    VIR_CONNECT_LIST_DOMAINS_TRANSIENT

    Domain state:
    VIR_CONNECT_LIST_DOMAINS_RUNNING, VIR_CONNECT_LIST_DOMAINS_PAUSED,
    VIR_CONNECT_LIST_DOMAINS_SHUTOFF, VIR_CONNECT_LIST_DOMAINS_OTHER

    Existence of managed save image:
    VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE,
    VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE

    Auto-start option:
    VIR_CONNECT_LIST_DOMAINS_AUTOSTART,
    VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART

    Existence of snapshot:
    VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT,
    VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT

5) The python binding returns a list of domain objects that is very neat
to work with.

The only problem with this approach is no support from code generators
so both RPC code and python bindings had to be written manually.

*include/libvirt/libvirt.h.in: - add API prototype
                               - clean up whitespace mistakes nearby
*python/generator.py: - inhibit generation of the bindings for the new
                        api
*src/driver.h: - add driver prototype
               - clean up some whitespace mistakes nearby
*src/libvirt.c: - add public implementation
*src/libvirt_public.syms: - export the new symbol
2012-06-18 21:24:13 +02:00
..
tests python: Fix doc directory name for stable releases 2012-04-27 12:41:05 -04:00
generator.py lib: Add public api to enable atomic listing of guest 2012-06-18 21:24:13 +02:00
libvirt-override-api.xml python: make python APIs use these helper functions 2012-03-28 08:54:06 -06:00
libvirt-override-virConnect.py Add support for the suspend event 2012-03-23 23:12:18 +08:00
libvirt-override-virStream.py python: correct a copy-paste error 2012-02-01 10:26:57 +01:00
libvirt-override.c python: fix snapshot listing bugs 2012-06-12 06:43:25 -06:00
libvirt-override.py Fix two comments related to error handling 2011-10-17 17:21:56 +02:00
libvirt-qemu-override-api.xml qemu_api: Add override XML and C files for QEMU APIs 2011-09-14 11:38:51 +08:00
libvirt-qemu-override.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
Makefile.am python: Fix doc directory name for stable releases 2012-04-27 12:41:05 -04:00
README Re-arrange python generator to make it clear what's auto-generated 2009-09-21 14:41:46 +01:00
TODO syntax-check: enforce the no-cvs-keywords prohibition 2008-12-15 10:24:54 +00:00
typewrappers.c Fix compilation error on 32bit 2012-04-10 06:24:03 -04:00
typewrappers.h python: Add new helper functions for python to C integral conversion 2012-03-28 08:42:40 -06:00

    libvirt Python Bindings README
    ==============================

Most of the libvirt python binding code is automatically generated
using the script  generator.py, and the API description from
docs/libvirt-api.xml


Manually written files:

 - libvirt-override.c: methods where the C binding needs to be hand crafted
 - libvirt-override.py: global methods where the C and python bindings have different args
 - libvirt-override-api.xml: methods where the auto-extracted API docs are not
   suitable for python auto-generator. Overriding this if the method is going
   into libvirt-override.c, but we still want auto-generated libvirt-override.py
 - libvirt-override-virConnect.py: virConnect class methods
 - typewrappers.h,.c: Python object wrappers for each libvirt C object


Auto-generated files:

  - libvirt.py: The main python binding. Comprises auto-generated code, along
    with contents from libvirt-override.py and libvirt-override-virConnect.py
  - libvirt.c, libvirt.h: The C glue layer for the python binding. Comprises
    auto-generated code, along with libvirt-override.c
  - libvirt-export.c: List of auto-generated C methods, included into
    the libvirt-override.c method table