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

430 Commits

Author SHA1 Message Date
Daniel P. Berrange
7cc872b35b VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK appeared in 1.0.0 2013-11-22 15:58:07 +00:00
Doug Goldstein
38b2d9304f virStoragePoolListAllVolumes API appeared in 0.10.2 2013-11-22 15:58:07 +00:00
Doug Goldstein
f55e27f210 virNode{Get,Set}MemoryParameters API appeared in 0.10.2 2013-11-22 15:58:07 +00:00
Doug Goldstein
f13a882e00 virConnectListAll* APIs appeared in 0.10.2 2013-11-22 15:58:07 +00:00
Daniel P. Berrange
a7651a3284 virDomainQemuAgentCommand appeared in 0.10.0
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:06 +00:00
Doug Goldstein
6a050c8f43 virDomainPinEmulator and virDomainGetEmulatorPinInfo APIs appeared in 0.10.0 2013-11-22 15:58:06 +00:00
Daniel P. Berrange
bebe13660f VIR_DOMAIN_EVENT_ID_BALLOON_CHANGED appeared in 0.10.0 2013-11-22 15:58:06 +00:00
Doug Goldstein
cfe670927e virConnect{Unr,R}egisterCloseCallback API appeared in 0.10.0 2013-11-22 15:58:06 +00:00
Doug Goldstein
23e65b47e1 virDomainSnapshotListAllChildren API appeared in 0.9.13 2013-11-22 15:58:06 +00:00
Doug Goldstein
0ee14795fd virConnectListAllDomains API appeared in 0.9.13 2013-11-22 15:58:06 +00:00
Doug Goldstein
31d815b24b virDomainListAllSnapshots API appeared in 0.9.13 2013-11-22 15:58:06 +00:00
Doug Goldstein
75666e2d3a Don't build LXC module when building less than 1.0.2
The functions that the LXC module wraps did not appear until 1.0.2 so we
can't build the module unless we're building against 1.0.2 or newer.
2013-11-22 15:58:06 +00:00
Doug Goldstein
766f7433f0 Create array of modules to be built
Create an array of modules to be built to allow for flexibility to
enable or disable some modules in the future and allow for additional
modules to be added easily
2013-11-22 15:58:06 +00:00
Doug Goldstein
3878fbd548 Break generator.py to be called per module
Since we don't always want to build all the modules, and there might be
more modules added in the future but we want to retain backwards
compatibility with older libvirts, change generator.py to be called once
per module instead of with all modules at once.
2013-11-22 15:58:06 +00:00
Daniel P. Berrange
41562e063e Setup distutils build system
Create a setup.py for building libvirt python code and add
supporting files

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:06 +00:00
Daniel P. Berrange
e878523679 Add execute permission for sanitytest.py
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:06 +00:00
Daniel P. Berrange
be7d0bccb4 Add build/ to python module path for sanitytest.py
The generated libvirt.py modules will be in the build/
directory, so santitytest.py must use that directory.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:06 +00: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
Doug Goldstein
ac89e8177d Import LIBVIR_CHECK_VERSION macro from libvirt
Add LIBVIR_CHECK_VERSION from libvirt upstream so that we can check the
version of the library we are compiling against and support a range of
libvirt versions. The macro was added to libvirt in 1.2.0 so we must
provide it if its not defined.
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
218dbee6c6 Remove use of virStrcpyStatic
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
Daniel P. Berrange
ca48db168f Import code annotation macros from libvirt
Import ATTRIBUTE_RETURN_CHECK, ATTRIBUTE_UNUSED &
ATTRIBUTE_NONNULL macros

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:05 +00:00
Daniel P. Berrange
834ee782d8 Import gnulib's ignore_value macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:05 +00:00
Daniel P. Berrange
c856b7c623 Import gnulib's xalloc_oversized macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:05 +00:00
Daniel P. Berrange
5b5437349a Add decl of MIN macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:05 +00:00
Daniel P. Berrange
e169d3d8cf Import STREQ macro from libvirt
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:05 +00:00
Daniel P. Berrange
3bfb20266b Update header file includes
We're no longer using automake, so <config.h> files are not
required. Also remove of all libvirt internal util header
files. Reference generated header files in build/ subdir.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:05 +00:00
Daniel P. Berrange
19453b7836 Update generator for new code layout
Change the generator.py to

 - Take XML API file names on command line
 - Generate data in build/ directory instead of cwd
2013-11-22 15:58:05 +00:00
Daniel P. Berrange
3f61b08d5b Remove obsolete Makefile.am
We are no longer using automake, so Makefile.am is obsolete

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:05 +00:00
Daniel P. Berrange
34aa32ba8a Move python example programs into python/examples/ subdirectory
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:55:39 +00:00
Daniel P. Berrange
70b8c9a2a3 Mostly revert "python: remove virConnectGetCPUModelNames from globals"
This reverts commit 6b90d7428d72e92db292a9228c44701bfd5003c9.

The original problem was that libvirt_virConnectGetCPUModelNames
was listed twice in the exports table, once automatically from
the generator and once from the manual override. We merely needed
to list it in the skip_impl list, and not delete the manually
written code entirely.
2013-11-22 15:54:43 +00:00
Doug Goldstein
45ac117cf6 python: remove virConnectGetCPUModelNames from globals
Commit de51dc9c9aed0e615c8b301cccb89f4859324eb0 primarily added
virConnectGetCPUModelNames as libvirt.getCPUModelNames(conn, arch)
instead of libvirt.virConnect.getCPUModelNames(arch) so revert the code
that does the former while leaving the code that does the later.

This is the rest of the patch that was ACK'd by Dan but I committed only
the partial patch in 6a8b8ae.
2013-11-21 14:20:45 -06:00
Doug Goldstein
4b6944d3c0 python: remove virConnectGetCPUModelNames from globals
Commit de51dc9c9aed0e615c8b301cccb89f4859324eb0 primarily added
virConnectGetCPUModelNames as libvirt.getCPUModelNames(conn, arch)
instead of libvirt.virConnect.getCPUModelNames(arch) so revert the code
that does the former while leaving the code that does the later.
2013-11-21 08:47:08 -06:00
Eric Blake
9e8b8a824d maint: fix comma style issues: python
Most of our code base uses space after comma but not before;
fix the remaining uses before adding a syntax check.

* python/libvirt-override.c: Consistently use commas.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-11-20 09:14:55 -07:00
Doug Goldstein
34b7679331 Add missing break to switch-case block
The case label for VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED did not have its
own break statement but relied on falling through which we probably
don't want.
2013-11-19 10:29:28 -06:00
Marian Neagul
1da4ac52f5 python: Fix Create*WithFiles filefd passing
Commit d76227be added functions virDomainCreateWithFiles and
virDomainCreateXMLWithFiles, but there was a little piece missing in
python bindings.  This patch fixes proper passing of file descriptors
in the overwrites of these functions.
v1.1.4 v1.1.4-rc2 v1.1.4-rc1
2013-10-22 23:01:18 +01:00
Daniel P. Berrange
15c6588cf5 Don't link virt-login-shell against libvirt.so (CVE-2013-4400)
The libvirt.so library has far too many library deps to allow
linking against it from setuid programs. Those libraries can
do stuff in __attribute__((constructor) functions which is
not setuid safe.

The virt-login-shell needs to link directly against individual
files that it uses, with all library deps turned off except
for libxml2 and libselinux.

Create a libvirt-setuid-rpc-client.la library which is linked
to by virt-login-shell. A config-post.h file allows this library
to disable all external deps except libselinux and libxml2.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
CVE-2013-4400-3
2013-10-21 14:03:52 +01:00
Eric Blake
90461df0ca maint: avoid 'const fooPtr' in python bindings
'const fooPtr' is the same as 'foo * const' (the pointer won't
change, but it's contents can).  But in general, if an interface
is trying to be const-correct, it should be using 'const foo *'
(the pointer is to data that can't be changed).

Fix up offenders in the python bindings.

* python/generator.py (py_types): Drop useless conversions.
* python/libvirt-override.c (getPyVirTypedParameter)
(setPyVirTypedParameter): Use intended type.

Signed-off-by: Eric Blake <eblake@redhat.com>
CVE-2013-4400-2 CVE-2013-4400-1 CVE-2013-4401
2013-10-14 14:34:37 -06:00
Michal Privoznik
bc11687229 python: Document virNodeGetInfo bug
The memory size in virNodeGetInfo python API binding is reported in MiB
instead of KiB (like we have in C struct). However, there already might
be applications out there relying on this inconsistence so we can't
simply fix it. Document this sad fact as known bug.
v1.1.3
2013-09-30 11:42:52 +02:00
Giuseppe Scrivano
357df252fb python: add bindings for virConnectGetCPUModelNames
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
CVE-2013-4399 v1.1.3-rc2 v1.1.3-rc1
2013-09-23 16:59:39 -06:00
Giuseppe Scrivano
9d091faa7d libvirt: add new public API virConnectGetCPUModelNames
The new function virConnectGetCPUModelNames allows to retrieve the list
of CPU models known by the hypervisor for a specific architecture.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-09-23 15:41:50 -06:00
Daniel P. Berrange
793ca0c3b1 Fix potential use of uninitialized value in virDomainGetVcpuPinInfo
The virDomainGetVcpuPinInfo python wrapper had a potential use of
uninitialized values

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-09-20 17:22:39 +01:00
Oskari Saarenmaa
44dce1e00f docs, comments: minor typo fixes
Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
Signed-off-by: Eric Blake <eblake@redhat.com>
CVE-2013-4311 CVE-2013-4296
2013-09-10 17:06:41 -06:00
Eric Blake
58b82e0d57 build: enforce makefile conditional style
Automake has builtin support to prevent botched conditional nesting,
but only if you use:
if FOO
else !FOO
endif !FOO

An example error message when using the wrong name:

daemon/Makefile.am:378: error: else reminder (LIBVIRT_INIT_SCRIPT_SYSTEMD_TRUE) incompatible with current conditional: LIBVIRT_INIT_SCRIPT_SYSTEMD_FALSE
daemon/Makefile.am:381: error: endif reminder (LIBVIRT_INIT_SCRIPT_SYSTEMD_TRUE) incompatible with current conditional: LIBVIRT_INIT_SCRIPT_SYSTEMD_FALSE

As our makefiles tend to have quite a bit of nested conditionals,
it's better to take advantage of the benefits of the build system
double-checking that our conditionals are well-nested, but that
requires a syntax check to enforce our usage style.

Alas, unlike C preprocessor and spec files, we can't use indentation
to make it easier to see how deeply nesting goes.

* cfg.mk (sc_makefile_conditionals): New rule.
* daemon/Makefile.am: Enforce the style.
* gnulib/tests/Makefile.am: Likewise.
* python/Makefile.am: Likewise.
* src/Makefile.am: Likewise.
* tests/Makefile.am: Likewise.
* tools/Makefile.am: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-09-04 09:40:20 -06:00
Ján Tomko
ed0a51292d Fix leaks in python bindings
https://bugzilla.redhat.com/show_bug.cgi?id=1003828
CVE-2013-4297
2013-09-03 13:19:17 +02:00
Guan Qiang
bf69603b24 python: Fix a PyList usage mistake
Fix PyList usage mistake in Function libvirt_lxc_virDomainLxcOpenNamespace.

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

Signed-off-by: Eric Blake <eblake@redhat.com>
v1.1.2 v1.1.2-rc2 CVE-2013-4291 CVE-2013-4292
2013-08-29 06:52:56 -06:00
Claudio Bley
1f01027098 python: simplify complicated conditional assignment v1.1.2-rc1 2013-08-23 10:54:58 +02:00
Claudio Bley
d101d3bce8 Test for object identity when checking for None in Python
Consistently use "is" or "is not" to compare variables to None,
because doing so is preferrable, as per PEP 8
(http://www.python.org/dev/peps/pep-0008/#programming-recommendations):

> Comparisons to singletons like None should always be done with is or
> is not, never the equality operators.
2013-08-23 08:12:26 +02:00
Guido Günther
2d533bde3b python: Use RELRO_LDFLAGS and NO_INDIRECT_LDFLAGS
A readonly GOT and detecting indirect linkage is useful here too.
2013-08-22 16:17:36 +02:00