1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-01 00:21:59 +03:00
Commit Graph

689 Commits

Author SHA1 Message Date
a0f4320091 Post-release version bump to 1.3.2
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-18 15:04:20 +01:00
53a5e24aee Version bump to 1.3.1
For release but no change from 1.3.0
v1.3.1
2016-01-17 10:49:23 +08:00
0852ae7430 Post-release version bump to 1.3.0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
v1.3.0
2015-11-24 13:30:35 +01:00
13375783f0 fix crash introduced by commit 1d39dbaf
Some of the libvirt_*Wrap functions steals the reference and we need to
set the item in array to NULL no not free it on success.  Those three
places was accidentally removed by commit 1d39dbaf.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1270977

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
v1.2.21
2015-10-31 02:25:22 +01:00
d5b08f5c19 Post-release version bump to 1.2.21
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-10-15 10:52:38 +02:00
0a9385286a use VIR_PY_DICT_SET_GOTO
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 09:42:44 +02:00
1d39dbaf63 use VYR_PY_LIST_SET_GOTO and VIR_PY_LIST_APPEND_GOTO
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 09:42:23 +02:00
827ed9b4f1 use VIR_PY_TUPLE_GOTO
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 09:41:34 +02:00
a3f842eea1 utils: introduce new macro helpers for tuple, list and dict objects
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 09:41:27 +02:00
706c9dbefe improve usage of cleanup paths
This removes several code duplicates and also some unusual code structures.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 09:40:42 +02:00
3995ec8eda drop unnecessary py_retval variable
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 09:39:02 +02:00
cba2a84bc1 change the order of some statements
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>
2015-10-05 09:37:33 +02:00
8af1c9cb6c Must check return value for all Py*_New functions
If the function fails, we need to cleanup memory and return NULL.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 09:35:38 +02:00
62ad6ff3fc use Py_CLEAR instead of Py_XDECREF followed by NULL assignment
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:50:32 +02:00
b9314f1450 Use VIR_PY_NONE instead of increment and Py_None
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>
2015-10-05 08:50:14 +02:00
29b0c4d9ae Return NULL and set an exception if allocation fails
This is a recommended work-flow for allocation failures and we should
follow it.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:50:00 +02:00
b3449dd5d6 Return correct python object
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>
2015-10-05 08:49:47 +02:00
61411050cb Return NULL if python exception is set
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>
2015-10-05 08:35:52 +02:00
5c74e41c97 wrap lines to 80 columns
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:35:45 +02:00
7178a63e23 fix indentation
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:35:37 +02:00
c982604ef8 indent labels by one space
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:35:30 +02:00
862a94aebf cleanup functions definition
Follow the libvirt hacking guide and make the code consistent.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:35:15 +02:00
a7d71b769d Move utils and shared code into libvirt-utils
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:35:05 +02:00
46b9507905 drop unnecessary goto
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:34:55 +02:00
adeeda2089 remove useless check for NULL before Py_XDECREF
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:34:49 +02:00
448295ed5e refactor the function to not override python exceptions
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:34:40 +02:00
b822286095 update virDomainGetVcpus xml API description
Python api returns a tuple with the vcpus information.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:20:28 +02:00
1d7df3c97c Release of libvirt-python-1.2.20 v1.2.20 2015-10-02 16:17:06 +02:00
3a97b3212d generator: fix build fail with old xml lib
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>
2015-09-21 12:04:59 +02:00
51b841fa5b examples: small fix for nodestats.py example
Add nodestats.py in MANIFEST.in and add a
small description for nodestats.py in README

Signed-off-by: Luyao Huang <lhuang@redhat.com>
v1.2.19
2015-08-26 18:02:44 -04:00
5a6b2c9839 Check return value of PyList_Append
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>
2015-08-03 13:55:54 +02:00
d2c44eb80a Post-release version bump to 1.2.19
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-08-03 13:51:30 +02:00
5037e17b13 Forgot to bump version to 1.2.18 2015-08-03 17:55:14 +08:00
0a59630a34 iothread: Fix crash if virDomainGetIOThreadInfo returns error
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
v1.2.18
2015-07-30 09:32:28 +02:00
fa21f3d927 examples: Introduce nodestats example
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>
2015-07-17 11:42:44 +02:00
9896626b82 virPyDictToTypedParams: packing lists of values
Pack a list or a tuple of values passed to a Python method to the
multi-value parameter.
v1.2.17
2015-06-29 11:41:41 +02:00
7acf1422c5 Revert "Change livbirt version to 1.3.0 for the next release"
This reverts commit 751e016f09.

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.
2015-06-28 11:36:21 +08:00
751e016f09 Change livbirt version to 1.3.0 for the next release
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>
2015-06-16 14:02:56 +02:00
d3e2aff6a7 Provide symbolic names for typed parameters
https://bugzilla.redhat.com/show_bug.cgi?id=1222795

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-06-08 11:28:52 +02:00
cc72783dde Post-release version bump to 1.2.17 2015-06-05 11:35:52 +02:00
1ecf4724dc Include tests in MANIFEST
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>
2015-06-01 10:20:45 +01:00
7211c4aaa3 Fix duplicate entries in AUTHORS
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.
v1.2.16
2015-05-28 14:50:51 -06:00
06e8ea4702 Sort tuples on both items
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
2015-05-20 19:03:04 +02:00
25448b07b1 Simplify sorting
funcs.keys() can't be None, only the empty array
2015-05-20 19:03:02 +02:00
49118f6d95 Sort dictionary keys
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
2015-05-20 19:02:47 +02:00
71c1cdb134 examples: Add example to make guest agent lifecycle event useful
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.
2015-05-11 10:53:06 +02:00
36737505c4 Post-release version bump to 1.2.16 2015-05-11 10:48:51 +02:00
0584ac3f29 libvirt-python: add classifiers to setup.py
Add the Python 3 classifier, needed by the caniusepython3 tool to check
if dependencies of a projects are Python 3 compatible:

    https://caniusepython3.com/
v1.2.15
2015-04-22 16:45:14 +01:00
b98b3f6bf3 Add tox.ini to run tests on Python 2.6, 2.7 & 3.4 2015-04-22 16:45:13 +01:00
4e7a8bd3b3 sanitytest.py parameters are now optional
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.
2015-04-22 16:43:03 +01:00