summaryrefslogtreecommitdiffstats
path: root/libvirt-override.c
Commit message (Collapse)AuthorAgeFilesLines
* Add VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED eventJiri Denemark2013-07-181-1/+51
|
* Introduce new domain create APIs to pass pre-opened FDs to LXCDaniel P. Berrange2013-07-181-0/+89
| | | | | | | | | | | | | | | | | | | | With container based virt, it is useful to be able to pass pre-opened file descriptors to the container init process. This allows for containers to be auto-activated from incoming socket connections, passing the active socket into the container. To do this, introduce a pair of new APIs, virDomainCreateXMLWithFiles and virDomainCreateWithFiles, which accept an array of file descriptors. For the LXC driver, UNIX file descriptor passing will be used to send them to libvirtd, which will them pass them down to libvirt_lxc, which will then pass them to the container init process. This will only be implemented for LXC right now, but the design is generic enough it could work with other hypervisors, hence I suggest adding this to libvirt.so, rather than libvirt-lxc.so Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* python: return dictionary without value in case of no blockjobCVE-2013-4154CVE-2013-4153Guannan Ren2013-07-151-15/+39
| | | | | | | | | | | | | | Currently, when there is no blockjob, dom.blockJobInfo('vda') still reports error because it doesn't distinguish return value 0 from -1. libvirt.libvirtError: virDomainGetBlockJobInfo() failed virDomainGetBlockJobInfo() API return value: -1 in case of failure, 0 when nothing found, 1 found. And use PyDict_SetItemString instead of PyDict_SetItem when key is of string type. PyDict_SetItemString increments key/value reference count, so call Py_DECREF() for value. For key, we don't need to do this, because PyDict_SetItemString will handle it internally.
* Convert 'int i' to 'size_t i' in python/ filesDaniel P. Berrange2013-07-101-44/+70
| | | | | | | | | Convert the type of loop iterators named 'i', 'j', k', 'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or 'unsigned int', also santizing 'ii', 'jj', 'kk' to use the normal 'i', 'j', 'k' naming Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* viralloc: Report OOM error on failureCVE-2013-2230Michal Privoznik2013-07-101-51/+51
| | | | | Similarly to VIR_STRDUP, we want the OOM error to be reported in VIR_ALLOC and friends.
* python: Add bindings for extensible migration APIsv1.1.0-rc2v1.1.0-rc1v1.1.0CVE-2013-2218Jiri Denemark2013-06-251-0/+218
| | | | | The patch implements wrappers for virDomainMigrate3 and virDomainMigrateToURI3.
* syntax: prefer space after semicolon in for loopv1.0.6-rc2v1.0.6Eric Blake2013-05-281-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | I noticed several unusual spacings in for loops, and decided to fix them up. See the next commit for the syntax check that found all of these. * examples/domsuspend/suspend.c (main): Fix spacing. * python/libvirt-override.c: Likewise. * src/conf/interface_conf.c: Likewise. * src/security/virt-aa-helper.c: Likewise. * src/util/virconf.c: Likewise. * src/util/virhook.c: Likewise. * src/util/virlog.c: Likewise. * src/util/virsocketaddr.c: Likewise. * src/util/virsysinfo.c: Likewise. * src/util/viruuid.c: Likewise. * src/vbox/vbox_tmpl.c: Likewise. * src/xen/xen_hypervisor.c: Likewise. * tools/virsh-domain-monitor.c (vshDomainStateToString): Drop default case, to let compiler check us. * tools/virsh-domain.c (vshDomainVcpuStateToString): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* python: Remove the whitespace before ";"v1.0.6-rc1Osier Yang2013-05-211-8/+8
|
* Fix build of python bindings on Python 2.4CVE-2013-1962Daniel P. Berrange2013-05-091-0/+4
| | | | | | | The PyDict_Next method on Python <= 2.4 used 'int' instead of "Py_ssize_t" for the 'pos' parameter Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* virutil: Move string related functions to virstring.cMichal Privoznik2013-05-021-0/+1
| | | | | | | | The source code base needs to be adapted as well. Some files include virutil.h just for the string related functions (here, the include is substituted to match the new file), some include virutil.h without any need (here, the include is removed), and some require both.
* docs: fix usage of 'onto'v1.0.5-rc1v1.0.5Eric Blake2013-04-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | http://www.uhv.edu/ac/newsletters/writing/grammartip2009.07.01.htm (and several other sites) give hints that 'onto' is best used if you can also add 'up' just before it and still make sense. In many cases in the code base, we really want the two-word form, or even a simplification to just 'on' or 'to'. * docs/hacking.html.in: Use correct 'on to'. * python/libvirt-override.c: Likewise. * src/lxc/lxc_controller.c: Likewise. * src/util/virpci.c: Likewise. * daemon/THREADS.txt: Use simpler 'on'. * docs/formatdomain.html.in: Better usage. * docs/internals/rpc.html.in: Likewise. * src/conf/domain_event.c: Likewise. * src/rpc/virnetclient.c: Likewise. * tests/qemumonitortestutils.c: Likewise. * HACKING: Regenerate. Signed-off-by: Eric Blake <eblake@redhat.com>
* syntax-check: Only allows to include public headers in external toolsOsier Yang2013-04-181-2/+2
| | | | | | With this patch, include public headers in "" form is only allowed for "internal.h". And only the external tools (examples|tools|python |include/libvirt) can include the public headers in <> form.
* python: Fix emulatorpin API bindingsPeter Krempa2013-03-211-0/+118
| | | | | | | | | | The addition of emulator pinning APIs didn't think of doing the right job with python APIs for them. The default generator produced unusable code for this. This patch switches to proper code as in the case of domain Vcpu pining. This change can be classified as a python API-breaker but in the state the code was before I doubt anyone was able to use it successfully.
* python: Implement virDomainMigrateGetCompressionCache wrapperv1.0.3-rc2v1.0.3-rc1Jiri Denemark2013-02-221-0/+28
|
* python: Implement virDomainGetJobStats wrapperJiri Denemark2013-02-221-0/+42
|
* Introduce virTypedParamsClear public APIv1.0.2-rc1Jiri Denemark2013-01-181-39/+20
| | | | | The function is just a renamed public version of former virTypedParameterArrayClear.
* python: Avoid freeing uninitialized new_params pointerJiri Denemark2013-01-171-7/+7
|
* Rename util.{c,h} to virutil.{c,h}Daniel P. Berrange2012-12-211-1/+1
|
* Rename memory.{c,h} to viralloc.{c,h}Daniel P. Berrange2012-12-211-1/+1
|
* Fix the indentionv1.0.1-rc2v1.0.1-rc1v1.0.1Osier Yang2012-12-041-1/+1
| | | | | Introduced by commit 1465876a, pushed under build-breaker && trivial rule.
* Bind connection close callback APIs to python bindingDaniel P. Berrange2012-12-041-0/+107
| | | | | | | | | Add code in the python binding to cope with the new APIs virConnectRegisterCloseCallback and virConnectUnregisterCloseCallback. Also demonstrate their use in the python domain events demo Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* python: Use virNodeGetCPUMap where possibleCVE-2012-3411Viktor Mihajlovski2012-11-151-35/+52
| | | | | | | | | Modified the places where virNodeGetInfo was used for the purpose of obtaining the maximum node CPU number. Transparently falling back to virNodeGetInfo in case of failure. Wrote a utility function getPyNodeCPUCount for that purpose. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
* Remove spurious whitespace between function name & open bracketsDaniel P. Berrange2012-11-021-18/+18
| | | | | | | | The libvirt coding standard is to use 'function(...args...)' instead of 'function (...args...)'. A non-trivial number of places did not follow this rule and are fixed in this patch. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* maint: consistent whitespace after 'if'v1.0.0-rc3v1.0.0-rc2v1.0.0Eric Blake2012-10-251-27/+27
| | | | | | Noticed during the review of the previous patch. * python/libvirt-override.c: Use space between 'if ('.
* virNodeGetCPUMap: Add python bindingViktor Mihajlovski2012-10-251-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a method getCPUMap to virConnect. It can be used as follows: import libvirt import sys import os conn = libvirt.openReadOnly(None) if conn == None: print 'Failed to open connection to the hypervisor' sys.exit(1) try: (cpus, cpumap, online) = conn.getCPUMap(0) except: print 'Failed to extract the node cpu map information' sys.exit(1) print 'CPUs total %d, online %d' % (cpus, online) print 'CPU map %s' % str(cpumap) del conn print "OK" sys.exit(0) Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> Signed-off-by: Eric Blake <eblake@redhat.com>
* Add support for SUSPEND_DISK eventMartin Kletzander2012-10-151-0/+50
| | | | | | | | | This patch adds support for SUSPEND_DISK event; both lifecycle and separated. The support is added for QEMU, machines are changed to PMSUSPENDED, but as QEMU sends SHUTDOWN afterwards, the state changes to shut-off. This and much more needs to be done in order for libvirt to work with transient devices, wake-ups etc. This patch is not aiming for that functionality.
* python: cleanup vcpu related binding APIsGuannan Ren2012-10-081-42/+121
| | | | | | | | | | | | | | | | libvirt_virDomainGetVcpus: add error handling, return -1 instead of None libvirt_virDomainPinVcpu and libvirt_virDomainPinVcpuFlags: check the type of argument make use of libvirt_boolUnwrap Set bitmap according to these values which are contained in given argument of vcpu tuple and turn off these bit corresponding to missing vcpus in argument tuple The original way ignored the error info from PyTuple_GetItem if index is out of range. "IndexError: tuple index out of range" The error message will only be raised on next command in interactive mode.
* node_memory: Expose the APIs to Python bindingsv0.10.2-rc2v0.10.2-rc1v0.10.2Osier Yang2012-09-171-0/+125
| | | | | | * python/libvirt-override-api.xml: (Add document to describe the APIs). * python/libvirt-override.c: (Implement the API wrappers manually)
* list: Expose virConnectListAllSecrets to Python bindingOsier Yang2012-09-171-0/+48
| | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: Implementation for listAllSecrets. python/libvirt-override.c: Implementation for the wrapper.
* list: Expose virConnectListAllNWFilters to Python bindingOsier Yang2012-09-171-0/+48
| | | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: * Implementation for listAllNWFilters. python/libvirt-override.c: Implementation for the wrapper.
* list: Expose virConnectListAllNodeDevices to Python bindingOsier Yang2012-09-171-0/+48
| | | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: * Implementation for listAllNodeDevices. python/libvirt-override.c: Implementation for the wrapper.
* list: Expose virConnectListAllInterfaces to Python bindingCVE-2012-4423Osier Yang2012-09-121-0/+48
| | | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: * New file, includes implementation of listAllInterfaces. python/libvirt-override.c: Implementation for the wrapper.
* python: Initialize new_params in virDomainSetSchedulerParametersFederico Simoncelli2012-09-111-1/+1
| | | | | | | | The new_params variable must be initialized in case the virDomainGetSchedulerParameters call fails and we hit the cleanup section before actually allocating the new parameters. Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
* Check against python None type when filling in auth parametersDaniel P. Berrange2012-09-111-1/+2
| | | | | | | | When deciding whether to provide an auth function callback in openAuth(), credcb was checked against NULL, when it really needs to be checked against Py_None Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Print any exception that occurs in authentication callbackDaniel P. Berrange2012-09-111-1/+3
| | | | | | | | | If an exception occurs in the python callback for openAuth() the stack trace isn't seen by the apps, since this code is called from libvirt context. To aid diagnostics, print the error to stderr at least Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix crash passing an empty list to python openAuth() APIDaniel P. Berrange2012-09-111-0/+1
| | | | | | | | | If passing a 'credtype' parameter which was an empty list to the python openAuth() API, the 'credtype' field in the virConnectAuth struct would not be initialized. This lead to a crash when later trying to free that field. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* list: Expose virConnectListAllNetworks to Python bindingOsier Yang2012-09-111-0/+48
| | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: Implement listAllNetworks. python/libvirt-override.c: Implementation for the wrapper.
* list: Expose virStoragePoolListAllVolumes to Python bindingOsier Yang2012-09-101-0/+50
| | | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virStoragePool.py: * New file, includes implementation of listAllVolumes. python/libvirt-override.c: Implementation for the wrapper.
* Fix PMSuspend and PMWakeup eventsJiri Denemark2012-09-071-2/+2
| | | | | | The unused reason parameter of PM{Suspend,Wakeup} event callbacks was completely ignored in lot of places and those events were not actually working at all.
* python: Expose virStorageListAllStoragePools to python bindingOsier Yang2012-09-061-0/+47
| | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: Add listAllStoragePools python/libvirt-override.c: Implementation for the wrapper.
* python: don't mask libvirt errorsEric Blake2012-08-311-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | A user reported this crash when using python bindings: File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 134, in trigger hook.trigger(event) File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 33, in trigger self.handlers[event]() File "/home/nox/workspace/NOX/hooks/volatility.py", line 81, in memory_dump for block in Memory(self.ctx): File "/home/see/workspace/NOX/src/NOX/lib/libtools.py", line 179, in next libvirt.VIR_MEMORY_PHYSICAL) File "/usr/lib/python2.7/dist-packages/libvirt.py", line 1759, in memoryPeek ret = libvirtmod.virDomainMemoryPeek(self._o, start, size, flags) SystemError: error return without exception set In the python bindings, returning NULL makes python think an exception was thrown, while returning the None object lets the wrappers know that a libvirt error exists. Reported by Nox DaFox, fix suggested by Dan Berrange. * python/libvirt-override.c (libvirt_virDomainBlockPeek) (libvirt_virDomainMemoryPeek): Return python's None object, so wrapper knows to check libvirt error.
* 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".