summaryrefslogtreecommitdiff
path: root/libvirt-override.py
Commit message (Collapse)AuthorAgeFilesLines
* override: no type changePhilipp Hahn2020-08-181-6/+8
| | | | | | | static typing forbids re-declaring a variable with different types. Rename the variable. Signed-off-by: Philipp Hahn <hahn@univention.de>
* override: Add manual PEP 484 type annotationsPhilipp Hahn2020-08-181-23/+72
| | | | Signed-off-by: Philipp Hahn <hahn@univention.de>
* override: Simplify exception handlingPhilipp Hahn2020-08-181-7/+3
| | | | | | | sys.exc_info() returns a 3-tuple (type, value, traceback), where `value` is the instance captured by `except type as value`. Signed-off-by: Philipp Hahn <hahn@univention.de>
* Remove legacy libvirtError argumentsPhilipp Hahn2020-08-061-1/+1
| | | | | | | | | | | | The fields have been deprecated in C with git:f60dc0bc09f09c6817d6706a9edb1579a3e2b2b8 They are only passed to the libvirtError constructor, but not stored for later or used anywhere else. sed -ri '/raise libvirtError/s/, \w+=self(\._dom)?//' *.py Signed-off-by: Philipp Hahn <hahn@univention.de>
* Normalize white spacePhilipp Hahn2020-08-061-10/+21
| | | | | | | indent by 4 spaces one spaces around assignments Signed-off-by: Philipp Hahn <hahn@univention.de>
* libvirt-override.py: remove unused importMarc Hartmayer2018-05-161-1/+0
| | | | | | Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
* Allow for ff callbacks to be called by custom event implementationsWojtek Porczyk2017-04-041-0/+23
| | | | | | | | | | | | | | | The documentation says: > If the opaque user data requires free'ing when the handle is > unregistered, then a 2nd callback can be supplied for this purpose. > This callback needs to be invoked from a clean stack. If 'ff' > callbacks are invoked directly from the virEventRemoveHandleFunc they > will likely deadlock in libvirt. And they did deadlock. In removeTimeout too. Now we supply a custom function to pick it from the opaque blob and fire. Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Fix exception handling syntaxDoug Goldstein2013-12-091-2/+6
| | | | | | Python 3 no longer accepts 'except Exception, e:' as valid while Python 2.4 does not accept the new syntax 'except Exception as e:' so this uses a fall back method that is compatible with both.
* Call virGetLastError from mod rather than py wrapperDoug Goldstein2013-11-261-1/+1
| | | | | All other code always calls the methods from the mod rather than using the python wrapper so this matches the state of all other callers.
* python: remove virConnectGetCPUModelNames from globalsDoug Goldstein2013-11-211-11/+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.
* python: add bindings for virConnectGetCPUModelNamesv1.1.3-rc2v1.1.3-rc1CVE-2013-4399Giuseppe Scrivano2013-09-231-0/+11
| | | | | Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
* python: treat flags as default argument with value 0Guannan Ren2013-03-221-1/+1
| | | | | | | | | | | 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):
* Cosmetics: Remove semicolonsGuido Günther2013-02-071-4/+4
| | | | It's Python, not C
* Fix two comments related to error handlingPhilipp Hahn2011-10-171-1/+1
| | | | Signed-off-by: Philipp Hahn <hahn@univention.de>
* maint: typo fixesEric Blake2011-10-101-2/+2
| | | | | | | | | | | | | | | | I noticed a couple typos in recent commits, and fixed the remaining instances of them. * docs/internals/command.html.in: Fix spelling errors. * include/libvirt/libvirt.h.in (virConnectDomainEventCallback): Likewise. * python/libvirt-override.py (virEventAddHandle): Likewise. * src/lxc/lxc_container.c (lxcContainerChild): Likewise. * src/util/hash.c (virHashCreateFull): Likewise. * src/storage/storage_backend_logical.c (virStorageBackendLogicalMakeVol): Likewise. * src/esx/esx_driver.c (esxFormatVMXFileName): Likewise. * src/vbox/vbox_tmpl.c (vboxIIDIsEqual_v3_x): Likewise.
* python: Mark event callback wrappers as privateCole Robinson2011-06-211-2/+2
| | | | | | | | These functions aren't intended to be called directly by users, so mark them as private. While we're at it, remove unneeded exception handling, and break some long lines.
* python: events: Fix C->Python handle callback prototypeCole Robinson2011-06-211-2/+24
| | | | | | | | | | | | | | | If registering our own event loop implementation written in python, any handles or timeouts callbacks registered by libvirt C code must be wrapped in a python function. There is some argument trickery that makes this all work, by wrapping the user passed opaque value in a tuple, along with the callback function. Problem is, the current setup requires the user's event loop to know about this trickery, rather than just treating the opaque value as truly opaque. Fix this in a backwards compatible manner, and adjust the example python event loop to do things the proper way.
* python: Add bindings for virEvent*Handle/TimeoutCole Robinson2011-06-211-0/+54
|
* python: Use hardcoded python path in libvirt.pyv0.9.1v0.9.0libvirt-0.9.1-1.el6CVE-2011-1486Jiri Denemark2011-03-141-5/+0
| | | | | | | | | | | | | | | | This partially reverts (and fixes that part in a different way) commit e4384459c93e3e786aa483c7f077d1d22148f689, which replaced ``/usr/bin/python'' with ``/usr/bin/env python'' in all examples or scripts used during build to generate other files. However, python bindings module is compiled and linked against a specific python discovered or explicitly provided in configure phase. Thus libvirt.py, which is generated and installed into the system, should use the same python binary for which the module has been built. The hunk in Makefile.am replaces $(srcdir) with $(PYTHON), which might seem wrong but it is not. generator.py didn't use any of its command line arguments so passing $(srcdir) to it was redundant.
* Use python discovered through env instead of hardcoding a pathv0.8.7v0.8.6libvirt-0.8.7-9.el6libvirt-0.8.7-8.el6libvirt-0.8.7-7.el6libvirt-0.8.7-6.el6libvirt-0.8.7-5.el6libvirt-0.8.7-11.el6libvirt-0.8.7-10.el6Matthias Bolte2010-11-141-0/+5
| | | | | | | | This is more flexible regarding the location of the python binary but doesn't allow to pass the -u flag. The -i flag can be passed from inside the script using the PYTHONINSPECT env variable. This fixes a problem with the esx_vi_generator.py on FreeBSD.
* python: drop unnecessary conn assignmentDan Kenigsberg2010-09-271-9/+0
| | | | | | Since 554d82a200289938d5639a782a9f12e3e2e968f0, conn is unused. Let's drop it - but keep the signature of the constructor for backward compatibility.
* Misc syntax-check fixesDaniel P. Berrange2009-09-211-2/+0
|
* Re-arrange python generator to make it clear what's auto-generatedDaniel P. Berrange2009-09-211-0/+144
* README: New file describing what each file is used for * livvirt-override.c, libvirt-override.py, libvirt-override-api.xml, libvirt-override-virConnect.py: Manually written code overriding the generator * typewrappers.c, typewrappers.h: Data type wrappers * generator.py: Automatically pre-prend contents of libvirt-override.py to generated libvirt.py. Output into libvirt.py directly instead of libvirtclass.py. Don't generate libvirtclass.txt at all. Write C files into libvirt.c/.h directly * Makefile.am: Remove rule for creating libvirt.py from libvirt-override.py and libvirtclass.py, since generator.py does it directly