summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Update header file includesDaniel P. Berrange2013-11-214-24/+6
| | | | | | | | 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>
* Update generator for new code layoutDaniel P. Berrange2013-11-211-44/+25
| | | | | | | Change the generator.py to - Take XML API file names on command line - Generate data in build/ directory instead of cwd
* Remove obsolete Makefile.amDaniel P. Berrange2013-11-211-173/+0
| | | | | | We are no longer using automake, so Makefile.am is obsolete Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Move python example programs into python/examples/ subdirectoryDaniel P. Berrange2013-11-2110-0/+1139
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* python: remove virConnectGetCPUModelNames from globalsDoug Goldstein2013-11-212-12/+0
| | | | | | | 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.
* maint: fix comma style issues: pythonEric Blake2013-11-201-6/+6
| | | | | | | | | 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>
* Add missing break to switch-case blockDoug Goldstein2013-11-191-0/+1
| | | | | | 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.
* python: Fix Create*WithFiles filefd passingMarian Neagul2013-10-221-0/+4
| | | | | | | 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.
* Don't link virt-login-shell against libvirt.so (CVE-2013-4400)Daniel P. Berrange2013-10-211-0/+1
| | | | | | | | | | | | | | | | | 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>
* maint: avoid 'const fooPtr' in python bindingsEric Blake2013-10-142-13/+2
| | | | | | | | | | | | | | | '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>
* python: Document virNodeGetInfo bugMichal Privoznik2013-09-301-1/+1
| | | | | | | 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.
* python: add bindings for virConnectGetCPUModelNamesGiuseppe Scrivano2013-09-234-1/+72
| | | | | Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
* libvirt: add new public API virConnectGetCPUModelNamesGiuseppe Scrivano2013-09-231-0/+1
| | | | | | | | 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>
* Fix potential use of uninitialized value in virDomainGetVcpuPinInfoDaniel P. Berrange2013-09-201-1/+1
| | | | | | | The virDomainGetVcpuPinInfo python wrapper had a potential use of uninitialized values Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* docs, comments: minor typo fixesOskari Saarenmaa2013-09-101-4/+4
| | | | | Signed-off-by: Oskari Saarenmaa <os@ohmu.fi> Signed-off-by: Eric Blake <eblake@redhat.com>
* 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 bindingsJán Tomko2013-09-032-0/+4
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1003828
* python: Fix a PyList usage mistakeGuan 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 assignmentClaudio 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 filesDaniel 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 TODOCole 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 MakefilesEric 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 blockjobGuannan 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 failureMichal 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 APIsJiri 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 loopEric 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 ";"Osier 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.4Daniel 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'Eric 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 argumentsGuannan 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 codeGuannan 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.pyGuannan Ren2013-03-011-0/+3
|
* python: fix typoes and repeated global vars referencesGuannan Ren2013-03-011-5/+2
|
* python: Implement virDomainMigrateGetCompressionCache wrapperJiri Denemark2013-02-222-0/+35
|