1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-07-24 00:58:54 +03:00
Commit Graph

261 Commits

Author SHA1 Message Date
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
827ed9b4f1 use VIR_PY_TUPLE_GOTO
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 09:41:34 +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
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
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
2015-07-30 09:32:28 +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.
2015-06-29 11:41:41 +02:00
cd2d02ab0d Implement the DEVICE_ADDED event 2015-04-15 18:48:23 +02:00
0be1f5e31a 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>
2015-03-28 11:21:56 +01:00
e1e9b27096 Rename virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo 2015-03-26 16:48:18 +01:00
c58b696a56 Rename virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree 2015-03-26 16:44:23 +01:00