summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* python: fix typoes and repeated global vars referencesGuannan Ren2013-03-011-5/+2
|
* python: Implement virDomainMigrateGetCompressionCache wrapperv1.0.3-rc2v1.0.3-rc1Jiri Denemark2013-02-222-0/+35
|
* Introduce virDomainMigrate*CompressionCache APIsJiri Denemark2013-02-221-0/+1
| | | | | Introduce virDomainMigrateGetCompressionCache and virDomainMigrateSetCompressionCache APIs.
* python: Implement virDomainGetJobStats wrapperJiri Denemark2013-02-222-0/+48
|
* Introduce virDomainGetJobStats APIJiri Denemark2013-02-221-0/+1
| | | | This is an extensible version of virDomainGetJobInfo.
* Check if classes are derived from objectGuido Günther2013-02-111-11/+16
| | | | This makes sure we don't regress to old style classes
* Remove more trailing semicolons in Python filesGuido Günther2013-02-073-79/+79
|
* Cosmetics: Remove semicolonsGuido Günther2013-02-071-4/+4
| | | | It's Python, not C
* sanitytest.py: Do not rely on system libvirtJiri Denemark2013-02-051-1/+1
| | | | | | | When running sanitytest.py we should not rely on libvirt library installed on the system. And since we generate a nice wrapper called "run" that sets both PYTHON_PATH and LD_LIBRARY_PATH, we should just use it rather than trying to duplicate it in the Makefile.
* Fix missing error constants in libvirt python moduleDaniel P. Berrange2013-02-053-1/+39
| | | | | | | | | | The previous change to the generator, changed too much - only the functions are in 'virerror.c', the constants remained in 'virerror.h' which could not be renamed for API compat reasons. Add a test case to sanity check the generated python bindings Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* complete virterror->virerror name changeSerge Hallyn2013-01-311-2/+2
| | | | | | | | | Without these two string changes in generator.py, the virGetLastError wrapper does not get created in /usr/share/pyshared/libvirt.py. Noticed when running tests with virt-install. Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
* python: Fix bindings for virDomainSnapshotGet{Domain,Connect}v1.0.2-rc2v1.0.2CVE-2013-0170Jiri Denemark2013-01-242-1/+11
| | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=895882 virDomainSnapshot.getDomain() and virDomainSnapshot.getConnect() wrappers around virDomainSnapshotGet{Domain,Connect} were not supposed to be ever implemented. The class should contain proper domain() and connect() accessors that fetch python objects stored internally within the class. While domain() was already provided, connect() was missing. This patch adds connect() method to virDomainSnapshot class and reimplements getDomain() and getConnect() methods as aliases to domain() and connect() for backward compatibility.
* Make python objects inherit from 'object' base classDaniel P. Berrange2013-01-241-1/+1
| | | | | | | | | | | | | As of python >= 2.2, it is recommended that all objects inherit from the 'object' base class. We already require python >= 2.3 for libvirt for thread macro support, so we should follow this best practice. See also http://stackoverflow.com/questions/4015417/python-class-inherits-object Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Introduce virTypedParamsClear public APIv1.0.2-rc1Jiri Denemark2013-01-182-39/+21
| | | | | The function is just a renamed public version of former virTypedParameterArrayClear.
* Add virTypedParams* APIsJiri Denemark2013-01-181-0/+19
| | | | | | | Working with virTypedParameters in clients written in C is ugly and requires all clients to duplicate the same code. This set of APIs makes this code for manipulating with virTypedParameters integral part of libvirt so that all clients may benefit from it.
* python: Avoid freeing uninitialized new_params pointerJiri Denemark2013-01-171-7/+7
|
* Fix build due to previous LXC patchDaniel P. Berrange2013-01-141-0/+1
| | | | | | Mark virDomainLxcEnterNamespace as skipped in python binding and remove reference to lxcDomainOpenNamespace which doesn't arrive until a later patch
* Introduce an LXC specific public API & libraryDaniel P. Berrange2013-01-144-6/+361
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces support for LXC specific public APIs. In common with what was done for QEMU, this creates a libvirt_lxc.so library and libvirt/libvirt-lxc.h header file. The actual APIs are int virDomainLxcOpenNamespace(virDomainPtr domain, int **fdlist, unsigned int flags); int virDomainLxcEnterNamespace(virDomainPtr domain, unsigned int nfdlist, int *fdlist, unsigned int *noldfdlist, int **oldfdlist, unsigned int flags); which provide a way to use the setns() system call to move the calling process into the container's namespace. It is not practical to write in a generically applicable manner. The nearest that we could get to such an API would be an API which allows to pass a command + argv to be executed inside a container. Even if we had such a generic API, this LXC specific API is still useful, because it allows the caller to maintain the current process context, in particular any I/O streams they have open. NB the virDomainLxcEnterNamespace() API is special in that it runs client side, so does not involve the internal driver API. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* python: Adapt to virevent renameMichal Privoznik2012-12-281-1/+1
| | | | | | | | | | | | | | | | | | | With our recent renames under src/util/* we forgot to adapt python wrapper code generator. This results in some methods being not exposed: $ python examples/domain-events/events-python/event-test.py Using uri:qemu:///system Traceback (most recent call last): File "examples/domain-events/events-python/event-test.py", line 585, in <module> main() File "examples/domain-events/events-python/event-test.py", line 543, in main virEventLoopPureStart() File "examples/domain-events/events-python/event-test.py", line 416, in virEventLoopPureStart virEventLoopPureRegister() File "examples/domain-events/events-python/event-test.py", line 397, in virEventLoopPureRegister libvirt.virEventRegisterImpl(virEventAddHandleImpl, AttributeError: 'module' object has no attribute 'virEventRegisterImpl'
* Rename util.{c,h} to virutil.{c,h}Daniel P. Berrange2012-12-211-1/+1
|
* Rename memory.{c,h} to viralloc.{c,h}Daniel P. Berrange2012-12-212-2/+2
|
* Fix the indentionv1.0.1-rc2v1.0.1-rc1v1.0.1Osier Yang2012-12-041-1/+1
| | | | | Introduced by commit 1465876a, pushed under build-breaker && trivial rule.
* Bind connection close callback APIs to python bindingDaniel P. Berrange2012-12-043-2/+133
| | | | | | | | | Add code in the python binding to cope with the new APIs virConnectRegisterCloseCallback and virConnectUnregisterCloseCallback. Also demonstrate their use in the python domain events demo Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* python: Use virNodeGetCPUMap where possibleCVE-2012-3411Viktor Mihajlovski2012-11-151-35/+52
| | | | | | | | | Modified the places where virNodeGetInfo was used for the purpose of obtaining the maximum node CPU number. Transparently falling back to virNodeGetInfo in case of failure. Wrote a utility function getPyNodeCPUCount for that purpose. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
* Remove spurious whitespace between function name & open bracketsDaniel P. Berrange2012-11-021-18/+18
| | | | | | | | The libvirt coding standard is to use 'function(...args...)' instead of 'function (...args...)'. A non-trivial number of places did not follow this rule and are fixed in this patch. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>