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

901 Commits

Author SHA1 Message Date
1770fa45b4 event-test: free opaque data when removing callbacks
The pure python event loop impl has to call

  libvirt.virEventInvokeFreeCallback

to free the event opaque data from a clean stack context

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-04-04 15:28:50 +01:00
e985010674 Add asyncio event loop implementation
This is usable only on python >= 3.4 (or 3.3 with out-of-tree asyncio),
however it should be harmless for anyone with older python versions.

In simplest case, to have the callbacks queued on the default loop:

    >>> import libvirtaio
    >>> libvirtaio.virEventRegisterAsyncIOImpl()

The function is not present on non-compatible platforms.

Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
2017-04-04 15:28:50 +01:00
72e237f7b9 Allow for ff callbacks to be called by custom event implementations
The documentation says:
> If the opaque user data requires free'ing when the handle is
> unregistered, then a 2nd callback can be supplied for this purpose.
> This callback needs to be invoked from a clean stack. If 'ff'
> callbacks are invoked directly from the virEventRemoveHandleFunc they
> will likely deadlock in libvirt.

And they did deadlock. In removeTimeout too. Now we supply a custom
function to pick it from the opaque blob and fire.

Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-04-04 15:00:27 +01:00
069269e896 Release of libvirt-python-3.2.0
* setup.py: bumped version
v3.2.0
2017-04-02 17:08:59 +02:00
a927799334 event: Add handler for block threshold event
Unfortunately python doesn't generate those.
2017-03-29 16:59:39 +02:00
f261fd3e3c event: fix comment for _dispatchDomainEventMetadataChangeCallback
The comment was copied from the device removal failed event.
2017-03-29 16:58:59 +02:00
405f537bd0 Removed unused 'functions_list_exception_test' code from generator
The 'functions_list_exception_test' data structure and associated code
in the generator is inherited from libxml. This has never
been used in libvirt, so delete it to simplify the generator.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
v3.1.0
2017-01-27 09:58:40 +00:00
60f71591b9 Removed unused 'converter_type' code from generator
The 'converter_type' data structure and associated code
in the generator is inherited from libxml. This has never
been used in libvirt, so delete it to simplify the generator.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-01-27 09:58:40 +00:00
d5feb2f664 Removed unused 'classes_ancestor' code from generator
The 'classes_ancestor' data structure and associated code
in the generator is inherited from libxml. This has never
been used in libvirt, so delete it to simplify the generator.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-01-27 09:58:40 +00:00
34a5fa2f61 Removed unused 'py_return_types' code from generator
The 'py_return_types' data structure and associated code
in the generator is inherited from libxml. This has never
been used in libvirt, so delete it to simplify the generator.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-01-27 09:58:40 +00:00
bc90127cb6 Removed unused 'foreign_encoding_args' code from generator
The 'foreign_encoding_args' data structure and associated code
in the generator is inherited from libxml. This has never
been used in libvirt, so delete it to simplify the generator.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-01-27 09:58:40 +00:00
0c53a316ea Removed unused 'function_post' code from generator
The 'function_post' data structure and associated code
in the generator is inherited from libxml. This has never
been used in libvirt, so delete it to simplify the generator.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-01-27 09:58:40 +00:00
f916d855c7 Removed unused 'reference_keepers' code from generator
The 'reference_keepers' data structure and associated code
in the generator is inherited from libxml. This has never
been used in libvirt, so delete it to simplify the generator.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-01-27 09:58:40 +00:00
431afe83ce Protect against user accidentally calling constructors directly
When using libvirt python you must never call the object
constructors directly, as these are expecting to be passed
a wrapped C object. For example

   import libvirt
   c = libvirt.virConnect("qemu:///system")
   c.listAllDomains()

will mysteriously segfault. With this change the user now
gets an slightly more helpful error

  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/berrange/src/virt/libvirt-python/build/libvirt.py", line 3409, in __init__
      raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
  Exception: Expected a wrapped C Object but got <type 'str'>

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-01-27 09:58:40 +00:00
de35c1c3f3 Fix the incorrect memory freeing which will result in crash
Commit id '71fd95409' neglected to adjust a couple of API's do that now.

The number of elements in new_params is equal to the length of info,
instead of nparams, so it's wrong to free new_params using nparams.

Signed-off-by: Wu Zongyong <wuzongyo@mail.ustc.edu.cn>
2017-01-18 08:40:44 -05:00
aca4c8ac23 Post-release version bump to 3.1.0 2017-01-18 08:29:13 -05:00
fa88bbe562 Release of libvirt-python-3.0.0 v3.0.0 2017-01-17 19:23:33 +01:00
cc0adce95f examples: Update event-test.py
With recent changes there are new events known to libvirt.
Reflect those changes in our event-test.py example script.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-01-10 11:29:45 +01:00
f778ebbdb0 Fix typos in previous secrets event patch
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-01-10 10:28:27 +00:00
8afa199293 Add support for domain metadata change event
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-01-09 18:10:00 +00:00
69797c4726 Add support for secret event APIs
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-01-09 18:07:40 +00:00
ff560532fd Add override impl for virStorageVolGetInfoFlags
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-12-21 13:17:28 +00:00
f5edaf1ba5 Remove bogus \o escape in regex
One of the regexes has a bogus \o instead of plain 'o'. Somehow
this magically worked on all versions of python, until 3.6 came
along and complained

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-12-21 10:35:17 +00:00
a99e9fe20e Fix running of nosetests on python 3
Previously the way Fedora installed /usr/bin/nosetests allowed it
to be invoked with either python 2 or 3. Since Fedora 25 though,
it contains a module name that only exists on python 2. So we need
to be more intelligent and pick a different nosetests binary per
version.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-12-14 10:58:52 +00:00
c078650876 HACKING: fix grammar 2016-12-13 12:34:46 -05:00
3e2d50a9ef Fill out more fields for PKG-INFO file
Ensure the description and license are set in PKG-INFO,
and clarify the summary field.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-12-05 14:05:36 +00:00
4a77ad764b don't overrun buffer when converting cpumap
If we pass large(more than cpunum) cpu mask to any libvirt_virDomainPin*
function, it could leads to crash. So we have to check tuple size in
virPyCpumapConvert and ignore extra tuple members.

Since we allocate a zeroed buffer, we don't need to bother with setting
the bits to zero.

Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
v2.5.0
2016-11-11 14:02:24 +01:00
a03d782b3e move cpumap conversion code to a common helper
All libvirt_virDomainPin* functions do the same thing for convert
pycpumap to cpumap, so this patch moves all common logic to new
helper - virPyCpumapConvert.

Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
2016-11-11 13:44:44 +01:00
653ca92463 Post-release version bump to 2.5.0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-11-02 12:42:12 +01:00
3cc6864c96 Release of libvirt-2.4.0
* setup.py: just bumped up the release number
v2.4.0
2016-11-01 21:51:07 +01:00
0061566872 override: Properly override wrapper for virDomainGetGuestVcpus
Without the change to libvirt-override-api.xml generator.py would
generate the following function header:

    def guestVcpus(self, params, nparams, flags=0):

Since @params and @nparams are output-only in C and the python C
implementation actualy creates a dict from them we should not need to
pass them. Add the API definition to drop the two unnecessary args:

    def guestVcpus(self, flags=0):

The code did not work at all until this change as the C impl expects
only two arguments but the python required use of four.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1377071
v2.3.0
2016-09-19 17:19:43 +02:00
3e041e5b36 Post-release version bump to 2.3.0 2016-09-19 17:19:32 +02:00
2236fb90fa PyArg_ParseTuple: Provide correct function names
At the end of the format string we put :virFunctionName where ':'
says "this is the end of argument list", and virFunctionName is
the prefix for error messages then.  However, in some cases we
have had wrong names there. Some of them are actually quite
funny: xmlRegisterErrorHandler.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
v2.2.0
2016-08-24 17:05:18 +02:00
0b050dd015 event-test: support node device update callback 2016-08-17 07:38:30 -04:00
5016603a2a Add support for node device update callback 2016-08-17 07:38:20 -04:00
8b2d5c0643 event-test: Add node device lifecycle event tests 2016-08-02 09:55:56 -04:00
58a986984f Python binding for node poll lifecycle events API 2016-08-02 09:55:56 -04:00
94a4f35c58 Post-release version bump to 2.2.0 2016-08-02 09:55:56 -04:00
bdfa319eac allow pkg-config binary to be set by env
https://bugzilla.redhat.com/show_bug.cgi?id=1350523
v2.1.0
2016-07-28 15:58:34 -04:00
8a42cdd043 Post-release version bump to 2.1.0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-07-25 14:31:45 +02:00
a3a4425338 Fix crash in storage pool refresh callback
Fixes copy-paste typo introduced by commit cb84e36c.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-07-23 20:30:05 +02:00
cb84e36cb3 Add support for storage pool refesh callback
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
v2.0.0
2016-06-24 21:49:09 +01:00
923a2d9b86 Fix signedness of arg to virDomainGetGuestVcpus
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-24 18:33:50 +01:00
570669f29f Add support for virDomainGetGuestVcpus
This function has virTypedParameterPtr as one of the args and our
generator is unable to deal with that. Therefore we must provide
implementation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-23 10:57:11 +02:00
d42cb2b170 event-test: Add storage pool lifecycle event tests 2016-06-16 12:25:44 -04:00
7eaab4a6c2 Python binding for storage pool lifecycle events API
Code matches the network event API implementation
2016-06-16 12:25:44 -04:00
b4629027f8 Post-release version bump to 2.0.0
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-14 15:24:16 +01:00
287df5dfc8 Release of libvirt-python-1.3.5
* setup.py: bumped to 1.3.5, the release is virtually identical to 1.3.4
v1.3.5
2016-06-05 00:22:13 +08:00
3026a0593b 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.
v1.3.4
2016-04-21 15:46:00 +02:00
8067f0bed0 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
2016-04-20 14:47:48 -04:00