summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Setup distutils buld systemHEADmasterDaniel P. Berrange2013-09-099-0/+1244
| | | | | | | Create a setup.py for building libvirt python code and add supporting files Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Add execute permission for sanitytest.pyDaniel P. Berrange2013-09-091-0/+0
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Add build/ to python module path for sanitytest.pyDaniel P. Berrange2013-09-091-0/+4
| | | | | | | 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>
* Remove use of VIR_FORCE_CLOSEDaniel P. Berrange2013-09-091-1/+1
| | | | | | Replace VIR_FORCE_CLOSE with plain close() Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Remove use of virStrcpyStaticDaniel P. Berrange2013-09-091-1/+2
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Import gnulib's ignore_value macroDaniel P. Berrange2013-09-091-0/+11
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Import gnulib's xalloc_oversized macroDaniel P. Berrange2013-09-091-0/+16
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Update header file includesDaniel P. Berrange2013-09-094-16/+6
| | | | | | | Remove use of all libvirt util header files. Reference generated header files in build/ subdir. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Add decl of MIN macroDaniel P. Berrange2013-09-091-0/+4
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Import STREQ macro from libvirtDaniel P. Berrange2013-09-091-0/+2
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Remove use of VIR_ALLOC_NDaniel P. Berrange2013-09-091-53/+53
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Remove use of VIR_FREE from codeDaniel P. Berrange2013-09-094-120/+120
| | | | | | | We don't have access to the libvirt memory APIs to replace VIR_FREE with free(). Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix potential use of uninitialized value in virDomainGetVcpuPinInfoDaniel P. Berrange2013-09-091-1/+1
| | | | | | | The virDomainGetVcpuPinInfo python wrapper had a potential use of uninitialized values Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Remote compiler annotation attributesDaniel P. Berrange2013-09-091-141/+140
| | | | | | Remove ATTRIBUTE_NONNULL and ATTRIBUTE_UNUSED Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Remove obsolete Makefile.amDaniel P. Berrange2013-09-091-172/+0
| | | | | | We are no longer using automake, so Makefile.am is obsolete Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Remove <config.h> from source filesDaniel P. Berrange2013-09-094-8/+0
| | | | | | | We're no longer using automake, so <config.h> files are not required Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Update generator for new code layoutDaniel P. Berrange2013-09-091-44/+25
| | | | | | | Change the generator.py to - Take XML API file names on command line - Generate data in build/ directory instead of cwd
* build: enforce makefile conditional styleEric Blake2013-09-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix leaks in python bindingsCVE-2013-4297Ján Tomko2013-09-032-0/+4
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1003828
* python: Fix a PyList usage mistakev1.1.2-rc2v1.1.2CVE-2013-4292CVE-2013-4291Guan Qiang2013-08-291-1/+1
| | | | | | | | 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>
* python: simplify complicated conditional assignmentv1.1.2-rc1Claudio Bley2013-08-231-2/+1
|
* Test for object identity when checking for None in PythonClaudio Bley2013-08-233-18/+18
| | | | | | | | | 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.
* python: Use RELRO_LDFLAGS and NO_INDIRECT_LDFLAGSGuido Günther2013-08-221-0/+7
| | | | A readonly GOT and detecting indirect linkage is useful here too.
* Delete obsolete / unused python test filesCVE-2013-5651CVE-2013-4239Daniel P. Berrange2013-07-307-348/+0
| | | | | | | | | | | | | | | | | The python/tests directory contains a number of so called "tests" for the python API. These are all hardcoded to look for Xen and cannot be run in any automated fashion, and no one is ever manually running them. Given that they don't meaningully contribute to the test coverage, delete them. For some reason these tests were also copied into the filesystem as part of 'make install'. The change to the RPM in commit 3347a4203278ec93d7b0ceb88b5ed10e4f14765c caused a build failure, since it removed the code which deleted these installed tests. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* python: Drop TODOv1.1.1Cole Robinson2013-07-292-13/+0
| | | | | | | | File hasn't been really touched for 7 years. And with recent rawhide changes it contributed to an RPM build failure. Let's drop it. This also removes installation of a libvirt-python doc dir, so drop handling of it from the RPM spec.
* maint: split long lines in Makefilesv1.1.1-rc2v1.1.1-rc1Eric Blake2013-07-191-6/+12
| | | | | | | | | | | | | | | | | | Makefiles are another easy file to enforce line limits. Mostly straightforward; interesting tricks worth noting: src/Makefile.am: $(confdir) was already defined, use it in more places tests/Makefile.am: path_add and VG required some interesting compression * cfg.mk (sc_prohibit_long_lines): Add another test. * Makefile.am: Fix offenders. * daemon/Makefile.am: Likewise. * docs/Makefile.am: Likewise. * python/Makefile.am: Likewise. * src/Makefile.am: Likewise. * tests/Makefile.am: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* Add VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED eventJiri Denemark2013-07-182-1/+60
|
* Introduce new domain create APIs to pass pre-opened FDs to LXCDaniel P. Berrange2013-07-184-0/+160
| | | | | | | | | | | | | | | | | | | | With container based virt, it is useful to be able to pass pre-opened file descriptors to the container init process. This allows for containers to be auto-activated from incoming socket connections, passing the active socket into the container. To do this, introduce a pair of new APIs, virDomainCreateXMLWithFiles and virDomainCreateWithFiles, which accept an array of file descriptors. For the LXC driver, UNIX file descriptor passing will be used to send them to libvirtd, which will them pass them down to libvirt_lxc, which will then pass them to the container init process. This will only be implemented for LXC right now, but the design is generic enough it could work with other hypervisors, hence I suggest adding this to libvirt.so, rather than libvirt-lxc.so Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* python: return dictionary without value in case of no blockjobCVE-2013-4154CVE-2013-4153Guannan Ren2013-07-151-15/+39
| | | | | | | | | | | | | | Currently, when there is no blockjob, dom.blockJobInfo('vda') still reports error because it doesn't distinguish return value 0 from -1. libvirt.libvirtError: virDomainGetBlockJobInfo() failed virDomainGetBlockJobInfo() API return value: -1 in case of failure, 0 when nothing found, 1 found. And use PyDict_SetItemString instead of PyDict_SetItem when key is of string type. PyDict_SetItemString increments key/value reference count, so call Py_DECREF() for value. For key, we don't need to do this, because PyDict_SetItemString will handle it internally.
* Convert 'int i' to 'size_t i' in python/ filesDaniel P. Berrange2013-07-102-45/+71
| | | | | | | | | Convert the type of loop iterators named 'i', 'j', k', 'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or 'unsigned int', also santizing 'ii', 'jj', 'kk' to use the normal 'i', 'j', 'k' naming Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* viralloc: Report OOM error on failureCVE-2013-2230Michal Privoznik2013-07-101-51/+51
| | | | | Similarly to VIR_STRDUP, we want the OOM error to be reported in VIR_ALLOC and friends.
* python: Add bindings for extensible migration APIsv1.1.0-rc2v1.1.0-rc1v1.1.0CVE-2013-2218Jiri Denemark2013-06-252-0/+236
| | | | | The patch implements wrappers for virDomainMigrate3 and virDomainMigrateToURI3.
* Extensible migration APIsJiri Denemark2013-06-251-0/+2
| | | | | | | | | | | | | This patch introduces two new APIs virDomainMigrate3 and virDomainMigrateToURI3 that may be used in place of their older variants. These new APIs take optional migration parameters (such as bandwidth, domain XML, ...) in an array of virTypedParameters, which makes adding new parameters easier as there's no need to introduce new APIs whenever a new migration parameter needs to be added. Both APIs are backward compatible and will automatically use older migration calls in case the new calls are not supported as long as the typed parameters array does not contain any parameter which was not supported by the older calls.
* syntax: prefer space after semicolon in for loopv1.0.6-rc2v1.0.6Eric Blake2013-05-281-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | I noticed several unusual spacings in for loops, and decided to fix them up. See the next commit for the syntax check that found all of these. * examples/domsuspend/suspend.c (main): Fix spacing. * python/libvirt-override.c: Likewise. * src/conf/interface_conf.c: Likewise. * src/security/virt-aa-helper.c: Likewise. * src/util/virconf.c: Likewise. * src/util/virhook.c: Likewise. * src/util/virlog.c: Likewise. * src/util/virsocketaddr.c: Likewise. * src/util/virsysinfo.c: Likewise. * src/util/viruuid.c: Likewise. * src/vbox/vbox_tmpl.c: Likewise. * src/xen/xen_hypervisor.c: Likewise. * tools/virsh-domain-monitor.c (vshDomainStateToString): Drop default case, to let compiler check us. * tools/virsh-domain.c (vshDomainVcpuStateToString): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* python: Remove the whitespace before ";"v1.0.6-rc1Osier Yang2013-05-212-10/+10
|
* maint: use LGPL correctlyEric Blake2013-05-202-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several files called out COPYING or COPYING.LIB instead of using the normal boilerplate. It's especially important that we don't call out COPYING from an LGPL file, since COPYING is traditionally used for the GPL. A few files were lacking copyright altogether. * src/rpc/gendispatch.pl: Add missing copyright. * Makefile.nonreentrant: Likewise. * src/check-symfile.pl: Likewise. * src/check-symsorting.pl: Likewise. * src/driver.h: Likewise. * src/internal.h: Likewise. * tools/libvirt-guests.sh.in: Likewise. * tools/virt-pki-validate.in: Mention copyright in comment, not just code. * tools/virt-sanlock-cleanup.in: Likewise. * src/rpc/genprotocol.pl: Spell out license terms. * src/xen/xend_internal.h: Likewise. * src/xen/xend_internal.c: Likewise. * Makefile.am: Likewise. * daemon/Makefile.am: Likewise. * docs/Makefile.am: Likewise. * docs/schemas/Makefile.am: Likewise. * examples/apparmor/Makefile.am: Likewise. * examples/domain-events/events-c/Makefile.am: Likewise. * examples/dominfo/Makefile.am: Likewise. * examples/domsuspend/Makefile.am: Likewise. * examples/hellolibvirt/Makefile.am: Likewise. * examples/openauth/Makefile.am: Likewise. * examples/python/Makefile.am: Likewise. * examples/systemtap/Makefile.am: Likewise. * examples/xml/nwfilter/Makefile.am: Likewise. * gnulib/lib/Makefile.am: Likewise. * gnulib/tests/Makefile.am: Likewise. * include/Makefile.am: Likewise. * include/libvirt/Makefile.am: Likewise. * python/Makefile.am: Likewise. * python/tests/Makefile.am: Likewise. * src/Makefile.am: Likewise. * tests/Makefile.am: Likewise. * tools/Makefile.am: Likewise. * configure.ac: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* Fix build of python bindings on Python 2.4CVE-2013-1962Daniel P. Berrange2013-05-091-0/+4
| | | | | | | The PyDict_Next method on Python <= 2.4 used 'int' instead of "Py_ssize_t" for the 'pos' parameter Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* build: clean up stray files found by 'make distcheck'Eric Blake2013-05-061-1/+2
| | | | | | | | | | | | | | | | 'make distcheck' complained: ERROR: files left in build directory after distclean: ./python/libvirt.pyc ./tests/commandhelper.log Problems introduced in commits f015495 and 25ea8e4 (both v1.0.3). * tests/commandtest.c (test21): Check (and clean) log file. * tests/commanddata/test21.log: New file. * python/Makefile.am (CLEANFILES): Clean up compiled python files. Signed-off-by: Eric Blake <eblake@redhat.com>
* build: always include sanitytest in tarballEric Blake2013-05-021-3/+2
| | | | | | | | | | The libvirt 1.0.5 tarball is missing a file which renders 'make check' broken; first reported on list by Guido Günther. * python/Makefile.am (EXTRA_DIST): Hoist sanitytest.py out of HAVE_PYTHON conditional. Signed-off-by: Eric Blake <eblake@redhat.com>
* virutil: Move string related functions to virstring.cMichal Privoznik2013-05-021-0/+1
| | | | | | | | The source code base needs to be adapted as well. Some files include virutil.h just for the string related functions (here, the include is substituted to match the new file), some include virutil.h without any need (here, the include is removed), and some require both.
* docs: fix usage of 'onto'v1.0.5-rc1v1.0.5Eric Blake2013-04-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | http://www.uhv.edu/ac/newsletters/writing/grammartip2009.07.01.htm (and several other sites) give hints that 'onto' is best used if you can also add 'up' just before it and still make sense. In many cases in the code base, we really want the two-word form, or even a simplification to just 'on' or 'to'. * docs/hacking.html.in: Use correct 'on to'. * python/libvirt-override.c: Likewise. * src/lxc/lxc_controller.c: Likewise. * src/util/virpci.c: Likewise. * daemon/THREADS.txt: Use simpler 'on'. * docs/formatdomain.html.in: Better usage. * docs/internals/rpc.html.in: Likewise. * src/conf/domain_event.c: Likewise. * src/rpc/virnetclient.c: Likewise. * tests/qemumonitortestutils.c: Likewise. * HACKING: Regenerate. Signed-off-by: Eric Blake <eblake@redhat.com>
* syntax-check: Only allows to include public headers in external toolsOsier Yang2013-04-184-8/+8
| | | | | | With this patch, include public headers in "" form is only allowed for "internal.h". And only the external tools (examples|tools|python |include/libvirt) can include the public headers in <> form.
* python: set default value to optional argumentsv1.0.4-rc2v1.0.4Guannan Ren2013-03-261-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When prefixing with string (optional) or optional in the description of arguments to libvirt C APIs, in python, these arguments will be set as optional arugments, for example: * virDomainSaveFlags: * @domain: a domain object * @to: path for the output file * @dxml: (optional) XML config for adjusting guest xml used on restore * @flags: bitwise-OR of virDomainSaveRestoreFlags the corresponding python APIs is restoreFlags(self, frm, dxml=None, flags=0) The following python APIs are changed to: blockCommit(self, disk, base, top, bandwidth=0, flags=0) blockPull(self, disk, bandwidth=0, flags=0) blockRebase(self, disk, base, bandwidth=0, flags=0) migrate(self, dconn, flags=0, dname=None, uri=None, bandwidth=0) migrate2(self, dconn, dxml=None, flags=0, dname=None, uri=None, bandwidth=0) migrateToURI(self, duri, flags=0, dname=None, bandwidth=0) migrateToURI2(self, dconnuri=None, miguri=None, dxml=None, flags=0, \ dname=None, bandwidth=0) saveFlags(self, to, dxml=None, flags=0) migrate(self, domain, flags=0, dname=None, uri=None, bandwidth=0) migrate2(self, domain, dxml=None, flags=0, dname=None, uri=None, bandwidth=0) restoreFlags(self, frm, dxml=None, flags=0)
* python:remove semicolon in python codev1.0.4-rc1Guannan Ren2013-03-221-1/+1
| | | | | | This breaked "make syntax-check" testing Pushed under trivial rule
* make: regenerate bindings when <classname>.py changesGuannan Ren2013-03-221-1/+6
|
* python: treat flags as default argument with value 0Guannan Ren2013-03-226-11/+13
| | | | | | | | | | | The following four functions have not changed because default arguments have to come after positional arguments. Changing them will break the the binding APIs. migrate(self, dconn, flags, dname, uri, bandwidth): migrate2(self, dconn, dxml, flags, dname, uri, bandwidth): migrateToURI(self, duri, flags, dname, bandwidth): migrateToURI2(self, dconnuri, miguri, dxml, flags, dname, bandwidth):
* python: Fix emulatorpin API bindingsPeter Krempa2013-03-213-0/+134
| | | | | | | | | | The addition of emulator pinning APIs didn't think of doing the right job with python APIs for them. The default generator produced unusable code for this. This patch switches to proper code as in the case of domain Vcpu pining. This change can be classified as a python API-breaker but in the state the code was before I doubt anyone was able to use it successfully.
* python: fix bindings that don't raise an exceptionGuannan Ren2013-03-212-60/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example: >>> dom.memoryStats() libvir: QEMU Driver error : Requested operation is not valid:\ domain is not running There are six such python API functions like so. The root reason is that generator.py script checks the type of return value of a python stub function defined in libvirt-api.xml or libvirt-override-api.xml to see whether to add the raise clause or not in python wrapper code in libvirt.py. The type of return value is supposed to be C types. For those stub functions which return python non-integer data type like string, list, tuple, dictionary, the existing type in functions varies from each other which leads problem like this. Currently, in generator.py, it maintains a buggy whitelist for stub functions returning a list type. I think it is easy to forget adding new function name in the whitelist. This patch makes the value of type consistent with C type "char *" in libvirt-override-api.xml. For python, any of types could be printed as string, so I choose "char *" in this case. And the comment in xml could explain it when adding new function definition. <function name='virNodeGetCPUStats' file='python'> ... - <return type='virNodeCPUStats' info='...'/> + <return type='char *' info='...'/> ... </function>
* Apply security label when entering LXC namespacesDaniel P. Berrange2013-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new virDomainLxcEnterSecurityLabel() function as a counterpart to virDomainLxcEnterNamespaces(), which can change the current calling process to have a new security context. This call runs client side, not in libvirtd so we can't use the security driver infrastructure. When entering a namespace, the process spawned from virsh will default to running with the security label of virsh. The actual desired behaviour is to run with the security label of the container most of the time. So this changes virsh lxc-enter-namespace command to invoke the virDomainLxcEnterSecurityLabel method. The current behaviour is: LABEL PID TTY TIME CMD system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 1 pts/0 00:00:00 systemd system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 3 pts/1 00:00:00 sh system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 24 ? 00:00:00 systemd-journal system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 29 ? 00:00:00 dhclient staff_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 47 ? 00:00:00 ps Note the ps command is running as unconfined_t, After this patch, The new behaviour is this: virsh -c lxc:/// lxc-enter-namespace dan -- /bin/ps -eZ LABEL PID TTY TIME CMD system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 1 pts/0 00:00:00 systemd system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 3 pts/1 00:00:00 sh system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 24 ? 00:00:00 systemd-journal system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 32 ? 00:00:00 dhclient system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 38 ? 00:00:00 ps The '--noseclabel' flag can be used to skip security labelling. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* python: fix fd leak in generator.pyv1.0.3Guannan Ren2013-03-011-0/+3
|