summaryrefslogtreecommitdiffstats
path: root/libvirt-override.c
Commit message (Collapse)AuthorAgeFilesLines
* Define public API for receiving guest memory balloon eventsDaniel P. Berrange2012-07-141-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | When the guest changes its memory balloon applications may want to know what the new value is, without having to periodically poll on XML / domain info. Introduce a "balloon change" event to let apps see this * include/libvirt/libvirt.h.in: Define the virConnectDomainEventBalloonChangeCallback callback and VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE constant * python/libvirt-override-virConnect.py, python/libvirt-override.c: Wire up helpers for new event * daemon/remote.c: Helper for serializing balloon event * examples/domain-events/events-c/event-test.c, examples/domain-events/events-python/event-test.py: Add example of balloon event usage * src/conf/domain_event.c, src/conf/domain_event.h: Handling of balloon events * src/remote/remote_driver.c: Add handler of balloon events * src/remote/remote_protocol.x: Define wire protocol for balloon events * src/remote_protocol-structs: Likewise. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* list: provide python bindings for snapshotsv0.9.13-rc2v0.9.13-rc1v0.9.13Eric Blake2012-06-191-0/+92
| | | | | | | | | | | | | | | | | This adds support for the new virDomainListAllSnapshots (a domain function) and virDomainSnapshotListAllChildren (a snapshot function) to the libvirt-python bindings. The implementation is done manually as the generator does not support wrapping lists of C pointers into python objects. * python/libvirt-override.c (libvirt_virDomainListAllSnapshots) (libvirt_virDomainSnapshotListAllChildren): New functions. * python/libvirt-override-api.xml: Document them. * python/libvirt-override-virDomain.py (listAllSnapshots): New file. * python/libvirt-override-virDomainSnapshot.py (listAllChildren): Likewise. * python/Makefile.am (CLASSES_EXTRA): Ship them.
* python: add API exports for virConnectListAllDomains()Peter Krempa2012-06-181-1/+49
| | | | | | | | | | | 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: fix snapshot listing bugsEric Blake2012-06-121-17/+39
| | | | | | | | | Python exceptions are different than libvirt errors, and we had some corner case bugs on OOM situations. * python/libvirt-override.c (libvirt_virDomainSnapshotListNames) (libvirt_virDomainSnapshotListChildrenNames): Use correct error returns, avoid segv on OOM, and avoid memory leaks on error.
* python: use simpler methodsEric Blake2012-06-121-10/+4
| | | | | | * python/libvirt-override.c (libvirt_virDomainGetVcpus) (libvirt_virDomainGetVcpuPinInfo): Use Py_XDECREF instead of open-coding it.
* Coverity: Fix the forward_null error in Python binding codesv0.9.12-rc2v0.9.12Osier Yang2012-05-041-1/+1
| | | | | | | | | | | | Related coverity log: Error: FORWARD_NULL: /builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:355: assign_zero: Assigning: "params" = 0. /builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:458: var_deref_model: Passing null variable "params" to function "getPyVirTypedParameter", which dereferences it. (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
* python: make python APIs use these helper functionsv0.9.11-rc2Guannan Ren2012-03-281-69/+22
| | | | | *setPyVirTypedParameter *libvirt_virDomainGetCPUStats
* Cleanup for a return statement in source filesMartin Kletzander2012-03-261-108/+108
| | | | | | | | | | | | | | | | | | | | | | Return statements with parameter enclosed in parentheses were modified and parentheses were removed. The whole change was scripted, here is how: List of files was obtained using this command: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' Found files were modified with this command: sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_' Then checked for nonsense. The whole command looks like this: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
* Add support for the suspend eventv0.9.11-rc1Osier Yang2012-03-231-0/+50
| | | | | | | | | | | | | | | | | | This patch introduces a new event type for the QMP event SUSPEND: VIR_DOMAIN_EVENT_ID_PMSUSPEND The event doesn't take any data, but considering there might be reason for wakeup in future, the callback definition is: typedef void (*virConnectDomainEventSuspendCallback)(virConnectPtr conn, virDomainPtr dom, int reason, void *opaque); "reason" is unused currently, always passes "0".
* Add support for the wakeup eventOsier Yang2012-03-231-0/+50
| | | | | | | | | | | | | | | | | | This patch introduces a new event type for the QMP event WAKEUP: VIR_DOMAIN_EVENT_ID_PMWAKEUP The event doesn't take any data, but considering there might be reason for wakeup in future, the callback definition is: typedef void (*virConnectDomainEventWakeupCallback)(virConnectPtr conn, virDomainPtr dom, int reason, void *opaque); "reason" is unused currently, always passes "0".
* Add support for event tray moved of removable disksOsier Yang2012-03-231-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces a new event type for the QMP event DEVICE_TRAY_MOVED, which occurs when the tray of a removable disk is moved (i.e opened or closed): VIR_DOMAIN_EVENT_ID_TRAY_CHANGE The event's data includes the device alias and the reason for tray status' changing, which indicates why the tray status was changed. Thus the callback definition for the event is: enum { VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN = 0, VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE, \#ifdef VIR_ENUM_SENTINELS VIR_DOMAIN_EVENT_TRAY_CHANGE_LAST \#endif } virDomainEventTrayChangeReason; typedef void (*virConnectDomainEventTrayChangeCallback)(virConnectPtr conn, virDomainPtr dom, const char *devAlias, int reason, void *opaque);
* python: add virDomainGetCPUStats python binding APIGuannan Ren2012-03-221-0/+147
| | | | | | | | | | | dom.getCPUStats(True, 0) [{'cpu_time': 24699446159L, 'system_time': 10870000000L, 'user_time': 950000000L}] dom.getCPUStats(False, 0) [{'cpu_time': 8535292289L}, {'cpu_time': 1005395355L}, {'cpu_time': 9351766377L}, {'cpu_time': 5813545649L}] *generator.py Add a new naming rule *libvirt-override-api.xml The API function description *libvirt-override.c Implement it.
* python: Avoid memory leaks on libvirt_virNodeGetCPUStatsAlex Jia2012-03-221-10/+26
| | | | | | | | | | | | Detected by valgrind. Leaks are introduced in commit 4955602. * python/libvirt-override.c (libvirt_virNodeGetCPUStats): fix memory leaks and improve codes return value. For details, please see the following link: RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=770943 Signed-off-by: Alex Jia <ajia@redhat.com>
* python: Avoid memory leaks on libvirt_virNodeGetMemoryStatsAlex Jia2012-03-211-10/+26
| | | | | | | | | | | | Detected by valgrind. Leaks are introduced in commit 17c7795. * python/libvirt-override.c (libvirt_virNodeGetMemoryStats): fix memory leaks and improve codes return value. For details, please see the following link: RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=770944 Signed-off-by: Alex Jia <ajia@redhat.com>
* python: Expose virDomain{G,S}etInterfaceParameters APIs in python bindingAlex Jia2012-02-161-0/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The v4 patch corrects indentation issues. The v3 patch follows latest python binding codes and change 'size' type from int to Py_ssize_t. An simple example to show how to use it: #!/usr/bin/env python import libvirt conn = libvirt.open(None) dom = conn.lookupByName('foo') print dom.interfaceParameters('vnet0', 0) params = {'outbound.peak': 10, 'inbound.peak': 10, 'inbound.burst': 20, 'inbound.average': 20, 'outbound.average': 30, 'outbound.burst': 30} print dom.setInterfaceParameters('vnet0', params, 0) print dom.interfaceParameters('vnet0', 0) Signed-off-by: Alex Jia <ajia@redhat.com>
* python: make other APIs share common {get, set}PyVirTypedParameterv0.9.10Guannan Ren2012-02-101-598/+298
| | | | | | | | | | | | | | *libvirt_virDomainBlockStatsFlags *libvirt_virDomainGetSchedulerParameters *libvirt_virDomainGetSchedulerParametersFlags *libvirt_virDomainSetSchedulerParameters *libvirt_virDomainSetSchedulerParametersFlags *libvirt_virDomainSetBlkioParameters *libvirt_virDomainGetBlkioParameters *libvirt_virDomainSetMemoryParameters *libvirt_virDomainGetMemoryParameters *libvirt_virDomainSetBlockIoTune *libvirt_virDomainGetBlockIoTune
* python: refactoring virTypedParameter conversion for NUMA tuning APIsGuannan Ren2012-02-091-0/+351
| | | | | | | | | *getPyVirTypedParameter *setPyVirTypedParameter *virDomainSetNumaParameters *virDomainGetNumaParameters Signed-off-by: Eric Blake <eblake@redhat.com>
* python: Correct arguments number for migrateSetMaxSpeedOsier Yang2012-02-091-2/+4
| | | | | | | | The API definition accepts "flags" argument, however, the implementation ignores it, though "flags" is unused currently, we should expose it instead of hard coding, the API implementation inside hypervisor driver is responsible to check if the passed "flags" is valid.
* Added missing memory reporting into python bindingsMartin Kletzander2012-02-031-0/+6
| | | | | Two types of memory stats were not reported by python bindings. This patch fixes both of them.
* python: use libvirt_util to avoid raw freeEric Blake2012-02-031-191/+173
| | | | | | | | | | | | | | | | | | | | | | | This patch starts the process of elevating the python binding code to be on the same level as the rest of libvirt when it comes to requiring good coding styles. Statically linking against the libvirt_util library makes it much easier to write good code, rather than having to open-code and reinvent things locally. Done by global search and replace of s/free(/VIR_FREE(/, followed by hand-inspection of remaining malloc and redundant memset. * cfg.mk (exclude_file_name_regexp--sc_prohibit_raw_allocation): Remove python from exemption. * python/Makefile.am (INCLUDES): Add gnulib and src/util. Drop $(top_builddir)/$(subdir), as automake already guarantees that. (mylibs, myqemulibs): Pull in libvirt_util and gnulib. (libvirtmod_la_CFLAGS): Catch compiler warnings if configured to use -Werror. * python/typewrappers.c (libvirt_charPtrSizeWrap) (libvirt_charPtrWrap): Convert free to VIR_FREE. * python/generator.py (print_function_wrapper): Likewise. * python/libvirt-override.c: Likewise.
* python: Add binding for virDomainGetDiskErrorsJiri Denemark2012-02-011-0/+54
|
* remove a static limit on max domains in python bindingsDaniel Veillard2011-12-291-4/+23
| | | | | | * python/libvirt-override.c: remove the predefined array in the virConnectListDomainsID binding and call virConnectNumOfDomains to do a proper allocation
* python: Fix problems of virDomain{Set, Get}BlockIoTune bindingsAlex Jia2011-12-291-2/+2
| | | | | | | | | | | | | | | | | | The parameter 'params' is useless for virDomainGetBlockIoTune API, and the return value type should be a virTypedParameterPtr but not integer. And "PyArg_ParseTuple" in functions libvirt_virDomain{Set,Get}BlockIoTune misses format unit for "format" argument. * libvirt-override-api.xml: Remove useless the parameter 'params' from virDomainGetBlockIoTune API, and change return value type from integer to virTypedParameterPtr. * python/libvirt-override.c: Add the missed format units. RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=770683 Signed-off-by: Alex Jia <ajia@redhat.com>
* python: plug memory leak on libvirt_virConnectOpenAuthAlex Jia2011-12-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Detected by valgrind. Leak introduced in commit 5ab109f. * python/libvirt-override.c: avoid memory leak on libvirt_virConnectOpenAuth. * How to reproduce? % valgrind -v --leak-check=full virt-clone --print-xml Note: it can hit the issue although options are incomplete. * Actual valgrind result: ==1801== 12 bytes in 1 blocks are definitely lost in loss record 25 of 3,270 ==1801== at 0x4A05FDE: malloc (vg_replace_malloc.c:236) ==1801== by 0xCF1F60E: libvirt_virConnectOpenAuth (libvirt-override.c:1507) ==1801== by 0x3AFEEDE7F3: PyEval_EvalFrameEx (ceval.c:3794) ==1801== by 0x3AFEEDF99E: PyEval_EvalFrameEx (ceval.c:3880) ==1801== by 0x3AFEEDF99E: PyEval_EvalFrameEx (ceval.c:3880) ==1801== by 0x3AFEEDF99E: PyEval_EvalFrameEx (ceval.c:3880) ==1801== by 0x3AFEEDF99E: PyEval_EvalFrameEx (ceval.c:3880) ==1801== by 0x3AFEEE0466: PyEval_EvalCodeEx (ceval.c:3044) ==1801== by 0x3AFEEE0541: PyEval_EvalCode (ceval.c:545) ==1801== by 0x3AFEEFB88B: run_mod (pythonrun.c:1351) ==1801== by 0x3AFEEFB95F: PyRun_FileExFlags (pythonrun.c:1337) ==1801== by 0x3AFEEFCE4B: PyRun_SimpleFileExFlags (pythonrun.c:941) Signed-off-by: Alex Jia <ajia@redhat.com>
* python: Expose blockPeek and memoryPeek in Python bindingOsier Yang2011-12-151-0/+73
| | | | | | | | | | | | | | | | | | | | | | | A simple example to show how to use it: \#! /usr/bin/python import os import sys import libvirt disk = "/var/lib/libvirt/images/test.img" conn = libvirt.open(None) dom = conn.lookupByName('test') mem_contents = dom.memoryPeek(0, 32, libvirt.VIR_MEMORY_VIRTUAL); sys.stdout.write(mem_contents) % python test.py | hexdump 0000000 1660 0209 0000 0000 0000 0000 0000 0000 0000010 0000 0000 0000 0000 d3a0 01d0 0000 0000 0000020
* python: Fix export of virDomainSnapshotListChildrenNamesPeter Krempa2011-12-131-0/+1
| | | | | | | | Commit f2013c9dd1ce468b8620ee35c232a93ef7026fb0 added implementation of virDomainSnapshotListChildrenNames override export, but registration of the newly exported function was not added. *python/libvirt-override.c: - register export of function
* python: Expose binding for virNodeGetMemoryStats()v0.9.8Peter Krempa2011-12-051-0/+48
| | | | | | This patch adds binding for virNodeGetMemoryStats method of libvirtd. Return value is represented as a python dictionary mapping field names to values.
* python: Expose binding for virNodeGetCPUStats()Peter Krempa2011-12-051-0/+47
| | | | | | This patch adds binding for virNodeGetCPUStats method of libvirtd. Return value is represented as a python dictionary mapping field names to values.
* Support virDomain{Set, Get}BlockIoTune in the python APIv0.9.8-rc2v0.9.8-rc1Lei Li2011-11-301-0/+178
| | | | | | | | Python support for both setting and getting block I/O throttle. Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Eric Blake <eblake@redhat.com>
* startupPolicy: Emit event on disk source droppingv0.9.7-rc1Michal Privoznik2011-10-251-0/+53
| | | | | | | | | | If a disk source gets dropped because it is not accessible, mgmt application might want to be informed about this. Therefore we need to emit an event. The event presented in this patch is however a bit superset of what written above. The reason is simple: an intention to be easily expanded, e.g. on 'user ejected disk in guest' events. Therefore, callback gets source string and disk alias (which should be unique among a domain) and reason (an integer);
* snapshot: new virDomainSnapshotListChildrenNames APIEric Blake2011-10-101-0/+45
| | | | | | | | | | | | | | | | | | | | | | The previous API addition allowed traversal up the hierarchy; this one makes it easier to traverse down the hierarchy. In the python bindings, virDomainSnapshotNumChildren can be generated, but virDomainSnapshotListChildrenNames had to copy from the hand-written example of virDomainSnapshotListNames. * include/libvirt/libvirt.h.in (virDomainSnapshotNumChildren) (virDomainSnapshotListChildrenNames): New prototypes. (VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS): New flag alias. * src/libvirt.c (virDomainSnapshotNumChildren) (virDomainSnapshotListChildrenNames): New functions. * src/libvirt_public.syms: Export them. * src/driver.h (virDrvDomainSnapshotNumChildren) (virDrvDomainSnapshotListChildrenNames): New callbacks. * python/generator.py (skip_impl, nameFixup): Update lists. * python/libvirt-override-api.xml: Likewise. * python/libvirt-override.c (libvirt_virDomainSnapshotListChildrenNames): New wrapper function.
* latency: Expose the new API for Python bindingv0.9.5-rc1Osier Yang2011-09-061-0/+85
|
* Add public API for getting migration speedJim Fehlig2011-09-011-0/+24
| | | | | | | | | Includes impl of python binding since the generator was not able to cope. Note: Requires gendispatch.pl patch from Matthias Bolte https://www.redhat.com/archives/libvir-list/2011-August/msg01367.html
* python: avoid unlikely sign extension bugv0.9.4Eric Blake2011-08-021-1/+1
| | | | | | | Detected by Coverity; same analysis as for commit f73198df. * python/libvirt-override.c (libvirt_virDomainGetVcpuPinInfo): Use correct type.
* python: add python binding for virDomainSetMemoryParametersHu Tao2011-07-281-3/+91
|
* python: add python binding for virDomainGetMemoryParametersHu Tao2011-07-281-3/+76
|
* python: add python binding for virDomainSetBlkioParametersHu Tao2011-07-281-3/+91
|
* python: add python binding for virDomainGetBlkioParametersHu Tao2011-07-281-3/+76
|
* send-key: Implement Python APILai Jiangshan2011-07-271-0/+48
| | | | Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
* python: Properly report errors if virStreamRecv failsCole Robinson2011-07-261-1/+3
| | | | | We only want to raise the special value -2. -1 should return None which tells the bindings to throw an exception.
* python: Handle embedded NUL in stream.send datav0.9.4-rc1Cole Robinson2011-07-251-2/+3
| | | | Otherwise things like volume upload are only useful with text data.
* python: add Python binding for virDomainGetVcpuPinInfo APITaku Izumi2011-07-251-0/+69
| | | | | | | This patch adds the Python bindings for virDomainGetVcpuPinInfo API. * python/generator.py: add it to generator skip list * python/libvirt-override-api.xml: provide an override description * python/libvirt-override.c: provide an override binding implementation
* python: add Python binding for virDomainPinVcpusFlags APITaku Izumi2011-07-251-0/+48
| | | | | | | This patch adds the Python bindings for virDomainPinVcpuFlags API. * python/generator.py: add it to the generator skip list * python/libvirt-override-api.xml: provide override description * python/libvirt-override.c: provide override bindings implementation
* python: add Python binding for virDomainGetSchedulerParametersFlags APITaku Izumi2011-07-251-0/+96
| | | | | This patch adds the Python bindings for virDomainGetSchedulerParametersFlags API.
* python: add Python binding for virDomainGetSchedulerParametersFlags APITaku Izumi2011-07-251-0/+83
| | | | | | | This patch adds the Python bindings for virDomainGetSchedulerParametersFlags API. * python/libvirt-override-api.xml: provide and override description * python/libvirt-override.c: implement the bindings
* Asynchronous event for BlockJob completionAdam Litke2011-07-221-0/+52
| | | | | | | | | | | | | | | | | | | | When an operation started by virDomainBlockPull completes (either with success or with failure), raise an event to indicate the final status. This API allow users to avoid polling on virDomainGetBlockJobInfo if they would prefer to use an event mechanism. * daemon/remote.c: Dispatch events to client * include/libvirt/libvirt.h.in: Define event ID and callback signature * src/conf/domain_event.c, src/conf/domain_event.h, src/libvirt_private.syms: Extend API to handle the new event * src/qemu/qemu_driver.c: Connect to the QEMU monitor event for block_stream completion and emit a libvirt block pull event * src/remote/remote_driver.c: Receive and dispatch events to application * src/remote/remote_protocol.x: Wire protocol definition for the event * src/remote_protocol-structs: structure definitions for protocol verification * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_json.c: Watch for BLOCK_STREAM_COMPLETED event from QEMU monitor
* Enable virDomainBlockPull in the python APIAdam Litke2011-07-221-0/+39
| | | | | | | | | virDomainGetBlockJobInfo requires manual override since it returns a custom type. * python/generator.py: reenable bindings for this entry point * python/libvirt-override-api.xml python/libvirt-override.c: manual overrides
* python: prefer unsigned flagsEric Blake2011-07-131-3/+3
| | | | | | * python/libvirt-override.c (libvirt_virConnectOpenAuth) (libvirt_virDomainSnapshotListNames) (libvirt_virDomainRevertToSnapshot): Change flags type.
* python: Fix bogus label placementMatthias Bolte2011-07-071-5/+3
|
* Revert "Enable virDomainBlockPull in the python API."Eric Blake2011-06-241-53/+0
| | | | | | | | This reverts commit d74b86f5d6ecae3d18a391f90a918fcac75914db. Conflicts: python/generator.py