1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-07-27 11:41:52 +03:00
Commit Graph

286 Commits

Author SHA1 Message Date
2f3ed45cd8 Fix typos in virDomainSetSchedulerParameters name
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2018-11-20 11:21:42 -05:00
d5aae37c61 Add support for nwfilter binding objects / apis
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-06-28 12:04:05 +01:00
6c136b8150 Add support for virNodeGetSEVInfo
This binding allows to query the AMD's SEV firmware for various platform
specific things, like a PDH certificate and a certificate chain to
establish a trusted connection with the firmware. Because the API uses
typed params, it's exempted from generation.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-14 17:23:19 +02:00
dbae262811 Add support for virDomainGetLaunchSecurityInfo
Libvirt recently introduced support for getting launch security
parameters, most notably AMD SEV VM memory measurement. This API can't
be generated as it's using typed parameters which we need to allocate.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-14 17:22:59 +02:00
a950b08317 libvirt_charPtrUnwrap: remove unnecessary check of returned string
Function libvirt_charPtrUnwrap() either fails or always sets the
unwrapped string so there is no need to check it explicitly.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-06-12 10:27:38 +02:00
0c2d0c9be9 libvirt-override: Reset exception if the error is ignored
In virConnectCredCallbackWrapper() we ignore the error case of
libvirt_charPtrUnwrap() function so we should also reset the exception.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-06-12 10:27:36 +02:00
0f3f82e8be Add support for virConnectBaselineHypervisorCPU
The python bindings for this API cannot be generated because are
generator is not capable of handling string arrays (char **) parameters.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-01 08:16:48 +02:00
c99ed22847 Fix build with older libvirt versions
The libvirt python module is supposed to build with historical versions
of the API back to 0.9.1, which means all constants / methods must be
wrapped in conditionals. This was accidentally forgotten in:

  commit 314b2346df
  Author: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
  Date:   Wed Feb 7 17:49:30 2018 +0300

    Set hints for virPyDictToTypedParams

    Predefine hints for all parameters possible to avoid wrong type
    convert.

This broke the build against any libvirt < 2.0.0

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-19 16:07:19 +01:00
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
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
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
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
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
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
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.
2017-09-29 10:49:32 +01:00
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
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
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
57a160b524 Remove unused variables for event callbacks
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-09-06 11:47:02 +01:00
213ee4d7ae Implement virDomainMigrateGetMaxDowntime
Add override code for virDomainMigrateGetMaxDowntime
2017-08-26 08:59:24 -04:00
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
2e4cb22122 virStream: Introduce virStreamRecvFlags
Yet again, we need a custom wrapper over virStreamRecvFlags
because our generator is not capable of generating it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-05-23 13:43:15 +02:00
1f42d8629f Implement virStreamSendHole/virStreamRecvHole
The return value for virStreamRecvHole is slightly different to
its C counterpart. In python, either it returns the hole size or
None if C API fails.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-05-23 13:43:12 +02: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
a927799334 event: Add handler for block threshold event
Unfortunately python doesn't generate those.
2017-03-29 16:59:39 +02: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
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
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
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>
2016-08-24 17:05:18 +02:00
5016603a2a Add support for node device update callback 2016-08-17 07:38:20 -04:00
58a986984f Python binding for node poll lifecycle events API 2016-08-02 09:55:56 -04: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>
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
7eaab4a6c2 Python binding for storage pool lifecycle events API
Code matches the network event API implementation
2016-06-16 12:25:44 -04:00
e9c4e2abff 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>
2016-04-18 17:06:37 +02:00
1233645a28 event: Add support VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED 2016-04-18 13:18:26 +02:00
f97c782105 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>
2016-03-31 16:02:05 +02:00
3436387627 Add support for JOB_COMPLETED event
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-03-08 16:47:49 +01:00
1bba3ca4e2 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>
2016-02-23 13:51:38 +01:00
bc4c7477f0 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>
2016-02-23 13:51:12 +01:00
fccf112c57 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>
2016-02-23 13:51:07 +01:00
2bf5eaa270 libvirt-override: all flags should be defined as unsigned int
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-02-23 13:51:07 +01:00
3413cc44b2 Add support for MIGRATION_ITERATION event
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-18 15:52:01 +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>
2015-10-31 02:25:22 +01: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