Peter Krempa [Thu, 21 Apr 2016 12:43:29 +0000 (21 14:43 +0200)]
generator.py: Consider symbols from libvirt-common
Some of the libvirt public API was moved into the libvirt-common.h file.
We should consider it while building python too.
Cole Robinson [Wed, 20 Apr 2016 18:47:48 +0000 (20 14:47 -0400)]
spec: Don't pull in dependencies for example scripts
If the scripts are marked as executable, RPM magic will scan them
for dependencies, which can pull in python2 for the python3 package
Pavel Hrdina [Mon, 18 Apr 2016 14:53:50 +0000 (18 16:53 +0200)]
fix crash in getAllDomainStats
Commits
1d39dbaf and
827ed9b4 broke the libvirt-python API by removing
virDomainRef() and virDomainFree(). virDomainStatsRecordListFree() will
free that domain pointer and later when virDomain (python object) call
its destructor and tries to free that same pointer again.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=
1326839
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Peter Krempa [Mon, 18 Apr 2016 10:53:02 +0000 (18 12:53 +0200)]
event: Add support VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED
Peter Krempa [Mon, 18 Apr 2016 11:18:05 +0000 (18 13:18 +0200)]
Post-release version bump to 1.3.4
Daniel Veillard [Wed, 6 Apr 2016 07:30:45 +0000 (6 15:30 +0800)]
Release of libvirt-python-1.3.3
Qiaowei Ren [Wed, 30 Mar 2016 02:13:19 +0000 (30 10:13 +0800)]
python: add python binding for Perf API
This patch adds the python binding for virDomainSetPerfEvents and
virDomainSetPerfEvents API.
Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Jiri Denemark [Tue, 8 Mar 2016 15:47:49 +0000 (8 16:47 +0100)]
Add support for JOB_COMPLETED event
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Pavel Hrdina [Tue, 23 Feb 2016 12:46:45 +0000 (23 13:46 +0100)]
libvirt-override: fix PyArg_ParseTuple for size_t
Format string uses 'n' for Py_ssize_t but size_t is unsigned long, we
need to use 'k'.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Tue, 23 Feb 2016 12:45:36 +0000 (23 13:45 +0100)]
libvirt-override: fix PyArg_ParseTuple for unsigned long long
Format string uses 'L' for long long type and 'K' for unsigned long long
type.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=
1260356
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Tue, 23 Feb 2016 12:42:43 +0000 (23 13:42 +0100)]
libvirt-override: fix PyArg_ParseTuple for unsigned int
Format string uses 'i' for int type and 'I' for unsigned int type.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Tue, 23 Feb 2016 12:47:37 +0000 (23 13:47 +0100)]
libvirt-override: all flags should be defined as unsigned int
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Jiri Denemark [Fri, 15 Jan 2016 09:13:19 +0000 (15 10:13 +0100)]
Add support for MIGRATION_ITERATION event
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Jiri Denemark [Mon, 18 Jan 2016 13:54:10 +0000 (18 14:54 +0100)]
setup: Use cflags and ldflags properly
The setup.py script reads cflags and ldflags from pkg-config and uses
them when compiling/linking C modules. Since both cflags and ldflags may
include multiple compiler arguments we need to split them rather than
concatenating them into a single argument.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Jiri Denemark [Mon, 18 Jan 2016 14:03:55 +0000 (18 15:03 +0100)]
Post-release version bump to 1.3.2
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Daniel Veillard [Sun, 17 Jan 2016 02:49:23 +0000 (17 10:49 +0800)]
Version bump to 1.3.1
For release but no change from 1.3.0
Pavel Hrdina [Tue, 24 Nov 2015 12:30:35 +0000 (24 13:30 +0100)]
Post-release version bump to 1.3.0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Sat, 31 Oct 2015 01:25:22 +0000 (31 02:25 +0100)]
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>
Martin Kletzander [Thu, 15 Oct 2015 08:52:38 +0000 (15 10:52 +0200)]
Post-release version bump to 1.2.21
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Pavel Hrdina [Tue, 22 Sep 2015 14:10:04 +0000 (22 16:10 +0200)]
use VIR_PY_DICT_SET_GOTO
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Mon, 5 Oct 2015 07:42:23 +0000 (5 09:42 +0200)]
use VYR_PY_LIST_SET_GOTO and VIR_PY_LIST_APPEND_GOTO
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Thu, 24 Sep 2015 13:21:53 +0000 (24 15:21 +0200)]
use VIR_PY_TUPLE_GOTO
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Thu, 10 Sep 2015 13:05:28 +0000 (10 15:05 +0200)]
utils: introduce new macro helpers for tuple, list and dict objects
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Mon, 5 Oct 2015 07:40:42 +0000 (5 09:40 +0200)]
improve usage of cleanup paths
This removes several code duplicates and also some unusual code structures.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Mon, 21 Sep 2015 13:56:50 +0000 (21 15:56 +0200)]
drop unnecessary py_retval variable
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Mon, 5 Oct 2015 07:37:33 +0000 (5 09:37 +0200)]
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>
Pavel Hrdina [Tue, 29 Sep 2015 19:59:41 +0000 (29 21:59 +0200)]
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>
Pavel Hrdina [Tue, 22 Sep 2015 14:06:54 +0000 (22 16:06 +0200)]
use Py_CLEAR instead of Py_XDECREF followed by NULL assignment
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Fri, 21 Aug 2015 19:38:45 +0000 (21 12:38 -0700)]
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>
Pavel Hrdina [Thu, 20 Aug 2015 21:03:52 +0000 (20 14:03 -0700)]
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>
Pavel Hrdina [Thu, 20 Aug 2015 20:44:15 +0000 (20 13:44 -0700)]
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>
Pavel Hrdina [Tue, 22 Sep 2015 12:27:42 +0000 (22 14:27 +0200)]
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>
Pavel Hrdina [Thu, 24 Sep 2015 11:03:07 +0000 (24 13:03 +0200)]
wrap lines to 80 columns
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Tue, 22 Sep 2015 08:41:36 +0000 (22 10:41 +0200)]
fix indentation
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Mon, 21 Sep 2015 14:36:30 +0000 (21 16:36 +0200)]
indent labels by one space
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Tue, 29 Sep 2015 14:37:13 +0000 (29 16:37 +0200)]
cleanup functions definition
Follow the libvirt hacking guide and make the code consistent.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Tue, 22 Sep 2015 08:33:57 +0000 (22 10:33 +0200)]
Move utils and shared code into libvirt-utils
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Mon, 21 Sep 2015 14:36:05 +0000 (21 16:36 +0200)]
drop unnecessary goto
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Mon, 21 Sep 2015 13:59:59 +0000 (21 15:59 +0200)]
remove useless check for NULL before Py_XDECREF
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Mon, 21 Sep 2015 14:01:10 +0000 (21 16:01 +0200)]
refactor the function to not override python exceptions
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Thu, 20 Aug 2015 22:15:18 +0000 (20 15:15 -0700)]
update virDomainGetVcpus xml API description
Python api returns a tuple with the vcpus information.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Daniel Veillard [Fri, 2 Oct 2015 14:17:06 +0000 (2 16:17 +0200)]
Release of libvirt-python-1.2.20
Luyao Huang [Wed, 2 Sep 2015 05:58:00 +0000 (2 13:58 +0800)]
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>
Luyao Huang [Fri, 31 Jul 2015 02:19:45 +0000 (31 10:19 +0800)]
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>
Jiri Denemark [Mon, 3 Aug 2015 08:26:26 +0000 (3 10:26 +0200)]
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>
Jiri Denemark [Mon, 3 Aug 2015 11:51:30 +0000 (3 13:51 +0200)]
Post-release version bump to 1.2.19
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Daniel Veillard [Mon, 3 Aug 2015 09:55:14 +0000 (3 17:55 +0800)]
Forgot to bump version to 1.2.18
Peter Krempa [Thu, 30 Jul 2015 07:32:28 +0000 (30 09:32 +0200)]
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
Michal Privoznik [Wed, 24 Jun 2015 15:24:46 +0000 (24 17:24 +0200)]
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>
Pavel Boldin [Tue, 16 Jun 2015 01:39:11 +0000 (16 04:39 +0300)]
virPyDictToTypedParams: packing lists of values
Pack a list or a tuple of values passed to a Python method to the
multi-value parameter.
Martin Kletzander [Fri, 26 Jun 2015 15:42:48 +0000 (26 17:42 +0200)]
Revert "Change livbirt version to 1.3.0 for the next release"
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.
Martin Kletzander [Tue, 16 Jun 2015 11:42:32 +0000 (16 13:42 +0200)]
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>
Jiri Denemark [Fri, 5 Jun 2015 08:17:53 +0000 (5 10:17 +0200)]
Provide symbolic names for typed parameters
https://bugzilla.redhat.com/show_bug.cgi?id=
1222795
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Jiri Denemark [Fri, 5 Jun 2015 09:35:42 +0000 (5 11:35 +0200)]
Post-release version bump to 1.2.17
Daniel P. Berrange [Mon, 1 Jun 2015 09:20:13 +0000 (1 10:20 +0100)]
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>
Jim Fehlig [Mon, 11 May 2015 18:52:15 +0000 (11 12:52 -0600)]
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.
Guido Günther [Mon, 18 May 2015 17:46:13 +0000 (18 19:46 +0200)]
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
Guido Günther [Mon, 18 May 2015 17:43:31 +0000 (18 19:43 +0200)]
Simplify sorting
funcs.keys() can't be None, only the empty array
Guido Günther [Mon, 18 May 2015 17:38:20 +0000 (18 19:38 +0200)]
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
Peter Krempa [Fri, 17 Apr 2015 13:07:15 +0000 (17 15:07 +0200)]
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.
Peter Krempa [Mon, 11 May 2015 08:48:51 +0000 (11 10:48 +0200)]
Post-release version bump to 1.2.16
Victor Stinner [Wed, 22 Apr 2015 14:02:37 +0000 (22 16:02 +0200)]
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/
Victor Stinner [Wed, 22 Apr 2015 13:07:00 +0000 (22 15:07 +0200)]
Add tox.ini to run tests on Python 2.6, 2.7 & 3.4
Victor Stinner [Wed, 22 Apr 2015 13:06:59 +0000 (22 15:06 +0200)]
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.
Ján Tomko [Mon, 30 Mar 2015 18:49:41 +0000 (30 20:49 +0200)]
Implement the DEVICE_ADDED event
Jiri Denemark [Thu, 19 Mar 2015 13:17:35 +0000 (19 14:17 +0100)]
Post-release version bump to 1.2.15
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Pavel Hrdina [Sat, 28 Mar 2015 10:21:56 +0000 (28 11:21 +0100)]
Expose virDomainInterfacesAddresses to python binding
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>
Ján Tomko [Thu, 26 Mar 2015 11:22:13 +0000 (26 12:22 +0100)]
Rename virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo
Ján Tomko [Thu, 26 Mar 2015 11:22:00 +0000 (26 12:22 +0100)]
Rename virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree
Pavel Hrdina [Thu, 19 Mar 2015 13:17:35 +0000 (19 14:17 +0100)]
Post-release version bump to 1.2.14
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
John Ferlan [Thu, 19 Feb 2015 01:27:07 +0000 (18 20:27 -0500)]
Support virDomainPinIOThread
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
John Ferlan [Thu, 19 Feb 2015 01:22:06 +0000 (18 20:22 -0500)]
Support virDomainGetIOThreadsInfo and virDomainIOThreadsInfoFree
Add support for the libvirt_virDomainGetIOThreadsInfo method. This
code mostly follows the libvirt_virDomainGetVcpuPinInfo method, but
also takes some from the libvirt_virNodeGetCPUMap method with respect
to building the cpumap into the returned tuple rather than two separate
tuples which vcpu pinning generates
Assuming two domains, one with IOThreads defined (eg, 'iothr-gst') and
one without ('noiothr-gst'), execute the following in an 'iothr.py' file:
import libvirt
con=libvirt.open("qemu:///system")
dom=con.lookupByName('iothr-gst')
print dom.ioThreadsInfo()
dom2=con.lookupByName('noiothr-gst')
print dom2.ioThreadsInfo()
$ python iothr.py
[(1, [False, False, True, False]), (2, [False, False, False, True]), (3, [True, True, True, True])]
[]
$
Ján Tomko [Thu, 5 Mar 2015 15:08:51 +0000 (5 16:08 +0100)]
Clarify description for virNodeGetSecurityModel
s/host/hypervisor/ to match the wording used by the C binding.
https://bugzilla.redhat.com/show_bug.cgi?id=
1198518
Daniel P. Berrange [Tue, 27 Jan 2015 14:07:10 +0000 (27 14:07 +0000)]
Post-release version bump to 1.2.13
Pavel Hrdina [Mon, 19 Jan 2015 15:16:10 +0000 (19 16:16 +0100)]
sanitytest: fix mapping test for virDomainDefineXMLFlags
The libvirt API has in the name "virDomain" but it's correctly mapped
into "virConnect" class. Create an exception in the sanity test.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Eric Blake [Thu, 15 Jan 2015 02:57:42 +0000 (14 19:57 -0700)]
build: make it easier to backport event ids
In some cases, it is very easy for downstream distros to backport
enum values without requiring a .so bump. Keying the conditional
code off of the upstream version where the enum value was added
is not ideal, because downstream then has to patch that the feature
is available in their build that still reports an earlier version
number. For example, if RHEL 7 backports events from 1.2.11 into
a build based on 1.2.8, building the python bindings would warn:
libvirt-override.c: In function ‘libvirt_virConnectDomainEventRegisterAny’:
libvirt-override.c:6653:5: warning: enumeration value ‘VIR_DOMAIN_EVENT_ID_TUNABLE’ not handled in switch [-Wswitch]
switch ((virDomainEventID) eventID) {
^
libvirt-override.c:6653:5: warning: enumeration value ‘VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE’ not handled in switch [-Wswitch]
The solution is simple - use feature-based probes instead of
version probes. Since we already scrape the XML API document of
whatever libvirt build we are binding, and that XML already
documents any downstream enum additions, we can use those as the
features for gating conditional compilation.
* generator.py (enum): Track event id names.
(buildStubs): Output define wrappers for events.
* libvirt-override.c
(libvirt_virConnectDomainEventBalloonChangeCallback)
(libvirt_virConnectDomainEventPMSuspendDiskCallback)
(libvirt_virConnectDomainEventDeviceRemovedCallback)
(libvirt_virConnectDomainEventTunableCallback)
(libvirt_virConnectDomainEventAgentLifecycleCallback)
(libvirt_virConnectDomainEventRegisterAny): Use them.
Signed-off-by: Eric Blake <eblake@redhat.com>
Michal Privoznik [Tue, 16 Dec 2014 13:09:25 +0000 (16 14:09 +0100)]
Bump version to 1.2.12 for new dev cycle
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Richard W.M. Jones [Thu, 11 Dec 2014 11:16:12 +0000 (11 11:16 +0000)]
Add c_pointer method to classes.
This returns the raw C pointer to the underlying object, eg:
conn = libvirt.open(None)
print "0x%x" % conn.c_pointer() # returns virConnectPtr of the connection
dom = conn.lookupByName("test")
print "0x%x" % dom.c_pointer() # returns virDomainPtr of the domain
The reason behind this is to allow us to transparently pass Python dom
objects through the libguestfs Python API.
https://bugzilla.redhat.com/show_bug.cgi?id=
1075164
Tomoki Sekiyama [Mon, 1 Dec 2014 21:23:56 +0000 (1 16:23 -0500)]
override: iterate virDomainFSInfo.devAliases using ndevAliases
Currently devAliases in virDomainFSInfo struct are iterated as a
NULL-terminated list, but that is not guaranteed. It should use
ndevAliases which stores the number of the items in devAliases.
Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Pavel Hrdina [Wed, 26 Nov 2014 17:47:17 +0000 (26 18:47 +0100)]
fix examples
The dhcpleases example had an old usage of print function. The formating
of leases record was also wrong.
The event-test example had an old usage of exceptions.
It's mainly to make examples compatible with python3.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Peter Krempa [Mon, 24 Nov 2014 15:41:39 +0000 (24 16:41 +0100)]
event: Add bindings for agent lifecycle event
Also add the example.
Tomoki Sekiyama [Sat, 22 Nov 2014 01:28:00 +0000 (22 02:28 +0100)]
override: Implement bindings for virDomainGetFSInfo as domain.fsInfo
Implement the function which returns a list of tuples, that contains members
of virDomainFSInfo struct.
Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Luyao Huang [Fri, 31 Oct 2014 02:02:16 +0000 (31 10:02 +0800)]
Add dict check for setTime and allow pass 'seconds' parameter
When pass None or a empty dictionary to time, it will report
error. This commit allows a one-element dictionary which contains
just 'seconds' field, which results in the same as passing 0 for
'nseconds' field. Moreover, dict is checked for unknown fields.
Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Jiri Denemark [Thu, 6 Nov 2014 09:20:40 +0000 (6 10:20 +0100)]
Check return value of libvirt_uintUnwrap
libvirt_virDomainSendKey didn't check whether libvirt_uintUnwrap
succeeded or not.
https://bugzilla.redhat.com/show_bug.cgi?id=
1161039
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
John Ferlan [Mon, 3 Nov 2014 15:41:27 +0000 (3 10:41 -0500)]
Bump version to 1.2.11 for new dev cycle
Dmitry Guryanov [Tue, 28 Oct 2014 17:29:58 +0000 (28 20:29 +0300)]
fix libvirt headers list
Since libvirt.h has been split out, generator.py
should be fixed accordingly. So add full list of header
files.
Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
Pavel Hrdina [Wed, 22 Oct 2014 11:38:55 +0000 (22 13:38 +0200)]
virDomainBlockCopy: initialize flags to 0
An optional argument if not passed isn't modified by the
PyArg_ParseTuple function.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Wed, 22 Oct 2014 09:10:54 +0000 (22 11:10 +0200)]
flags cannot get right value for blockCopy function
When use blockCopy, flags cannot get a right value, because
PyArg_ParseTuple want to get 6 parameters and blockCopy only
pass 5. Flags will get a unpredictable value, this will make
the function fail with error:
unsupported flags (0x7f6c) in function qemuDomainBlockCopy
Signed-off-by: Luyao Huang <lhuang@redhat.com>
Peter Krempa [Tue, 21 Oct 2014 14:06:41 +0000 (21 16:06 +0200)]
Fix rest of unsigned integer handling
As in the previous patch, fix all places where 'flags' is converted as a
signed argument to unsigned including the python code generator.
Luyao Huang [Tue, 21 Oct 2014 09:04:41 +0000 (21 17:04 +0800)]
Fix parsing of 'flags' argument for bulk stats functions
When 'flags' is set to
'libvirt.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS,
python will report a error:
OverflowError: signed integer is greater than maximum
as VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS is defined as 1<<31.
This happens as PyArg_ParseTuple's formatting string containing 'i' as a
modifier expects a signed integer.
With python >= 2.3, 'I' means unsigned int and 'i' means int so we
should use 'I' in the formatting string.
See: https://docs.python.org/2/c-api/arg.html
Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Peter Krempa [Tue, 21 Oct 2014 13:59:21 +0000 (21 15:59 +0200)]
Fix function name when parsing arguments in libvirt_virNodeAllocPages
The override function was copied&pasted from virConnectGetAllDomainStats
and the function name after the colon was not changed. Fix the issue as
an invalid name would appear in the error message.
Luyao Huang [Mon, 20 Oct 2014 13:55:00 +0000 (20 15:55 +0200)]
Improve error output when use getTime with a nonzero flags.
When give a nonzero flags to getTime, c_retval will get -1 and goto
cleanup. But py_retval still is NULL, so set py_retval = VIR_PY_NONE.
This will make the output message more correct.
Signed-off-by: Luyao Huang <lhuang@redhat.com>
Pradipta Kr. Banerjee [Wed, 15 Oct 2014 13:54:00 +0000 (15 15:54 +0200)]
Change the comment in getPyNodeCPUCount method reflecting correct called methods
Comment mentions virGetNodeCPUMap whereas the actual method is
virNodeGetCPUMap. Similarly comment mentions virGetNodeInfo whereas the actual
method is virNodeGetInfo
Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com>
Pavel Hrdina [Tue, 7 Oct 2014 09:54:15 +0000 (7 11:54 +0200)]
setup.py: fix rpm build to return 1 on error
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Martin Kletzander [Tue, 7 Oct 2014 08:35:10 +0000 (7 10:35 +0200)]
sanitytest: define long for python version >= 3
Commit
c58c7f362aab37e4961407c2efc8a74925ed9c37 fixed 32-bit python
build but broke build with python3 due to the lack of 'long' in the
newer version of python. This patch aims to fix it with a simple
string comparison of sys.version and '3'.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Martin Kletzander [Tue, 7 Oct 2014 08:08:38 +0000 (7 10:08 +0200)]
sanitytest: count with the fact that large enums can be long
On 32-bit systems, one new flag that has the value of 1 << 31, namely
VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, fails to fit into an
'int' on python and is therefore of type 'long'. Fix sanitytest to
count with such fact in order to avoid build failures on 32-bit systems.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Martin Kletzander [Mon, 6 Oct 2014 10:26:27 +0000 (6 12:26 +0200)]
sanitytest: check for exported enums
We are already collecting list of enums exported and list of enums we
want to have available. Event though there was an issue with one enum
fixed with
014d9bbaf368b33a881f1d6b2fd8a5dd285a4f71, there was no test
for it and this commit tries to fix that.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Pavel Hrdina [Thu, 2 Oct 2014 12:55:21 +0000 (2 14:55 +0200)]
Post-release version bump for new dev cycle
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pavel Hrdina [Tue, 30 Sep 2014 15:52:29 +0000 (30 17:52 +0200)]
implement new tunable event
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=
1147639
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Michal Privoznik [Thu, 25 Sep 2014 15:02:49 +0000 (25 17:02 +0200)]
Implement new virNodeAllocPages API
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>