summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2012-05-18 17:22:02 +0200
committerPeter Krempa <pkrempa@redhat.com>2012-06-18 21:24:13 +0200
commit810969da9f9ec60bffe23b66dcf6569dacf1c52e (patch)
tree50d9c75f5edbec0aa946ea7af1047db6ded0e28f
parent71ae2ce782dd2509e3e0dec9d2b77cc4b84769f2 (diff)
downloadlibvirt-python-split-810969da9f9ec60bffe23b66dcf6569dacf1c52e.tar.gz
libvirt-python-split-810969da9f9ec60bffe23b66dcf6569dacf1c52e.tar.xz
libvirt-python-split-810969da9f9ec60bffe23b66dcf6569dacf1c52e.zip
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
-rwxr-xr-xgenerator.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/generator.py b/generator.py
index 9530867..0b6ac7c 100755
--- a/generator.py
+++ b/generator.py
@@ -453,6 +453,7 @@ skip_function = (
'virConnectDomainEventDeregisterAny', # overridden in virConnect.py
'virSaveLastError', # We have our own python error wrapper
'virFreeError', # Only needed if we use virSaveLastError
+ 'virConnectListAllDomains', #overridden in virConnect.py
'virStreamRecvAll', # Pure python libvirt-override-virStream.py
'virStreamSendAll', # Pure python libvirt-override-virStream.py