1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2024-10-26 16:25:10 +03:00
Commit Graph

14 Commits

Author SHA1 Message Date
Daniel P. Berrangé
b22e4f2441 Drop support for python 2
python2 will be end of life by the time of the next
libvirt release. All our supported build targets, including
CentOS7, have a python3 build available.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-12-04 12:14:51 +00:00
Pavel Hrdina
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
Pavel Hrdina
fb70ad1599 libvirt-utils: remove unused py_str function
Commit <57a160b5248ba47d4e1c9d22d95847dad8e0524f> removed last usage
but did not remove the function itself.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-06-12 10:27:14 +02: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
Konstantin Neumoin
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>
2016-11-11 14:02:24 +01:00
Konstantin Neumoin
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
Pavel Hrdina
0a9385286a use VIR_PY_DICT_SET_GOTO
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 09:42:44 +02:00
Pavel Hrdina
c982604ef8 indent labels by one space
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-10-05 08:35:30 +02:00
Pavel Hrdina
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
Pavel Hrdina
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
Doug Goldstein
4d083fbf60 Import some virTypedParams* APIs from libvirt
virTypedParamsClear() and virTypedParamsFree() were introduced in
libvirt 1.0.2. In an effort to keep the code clean bring these two
functions to libvirt-python if we're building against a version of
libvirt that's older than 1.0.2
2013-11-22 15:58:06 +00:00
Daniel P. Berrange
68bbab625a Import VIR_FORCE_CLOSE macro from libvirt
Import the macro for safely closing file descriptors

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:06 +00:00
Daniel P. Berrange
4f1ea70fd1 Import VIR_ALLOC / VIR_ALLOC_N / VIR_REALLOC_N functions
Import the libvirt memory allocation functions, stripping the OOM
testing and error reporting pieces.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:06 +00:00