summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* event-test: add missing eventsEric Blake2014-06-181-4/+22
| | | | | | | | | | | | Update the example to be able to trace all events. * examples/event-test.py (main): Match full list of domain events. (myDomainEventIOErrorReasonCallback) (myDomainEventControlErrorCallback) (myDomainEventBlockJobCallback, myDomainEventBlockJob2Callback) (blockJobTypeToString, blockJobStatusToString): New functions. Signed-off-by: Eric Blake <eblake@redhat.com>
* blockjob: support new BLOCK_JOB_2 eventEric Blake2014-06-182-6/+10
| | | | | | | | | | | | | | | | | Libvirt 1.2.6 is introducing a new block job event that passes disk information by target device rather than host file name. At the python level, we are just a passthrough, so we can reuse all the existing code and just wire up the new enum value. * libvirt-override-virConnect.py (_dispatchDomainEventBlockPullCallback): Rename... (_dispatchDomainEventBlockJobCallback): ...to this, and make generic to both events. * libvirt-override.c (libvirt_virConnectDomainEventBlockJobCallback): Match naming. (libvirt_virConnectDomainEventRegisterAny): Allow new registration. Signed-off-by: Eric Blake <eblake@redhat.com>
* Bump version to 1.2.6 for new dev cycleMartin Kletzander2014-06-021-1/+1
| | | | Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* fix leak in memoryStats with older pythonv1.2.5Martin Kletzander2014-05-271-24/+44
| | | | | | | | | | | | | | | libvirt_virDomainMemoryStats() function creates a dictionary without any checks whether the additions were successful, whether the python objects were created and, most importantly, without decrementing the reference count on the objects added to the dictionary. This is somehow not an issue with current upstream versions, however with python 2.6 this exposes a leak in our bindings. The following patch works on both old and new CPython versions and is already used in other parts of the code, so it's also most straightforward. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1099860 Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* Implement virDomain{Get,Set}Time APIsMichal Privoznik2014-05-204-1/+111
| | | | | | | | | While the setter can be generated automatically, the getter is not. However, it would be a lot easier if they both share the same logic: a python dictionary to represent the time: dict['seconds'] to represent seconds, and dict['nseconds'] to represent nanoseconds. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* override: add virDomainFSFreeze and virDomainFSThaw APITomoki Sekiyama2014-05-164-0/+114
| | | | | | | | | | Add binding for the new virDomainFSFreeze and virDomainFSThaw functions added in libvirt 1.2.5. These require override since these take a list of mountpoints path string. The methods are named 'fsFreeze' and 'fsThaw'. Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* Bump version to 1.2.5 for new dev cycleMartin Kletzander2014-05-051-1/+1
| | | | Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* build: add BuildRequires for python-lxml and python3-lxmlv1.2.4Laine Stump2014-04-071-0/+2
| | | | | | | python-lxml is likely always already present anyway (due to so many packages being dependent on it), but at least on my F20 system, python3-lxml wasn't installed, leading to a failure of "python setup.py rpm" without an informative error message.
* increment version post-releaseLaine Stump2014-04-071-1/+1
| | | | | As is now done with libvirt. git head will always have the version number of the expected *next* release.
* Fix nosetests usage with python3v1.2.3Daniel P. Berrange2014-04-022-1/+9
| | | | | | | Add RPM deps on python/python3-nose, make RPM build run the test suite and invoke nosetests using correct python binary Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix potential crash when setting partial cpu/memory/numa/interface limits on ↵Brian Rak2014-03-311-12/+12
| | | | | | | | domains The number of parameters in new_params is not guaranteed to be the same as the number of parameters in params. Use the correct count when freeing new_params to avoid crashes.
* setup.py: Allow running --help or clean without pkg-configCole Robinson2014-03-251-11/+20
| | | | | | | | | | If pkg-config isn't installed, or a too old libvirt, we can't even do 'python setup.py --help' without throwing an exception. Have the pkg-config checks and validation only throw an exception if being called from the 'build' step. https://bugzilla.redhat.com/show_bug.cgi?id=1074170
* setup.py: Make have_libvirt_lxc a functionCole Robinson2014-03-251-9/+10
| | | | | This means we call it twice for a build operation, but I don't think that's a big deal.
* setup.py: Move module list building to its own functionCole Robinson2014-03-251-40/+57
| | | | | | | | Makes it a bit more clear what all that code is used for, rather than intermixing it with function definitions. Besides the comment additions, this is a no-op and just reindents the block, into a function.
* setup.py: Remove unused importCole Robinson2014-03-251-1/+0
|
* qemu: support arbitrary monitor eventsEric Blake2014-03-253-9/+269
| | | | | | | | | | | | | | | | | | | | | | Wrap the new virConnectDomainQemuMonitorEventRegister function added in libvirt 1.2.3. This patch copies heavily from network events (commit 6ea5be0) and from event loop callbacks in libvirt-override.c, since in the libvirt_qemu module, we must expose top-level functions rather than class members. * generator.py (qemu_skip_function): Don't generate event code. (qemuBuildWrappers): Delay manual portion until after imports. * libvirt-qemu-override.py (qemuMonitorEventRegister) (qemuMonitorEventDeregister): New file. * libvirt-qemu-override.c (libvirt_qemu_virConnectDomainQemuMonitorEventFreeFunc) (libvirt_qemu_virConnectDomainQemuMonitorEventCallback) (libvirt_qemu_virConnectDomainQemuMonitorEventRegister) (libvirt_qemu_virConnectDomainQemuMonitorEventDeregister) (libvirt_qemu_lookupPythonFunc, getLibvirtQemuDictObject) (getLibvirtQemuModuleObject): New functions. Signed-off-by: Eric Blake <eblake@redhat.com>
* event: fix domain reference bugsEric Blake2014-03-251-119/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Noticed this bug while adding qemu monitor events; there's probably lots of other misuse of libvirt_virDomainPtrWrap, but for now I'm limiting the fix to all copied-and-pasted event callbacks, since I'm about to copy it again in the next patch. While at it, check for failure to extract the "conn" key from the opaque callback struct, and hoist that check to occur before we reach the point where it is harder to undo on failure (the network code was the only code that had it in the right place, but then it failed to restore thread state on failure). The graphics callback is still not clean; but incremental improvements are better than nothing. * libvirt-override.c (libvirt_virConnectDomainEventCallback) (libvirt_virConnectDomainEvetnLifecycleCallback) (libvirt_virConnectDomainEventGenericCallback) (libvirt_virConnectDomainEventRTCChangeCallback) (libvirt_virConnectDomainEventWatchdogCallback) (libvirt_virConnectDomainEventIOErrorCallback) (libvirt_virConnectDomainEventIOErrorReasonCallback) (libvirt_virConnectDomainEventGraphicsCallback) (libvirt_virConnectDomainEventBlockJobCallback) (libvirt_virConnectDomainEventDiskChangeCallback) (libvirt_virConnectDomainEventTrayChangeCallback) (libvirt_virConnectDomainEventPMWakeupCallback) (libvirt_virConnectDomainEventPMSuspendCallback) (libvirt_virConnectDomainEventBalloonChangeCallback) (libvirt_virConnectDomainEventPMSuspendDiskCallback) (libvirt_virConnectDomainEventDeviceRemovedCallback): Don't pass NULL to PyObject_CallMethod. (libvirt_virConnectNetworkEventLifecycleCallback): Likewise, and don't corrupt thread state. Signed-off-by: Eric Blake <eblake@redhat.com>
* generator: Add virConnectDomainQemuMonitorEventCallback to skipped_typesMartin Kletzander2014-03-251-0/+1
| | | | Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* maint: balance {} usageEric Blake2014-03-241-6/+8
| | | | | | | | | | Emacs gets lost when finding function boundaries when #ifdef sections do not have balanced {}. * libvirt-override.c (libvirt_PyString_Check): New define. (virPyDictToTypedParams): Avoid unbalanced {} across ifdef. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: Add ctags configuration file and ignore the outputPeter Krempa2014-03-242-0/+3
| | | | | Add the config file to ease creation of tags to help navigation in editors.
* maint: set up preferred emacs settingsEric Blake2014-03-241-0/+8
| | | | | | | | | Copy the relevant settings from libvirt.git, so that emacs users maintain the style previously used before the two repos split. * .dir-locals.el: New file. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: ignore .pyc filesEric Blake2014-03-211-0/+1
| | | | | | * .gitignore: Add exemption. Signed-off-by: Eric Blake <eblake@redhat.com>
* override: Return NULL on python failure in getCPUModelNamesCole Robinson2014-03-201-1/+1
| | | | | Eric pointed this out on the last patch, but I pushed it before noticing his message.
* override: GetCPUModelNames should return None on failureCole Robinson2014-03-201-2/+2
| | | | | Right now, on failure, libvirt.py doesn't raise an exception and just returns -1 to the user.
* Add test for setting scheduler parametersDaniel P. Berrange2014-03-191-0/+19
| | | | | | | Add a test setting scheduler parameters to validate the previous bugfix to strncpy of field names. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Add support for running unit tests with noseDaniel P. Berrange2014-03-192-0/+21
| | | | | | | Make the 'python setup.py test' able to run unit tests found under tests/ through the 'nosetests' command Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* setPyVirTypedParameter: free whole return variable on errorMichal Privoznik2014-03-181-1/+1
| | | | | | | | | The @ret value is built in a loop. However, if in one iteration there's an error, we should free all the fields built so far. For instance, if there's an error and the previous item was type of VIR_TYPED_PARAM_STRING we definitely must free it. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* setPyVirTypedParameter: Copy full field nameMichal Privoznik2014-03-181-2/+1
| | | | | | | | | | | | | | | | | | In the setPyVirTypedParameter we try to produce virTypedParameter array from a python dictionary. However, when copying field name into item in returned array, we use strncpy() as the field name is fixed length array. To determine its size we use sizeof() but mistakenly dereference it resulting in sizeof(char) which equals to 1 byte. Moreover, there's no need for using sizeof() when we have a global macro to tell us the length of the field name: VIR_TYPED_PARAM_FIELD_LENGTH. And since array is allocated using VIR_ALLOC() we are sure the memory is initially filled with zeros. Hence, there's no need to terminate string we've just copied into field name with '\0' character. It's there for sure too as we copy up to field length - 1. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* Post release version bump to 1.2.3Daniel P. Berrange2014-03-031-1/+1
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Release of libvirt-python 1.2.2v1.2.2Daniel Veillard2014-03-021-1/+1
|
* generator: Skip exporting only sentinelsv1.2.2-rc2Martin Kletzander2014-02-201-5/+14
| | | | | | | | | | | | When enum type has '_LAST' in its name, but is not the last type in that enum, it's skipped even though it shouldn't be. Currently, this is the case for only VIR_NETWORK_UPDATE_COMMAND_ADD_LAST inside an enum virNetworkUpdateCommand. Also, since _LAST types can have other enums instead of values, that needs to be filtered out using a try-except when converting the value. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* Fix stream related spelling mistakesPhilipp Hahn2014-02-131-2/+2
| | | | | | Consistent spelling of all-uppercase I/O. Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples: demonstrate network eventsEric Blake2014-02-111-19/+51
| | | | | | | | | Commit 6ea5be0 added network event callback support, so we might as well demonstrate that it works by updating our example. * examples/event-test.py: Add network event, fix typos. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: ignore editor filesEric Blake2014-02-041-0/+2
| | | | | | * .gitignore: Exclude emacs cruft. Signed-off-by: Eric Blake <eblake@redhat.com>
* Merge tag 'v1.2.1'Eric Blake2014-02-031-1/+1
|\ | | | | | | Release of libvirt-python-1.2.1
| * Release of libvirt-python-1.2.1v1.2.1Daniel Veillard2014-01-161-1/+1
| |
* | Fix calling of virStreamSend methodRobie Basak2014-01-231-1/+1
|/ | | | | | | | | Change d40861 removed the 'len' argument from the virStreamSend C level wrapper, but forgot to remove it from the python level wrapper. Reported-by: Robie Basak <robie.basak@canonical.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* virStream.sendAll() fix raising an undeclared varv1.2.1-rc2Doug Goldstein2014-01-101-0/+1
| | | | | | The exception is raised from the variable 'e', which was undeclared in this context. Used code that is compatible with old and new Python versions.
* Add space after comma for consistency with code stylev1.2.1-rc1Doug Goldstein2014-01-021-1/+1
|
* define __GNUC_PREREQ macro before using itDoug Goldstein2013-12-301-0/+10
| | | | | | We brought over use of the __GNUC_PREREQ macro from libvirt but didn't bring over the definition of it. This brings over the macro from libvirt sources.
* Rewrite libvirt_charPtrUnwrap to work with Python 3.0->3.2Daniel P. Berrange2013-12-121-8/+11
| | | | | | | | The PyUnicode_AsUTF8 method doesn't exist prior to Python 3.3. It is also somewhat inefficient, so rewrite it to use an intermediate PyBytes object. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Add python3 to the automated build and RPMDaniel P. Berrange2013-12-122-9/+58
| | | | | | | | This updates autobuild.sh to test the python3 build process. The RPM specfile is changed to build a libvirt-python3 RPM on Fedora > 18 Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Skip network event callbacks in sanity testDaniel P. Berrange2013-12-111-0/+2
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix return type in override method for virStreamRecvDaniel P. Berrange2013-12-111-2/+3
| | | | | | The virStreamRecv override returns a PyObject not an int Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* sanitytest: remove use of string.lower()Daniel P. Berrange2013-12-111-2/+2
| | | | | | | Call lower() directly on the string object instance, not the class Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* sanitytest: Fix broken comparison between int and stringDaniel P. Berrange2013-12-111-1/+1
| | | | | | | Python2 was forgiving of a comparison between an int and string but Python3 gets very upset. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Switch virStreamSend wrapper to use libvirt_charPtrSizeUnwrapDaniel P. Berrange2013-12-113-5/+34
| | | | | | | | Instead of using a 'z#i' format string to receive byte array, use 'O' and then libvirt_charPtrSizeUnwrap. This lets us hide the Python 3 vs 2 differences in typewrappers.c Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Conditionalize use of PyString_Check and PyInt_CheckDaniel P. Berrange2013-12-111-0/+6
| | | | | | | The PyString and PyInt classes are gone in Python 3, so we must conditionalize their use to be Python 2 only. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* typewrappers: PyInt/PyLong merge for Python3Daniel P. Berrange2013-12-111-5/+28
| | | | | | | In Python3 the PyInt / PyLong types have merged into a single PyLong type. Conditionalize the use of PyInt to Python 2 only Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* typewrappers: Replace use of PyString classDaniel P. Berrange2013-12-111-0/+19
| | | | | | | | Replace use of PyString with either PyBytes or PyUnicode. The former is used for buffers with explicit sizes, which are used by APIs processing raw bytes. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>