summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* use VIR_PY_TUPLE_GOTOPavel Hrdina2015-10-051-153/+155
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* utils: introduce new macro helpers for tuple, list and dict objectsPavel Hrdina2015-10-051-0/+82
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* improve usage of cleanup pathsPavel Hrdina2015-10-051-138/+126
| | | | | | This removes several code duplicates and also some unusual code structures. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* drop unnecessary py_retval variablePavel Hrdina2015-10-051-97/+43
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* change the order of some statementsPavel Hrdina2015-10-051-103/+85
| | | | | | | | | | | | This change makes it easier to free allocated object especially for python objects. We can benefit from the fact, that if you call Py_DECREF on any python object it will also remove reference for all assigned object to the root object. For example, calling Py_DECREF on dict will also remove reference recursively on all elements in that dictionary. Our job is then just call Py_DECREF on the root element and don't care about anything else. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Must check return value for all Py*_New functionsPavel Hrdina2015-10-052-97/+196
| | | | | | If the function fails, we need to cleanup memory and return NULL. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* use Py_CLEAR instead of Py_XDECREF followed by NULL assignmentPavel Hrdina2015-10-051-46/+23
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Use VIR_PY_NONE instead of increment and Py_NonePavel Hrdina2015-10-052-42/+21
| | | | | | | To insert Py_None into some other python object like dict or tuple, you need to increase reference to the Py_None. We have a macro to do that. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Return NULL and set an exception if allocation failsPavel Hrdina2015-10-051-22/+31
| | | | | | | This is a recommended work-flow for allocation failures and we should follow it. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Return correct python objectPavel Hrdina2015-10-051-11/+18
| | | | | | | | In case of error without setting an python exception we need to return a correct python object. For functions that returns anything else than a number the return value is 'None', otherwise it's '-1'. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Return NULL if python exception is setPavel Hrdina2015-10-053-87/+64
| | | | | | | There is a rule, python API fails, it also in those cases sets an exception. We should follow those rules and in those cases return NULL. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* wrap lines to 80 columnsPavel Hrdina2015-10-051-53/+95
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* fix indentationPavel Hrdina2015-10-054-108/+96
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* indent labels by one spacePavel Hrdina2015-10-054-60/+60
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* cleanup functions definitionPavel Hrdina2015-10-055-122/+255
| | | | | | Follow the libvirt hacking guide and make the code consistent. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Move utils and shared code into libvirt-utilsPavel Hrdina2015-10-055-427/+457
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* drop unnecessary gotoPavel Hrdina2015-10-051-12/+8
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* remove useless check for NULL before Py_XDECREFPavel Hrdina2015-10-051-6/+3
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* refactor the function to not override python exceptionsPavel Hrdina2015-10-051-16/+8
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* update virDomainGetVcpus xml API descriptionPavel Hrdina2015-10-051-2/+2
| | | | | | Python api returns a tuple with the vcpus information. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Release of libvirt-python-1.2.20v1.2.20Daniel Veillard2015-10-021-1/+1
|
* generator: fix build fail with old xml libLuyao Huang2015-09-211-1/+1
| | | | | | | | | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1222795#c6 if build libvirt-python with some old xml lib (python-pyxml), build will fail and error like this: File "generator.py", line 139, in start if "string" in attrs: File "/usr/local/lib/python2.7/site-packages/_xmlplus/sax/xmlreader.py" \ , line 316, in __getitem__ return self._attrs[name] KeyError: 0 This is an old issue and have been mentioned in commit 3ae0a76d. There is no __contains__ in class AttributesImpl, python will use __getitem__ in this place, so we will get error. Let's use 'YYY in XXX.keys()' to avoid this issue. Signed-off-by: Luyao Huang <lhuang@redhat.com>
* examples: small fix for nodestats.py examplev1.2.19Luyao Huang2015-08-262-0/+4
| | | | | | | Add nodestats.py in MANIFEST.in and add a small description for nodestats.py in README Signed-off-by: Luyao Huang <lhuang@redhat.com>
* Check return value of PyList_AppendJiri Denemark2015-08-031-8/+38
| | | | | | | | | | | libvirt_virDomainGetSecurityLabelList called PyList_Append without checking its return value. While looking at it I noticed the function did not properly check several other return values either so I fixed them all. https://bugzilla.redhat.com/show_bug.cgi?id=1249511 Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* Post-release version bump to 1.2.19Jiri Denemark2015-08-031-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* Forgot to bump version to 1.2.18Daniel Veillard2015-08-031-1/+1
|
* iothread: Fix crash if virDomainGetIOThreadInfo returns errorv1.2.18Peter Krempa2015-07-301-2/+4
| | | | | | | The cleanup portion of libvirt_virDomainGetIOThreadInfo would try to clean the returned structures but the count of iothreads was set to -1. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1248295
* examples: Introduce nodestats exampleMichal Privoznik2015-07-171-0/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So, this is an exercise to show libvirt capabilities. Firstly, for each host NUMA nodes some statistics are printed out, i.e. total memory and free memory. Then, for each running domain, that has memory strictly bound to certain host nodes, a small statistics of how much memory it takes is printed out too. For instance: # ./examples/nodestats.py NUMA stats NUMA nodes: 0 1 2 3 MemTotal: 3950 3967 3937 3943 MemFree: 66 56 42 41 Domain 'fedora': Overall memory: 1536 MiB Domain 'fedora22': Overall memory: 2048 MiB Domain 'fedora21': Overall memory: 1024 MiB nodes 0-1 Node 0: 1024 MiB nodes 0-1 Domain 'gentoo': Overall memory: 4096 MiB nodes 0-3 Node 0: 1024 MiB nodes 0 Node 1: 1024 MiB nodes 1 Node 2: 1024 MiB nodes 2 Node 3: 1024 MiB nodes 3 We can see 4 host NUMA nodes, all of them having roughly 4GB of RAM. Yeah, all of them has nearly all the memory consumed. Then, there are four domains running. For instance, domain 'fedora' has 1.5GB memory which is not pinned onto any specific host NUMA node. Domain 'gentoo' on the other hand has 4GB memory and has 4 NUMA nodes which are pinned 1:1 to host nodes. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* virPyDictToTypedParams: packing lists of valuesv1.2.17Pavel Boldin2015-06-291-99/+129
| | | | | Pack a list or a tuple of values passed to a Python method to the multi-value parameter.
* Revert "Change livbirt version to 1.3.0 for the next release"Martin Kletzander2015-06-281-1/+1
| | | | | | | | This reverts commit 751e016f09a6a0dd372667bdd2b322731718e359. Since Admin API was deferred for a release and the minor version bump didn't happen, it must not happen in libvirt-python either, for compatibility reasons.
* Change livbirt version to 1.3.0 for the next releaseMartin Kletzander2015-06-161-1/+1
| | | | | | | Since the background for Admin API is merged upstream, we are bumping the minor release version as discussed previously Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* Provide symbolic names for typed parametersJiri Denemark2015-06-081-0/+8
| | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1222795 Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* Post-release version bump to 1.2.17Jiri Denemark2015-06-051-1/+1
|
* Include tests in MANIFESTDaniel P. Berrange2015-06-011-0/+2
| | | | | | | The unit tests were missing from the tar.gz archives due to not being listed in the MANIFEST.in file Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix duplicate entries in AUTHORSv1.2.16Jim Fehlig2015-05-282-1/+19
| | | | | | | | The generated AUTHORS file contains many duplicates. If an author has N commits, there will be N entries for the author in AUTHORS. Check if an author already exists in the list before appending. While at it, add a .mailmap (derived from libivrt's .mailmap) to futher tidy the generated AUTHORS list.
* Sort tuples on both itemsGuido Günther2015-05-201-3/+3
| | | | | | | | In order to achieve reproducible builds[0] we want the items within enums always generated in the same order so sort on both items in the tuple. [0] https://wiki.debian.org/ReproducibleBuilds/About
* Simplify sortingGuido Günther2015-05-201-4/+1
| | | | funcs.keys() can't be None, only the empty array
* Sort dictionary keysGuido Günther2015-05-201-4/+4
| | | | | | | In order to achive reproducible builds[0] we want functions and enums always generated in the same order. [0] https://wiki.debian.org/ReproducibleBuilds/About
* examples: Add example to make guest agent lifecycle event usefulPeter Krempa2015-05-114-0/+238
| | | | | | | | | | This example allows to use the guest agent event and metadata to track vCPU count set via the guest agent (agent-based onlining/offlining) and keep it persistent accross domain restarts. The daemon listens for the agent lifecycle event, and if it's received it looks into doman's metadata to see whether a desired count was set and issues the guest agent command.
* Post-release version bump to 1.2.16Peter Krempa2015-05-111-1/+1
|
* libvirt-python: add classifiers to setup.pyv1.2.15Victor Stinner2015-04-221-1/+10
| | | | | | | Add the Python 3 classifier, needed by the caniusepython3 tool to check if dependencies of a projects are Python 3 compatible: https://caniusepython3.com/
* Add tox.ini to run tests on Python 2.6, 2.7 & 3.4Victor Stinner2015-04-223-0/+12
|
* sanitytest.py parameters are now optionalVictor Stinner2015-04-221-5/+18
| | | | | | | When called without parameters, sanitytest.py doesn't touch sys.path and locates itself the patch to the libvirt-api.xml file using pkg-config. This change makes possible to run sanitytest.py from tox.
* Implement the DEVICE_ADDED eventJán Tomko2015-04-153-0/+70
|
* Post-release version bump to 1.2.15Jiri Denemark2015-04-021-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* Expose virDomainInterfacesAddresses to python bindingv1.2.14Pavel Hrdina2015-03-287-0/+199
| | | | | | | | | | | | | | | | | | | | | examples/Makefile.am: * Add new file domipaddrs.py examples/README: * Add documentation for the python example libvirt-override-api.xml: * Add new symbol for virDomainInterfacesAddresses libvirt-override.c: * Hand written python api Example: $ python examples/domipaddrs.py qemu:///system f18 Interface MAC address Protocol Address vnet0 52:54:00:20:70:3d ipv4 192.168.105.240/16 Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Rename virDomainGetIOThreadsInfo to virDomainGetIOThreadInfoJán Tomko2015-03-264-10/+10
|
* Rename virDomainIOThreadsInfoFree to virDomainIOThreadInfoFreeJán Tomko2015-03-263-3/+3
|
* Post-release version bump to 1.2.14Pavel Hrdina2015-03-191-1/+1
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Support virDomainPinIOThreadJohn Ferlan2015-03-113-0/+74
| | | | | | | | | | | | | | | | | | | | | | Support the libvirt_virDomainSetIOThreads method using code that mimics the existing libvirt_virDomainPinVcpuFlags method The following is a sample session assuming guest 'iothr-gst' has IOThreads configured (it's currently running, too) >>> import libvirt >>> con=libvirt.open("qemu:///system") >>> dom=con.lookupByName('iothr-gst') >>> dom.ioThreadsInfo() [(1, [False, False, True, False]), (2, [False, False, False, True]), (3, [True, True, True, True])] >>> cpumap=(True,True,True,False) >>> dom.pinIOThread(3,cpumap) 0 >>> print dom.ioThreadsInfo() [(1, [False, False, True, False]), (2, [False, False, False, True]), (3, [True, True, True, False])] >>> merge