1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-12-14 04:23:47 +03:00
Commit Graph

1162 Commits

Author SHA1 Message Date
Pavel Hrdina
b3f1a3adb0 Fix virPyDictToTypedParams type hint for block copy params
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-02-19 15:55:51 +01:00
Pavel Hrdina
7c43a863e9 Add missing virPyDictToTypedParams hint for migration params
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-02-19 15:55:48 +01:00
Pavel Hrdina
1d8852d9c4 Fix order of virPyDictToTypedParams hints
This corresponds to the order in libvirt-domain.h header file.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-02-19 15:55:45 +01:00
Pavel Hrdina
920be92397 Use static variables to store virPyDictToTypedParams hints
There is no need to have dynamic allocation every time the API
is called.  Rewrites commit <314b2346df>.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-02-19 15:55:28 +01:00
Edgar Kaziakhmedov
314b2346df Set hints for virPyDictToTypedParams
Predefine hints for all parameters possible to avoid wrong type
convert.

Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
2018-02-19 13:07:07 +00:00
Daniel P. Berrangé
b68b3ef399 tests: add special case for virStoragePoolLookupByTargetPath
This new API trips up the sanity test for checking mapping of
all C APIs into Python.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-09 13:54:47 +00:00
Jiri Denemark
324197bfaa event-test.py: Remove extra ( in --help output
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2018-02-06 11:58:42 +01:00
Daniel Veillard
99ee8a153c Release of libvirt-python-4.0.0 v4.0.0 2018-01-19 12:13:29 +01:00
Daniel P. Berrange
6a9905cc97 Use python*_sitearch macros instead of manually defining the dir
Note we use python_sitearch not python2_sitearch, since the former
is more portable.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2018-01-12 18:16:01 +00:00
Daniel P. Berrange
7cb4a80387 Fix filtering of RPM provides for .so files
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2018-01-12 18:15:57 +00:00
Daniel P. Berrange
948d77335e Require libvirt native version matching py version by default
Although we're capable of building against any libvirt >= 0.9.11, 99% of the
time we want RPM builds to be done against matching libvirt version, otherwise
we might silently build against an unexpected/wrong version.

We don't support building against a native libvirt that's newer than the
python binding, since the generator may incorrectly handle new APIs. So use
== instead of >= too.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2018-01-12 18:15:54 +00:00
Daniel P. Berrange
d11f4e4199 Turn on python3 sub-RPMs for RHEL > 7
It is expected that future RHEL-8 will have python3 by default, so enable that.
It is unclear whether python2 will still be available, so leave that enabled
for now.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2018-01-12 18:15:52 +00:00
Daniel P. Berrange
8dfa907b2f Adapt to rename of py2 RPMs from python- to python2- prefix
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2018-01-12 18:15:50 +00:00
Daniel P. Berrange
53a6d49660 Add emacs mode marker to activate rpm-spec highlighting
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2018-01-12 18:15:49 +00:00
Daniel P. Berrange
f6ea01496a Add checks for min supported distros
Be clear about which distros we aim to support with the specfile, so we know
what we can cleanup in the spec later.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2018-01-12 18:15:45 +00:00
Daniel P. Berrange
7cde26caa9 Allow override of which sub-RPMs to build
Allow using

  rpmbuild --define "with_python2 0"

to override the default logic about which python sub-RPMs to build

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2018-01-12 18:15:43 +00:00
Daniel P. Berrange
ba234bd831 Allow disabling of python2 RPM build
With Fedora modularity, it is possible to have add-on repos for multiple
versions of python3. It is thus desirable to be able to build libvirt-python
in these repos, with only the python3 sub-RPMs enabled.

Thus also helps if future RHEL/Fedora drop python2 entirely from their default
repos.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2018-01-12 18:15:27 +00:00
Peng Hao
85c371bd26 libvirt-python : PyObject memory leak
libvirt_virConnectDomainEventTunableCallback leak a PyObject.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
2017-12-11 13:32:28 +01:00
Daniel Veillard
349951fc5e Release of libvirt-python 3.10.0 v3.10.0 2017-12-04 18:48:02 +01:00
Cédric Bosdonnat
bedc937cce Don't hardcode interpreter path
This is particularly useful on operating systems that don't ship
Python as part of the base system (eg. FreeBSD) while still working
just as well as it did before on Linux.

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
2017-11-30 08:48:36 +01:00
Daniel Veillard
8018f0aa7e Release of libvirt-python-3.9.0 v3.9.0 2017-11-02 18:00:45 +01:00
Nir Soffer
9a93051c16 Unify whitespace around *_ALLOW_THREADS macros
Most of the code treats libvirt API calls as separate block, keeping one
blank line before the LIBVIRT_BEGIN_ALLOW_THREAD, and one blank line
after LIBVIRT_END_ALLOW_THREADS. Unify the whitespace so all calls
wrapped with these macros are treated as a separate block.
v3.8.0
2017-09-29 10:49:32 +01:00
Nir Soffer
7af7450b0a Release the GIL during virDomainGetMemoryStats & virDomainGetDiskErrors
We discovered that the entire python process get stuck for about 30
seconds when calling virDomain.getMemoryStats() if libvirt is stuck in
virConnect.getAllDomainStats() on inaccessible storage. This blocking
cause a horrible mess in oVirt.

This patches adds the standard *_ALLOW_THREADS around the call to avoid
this unwanted blocking.

Signed-off-by: Nir Soffer <nirsof@gmail.com>
2017-09-27 16:07:13 +01:00
Daniel P. Berrange
ac8faf417e Avoid implicit treatment of an arithmetic result as a boolean
Latest GCC versions are unhappy with us treating an integer
arithmetic result as a boolean:

libvirt-utils.c: In function ‘virReallocN’:
libvirt-utils.c:111:23: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
     if (!tmp && (size * count)) {
                 ~~~~~~^~~~~~~~

Add an explicit comparison '!= 0' to keep it happy, since its
suggestion to use '&&' is nonsense.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-26 11:14:03 +01:00
Daniel P. Berrange
75ec2acb61 Fix comparisons between signed & unsigned integers
When python3 builds C modules, it adds the -Wsign-compare flag to GCC.
This creates lots of warnings where we compare a 'size_t' value against
an 'int' value due to signed/unsigned difference.  Change all the size_t
types to ssize_t to address this.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-26 11:12:18 +01:00
Wojtek Porczyk
f70939fc3e libvirtaio: add .drain() coroutine
The intended use is to ensure that the implementation is empty, which is
one way to ensure that all connections were properly closed and file
descriptors reclaimed.

Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
2017-09-26 11:01:33 +01:00
Wojtek Porczyk
7f1994ff46 libvirtaio: keep track of the current implementation
Since 7534c19 it is not possible to register event implementation twice.
Instead, allow for retrieving the current one, should it be needed
afterwards.

Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
2017-09-26 11:01:33 +01:00
Wojtek Porczyk
fc482fc868 libvirtaio: fix closing of the objects
- Descriptor.close() was a dead code, never used.
- TimeoutCallback.close(), as a cleanup function, should have called
    super() as last statement, not first

Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
2017-09-26 11:01:33 +01:00
Wojtek Porczyk
cc82a94528 libvirtaio: do not double-add callbacks
This was a harmless bug, without any impact, but it is wrong to manage
the collection of callbacks from it's members.

Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
2017-09-26 11:01:33 +01:00
Wojtek Porczyk
a5cc6da2c8 libvirtaio: cache the list of callbacks when calling
When the callback causes something that results in changes wrt
registered handles, python aborts iteration.

Relevant error message:

    Exception in callback None()
    handle: <Handle cancelled>
    Traceback (most recent call last):
      File "/usr/lib64/python3.5/asyncio/events.py", line 126, in _run
        self._callback(*self._args)
      File "/usr/lib64/python3.5/site-packages/libvirtaio.py", line 99, in _handle
        for callback in self.callbacks.values():
    RuntimeError: dictionary changed size during iteration

QubesOS/qubes-issues#2805
Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
2017-09-26 11:01:33 +01:00
Wojtek Porczyk
f7e5a9a085 libvirtaio: add more debug logging
This logging is helpful for tracing problems with unclosed connections
and leaking file descriptors.

Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
2017-09-26 11:01:33 +01:00
Daniel P. Berrange
6ee87778ab Add travis build config
Enable builds on several python versions, and against several versions
of libvirt. Ideally we would build all the way back to 0.9.11, since
that is the min supported libvirt for python binding. It is not possible
to build this old libvirt version on modern distros though, so using
1.2.0 as the oldest for now.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-19 16:11:23 +01:00
Daniel P. Berrange
13b4283d58 Skip sparseRecvAll / sparseSendAll in sanity test
The sanity test check aims to ensure that every function listed in
the Python code maps to a corresponding C function. The Sparse
send/recv methods are special though - we're never calling the
corresponding C APIs, instead we have a pure python impl.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-18 12:59:42 +01:00
Daniel P. Berrange
c1a8c6c105 Post-release version bump to 3.8.0
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-06 11:48:09 +01:00
Daniel P. Berrange
7534c19a71 Report an error if registering an event loop twice
The C library will now ignore an attempt to register an event
loop twice. It is unable to report an error in this case though
due to the C API returning 'void'. To improve this we must
manually report an error at the python level.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-06 11:47:11 +01:00
Daniel P. Berrange
57a160b524 Remove unused variables for event callbacks
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-06 11:47:02 +01:00
Daniel P. Berrange
abce5971b2 Change Obsoletes to an explicit version
We only want to obsolete versions which actually had the
original name, not all future versions.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-04 13:13:53 +01:00
Daniel Veillard
4ed61cae8f Release of libvirt-python 3.7.0
* setup.py: updated for release
v3.7.0
2017-09-04 12:19:20 +02:00
John Ferlan
213ee4d7ae Implement virDomainMigrateGetMaxDowntime
Add override code for virDomainMigrateGetMaxDowntime
2017-08-26 08:59:24 -04:00
John Ferlan
100177c3dc Introduce virDomainMigrateGetMaxDowntime API
Introduce wrapper for virDomainMigrateGetMaxDowntime
2017-08-26 08:58:41 -04:00
Daniel P. Berrange
49cb00a5eb Fix package name in description of sub-RPMs
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-08-10 12:12:24 +01:00
Daniel P. Berrange
a2e3bb8ea7 Revert "rpm: assume python3 is always available"
This reverts commit b302b6d884.

Only drop the Fedora 18 test - RHEL must still build without
python 3
2017-08-10 12:11:40 +01:00
Daniel P. Berrange
bbfea06114 rpm: rename packages to python2-libvirt / python3-libvirt
This complies with Fedora naming policy for python packages

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-08-10 10:36:26 +01:00
Daniel P. Berrange
b302b6d884 rpm: assume python3 is always available
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-08-10 10:36:19 +01:00
Tomáš Golembiovský
a0e8d37e66 virDomainMemoryStats: include usable memory and last update
We've forgot to include VIR_DOMAIN_MEMORY_STAT_USABLE and
VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE constants.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-08-02 12:46:16 +02:00
Daniel Veillard
853c1c85d5 Release of libvirt-python-3.6.0
virtually identical to 3.5.0 except for the bump of version in setup.py
v3.6.0
2017-08-02 10:05:27 +08:00
Daniel Veillard
d736d3f5ea Release of libvirt-python-3.5.0
* setup.py: bump version number
v3.5.0
2017-07-04 22:39:03 +02:00
Martin Kletzander
36430e115d Add details for shutdown event
In commit a8eba5036cb4b0e2ec827e9e6e019ce70e451377, libvirt added
support for two more details.  In python bindings it all worked fine
automagically except an example that was not updated.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-06-20 16:31:14 +02:00
Daniel Veillard
ecde5e5cd3 Release of libvirt-python-3.4.0 v3.4.0 2017-06-02 09:05:17 +02:00
Daniel P. Berrange
ae94a895e4 Fix error check for virDomainGetTime method
The virDomainGetTime returns either a dict or None, but the python
glue layer for checking for '-1'. Thus it failed to raise an
exception on error.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-05-24 15:14:50 +01:00