summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* fix libvirt headers listv1.2.10Dmitry Guryanov2014-10-281-8/+18
| | | | | | | | Since libvirt.h has been split out, generator.py should be fixed accordingly. So add full list of header files. Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
* virDomainBlockCopy: initialize flags to 0Pavel Hrdina2014-10-221-1/+1
| | | | | | | An optional argument if not passed isn't modified by the PyArg_ParseTuple function. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* flags cannot get right value for blockCopy functionPavel Hrdina2014-10-221-2/+1
| | | | | | | | | | | When use blockCopy, flags cannot get a right value, because PyArg_ParseTuple want to get 6 parameters and blockCopy only pass 5. Flags will get a unpredictable value, this will make the function fail with error: unsupported flags (0x7f6c) in function qemuDomainBlockCopy Signed-off-by: Luyao Huang <lhuang@redhat.com>
* Fix rest of unsigned integer handlingPeter Krempa2014-10-224-68/+68
| | | | | As in the previous patch, fix all places where 'flags' is converted as a signed argument to unsigned including the python code generator.
* Fix parsing of 'flags' argument for bulk stats functionsLuyao Huang2014-10-221-2/+2
| | | | | | | | | | | | | | | | | | | | When 'flags' is set to 'libvirt.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, python will report a error: OverflowError: signed integer is greater than maximum as VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS is defined as 1<<31. This happens as PyArg_ParseTuple's formatting string containing 'i' as a modifier expects a signed integer. With python >= 2.3, 'I' means unsigned int and 'i' means int so we should use 'I' in the formatting string. See: https://docs.python.org/2/c-api/arg.html Signed-off-by: Luyao Huang <lhuang@redhat.com> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
* Fix function name when parsing arguments in libvirt_virNodeAllocPagesPeter Krempa2014-10-221-1/+1
| | | | | | The override function was copied&pasted from virConnectGetAllDomainStats and the function name after the colon was not changed. Fix the issue as an invalid name would appear in the error message.
* Improve error output when use getTime with a nonzero flags.Luyao Huang2014-10-201-1/+3
| | | | | | | | When give a nonzero flags to getTime, c_retval will get -1 and goto cleanup. But py_retval still is NULL, so set py_retval = VIR_PY_NONE. This will make the output message more correct. Signed-off-by: Luyao Huang <lhuang@redhat.com>
* Change the comment in getPyNodeCPUCount method reflecting correct called methodsPradipta Kr. Banerjee2014-10-161-2/+2
| | | | | | | | Comment mentions virGetNodeCPUMap whereas the actual method is virNodeGetCPUMap. Similarly comment mentions virGetNodeInfo whereas the actual method is virNodeGetInfo Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com>
* setup.py: fix rpm build to return 1 on errorPavel Hrdina2014-10-071-2/+2
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* sanitytest: define long for python version >= 3Martin Kletzander2014-10-071-0/+3
| | | | | | | | | Commit c58c7f362aab37e4961407c2efc8a74925ed9c37 fixed 32-bit python build but broke build with python3 due to the lack of 'long' in the newer version of python. This patch aims to fix it with a simple string comparison of sys.version and '3'. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* sanitytest: count with the fact that large enums can be longMartin Kletzander2014-10-071-1/+1
| | | | | | | | | On 32-bit systems, one new flag that has the value of 1 << 31, namely VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, fails to fit into an 'int' on python and is therefore of type 'long'. Fix sanitytest to count with such fact in order to avoid build failures on 32-bit systems. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* sanitytest: check for exported enumsMartin Kletzander2014-10-061-2/+51
| | | | | | | | | We are already collecting list of enums exported and list of enums we want to have available. Event though there was an issue with one enum fixed with 014d9bbaf368b33a881f1d6b2fd8a5dd285a4f71, there was no test for it and this commit tries to fix that. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* Post-release version bump for new dev cyclePavel Hrdina2014-10-021-1/+1
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* implement new tunable eventv1.2.9Pavel Hrdina2014-09-303-0/+76
| | | | | | Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1147639 Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Implement new virNodeAllocPages APIMichal Privoznik2014-09-263-0/+77
| | | | Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* generator: Free strings after libvirt_charPtrWrapMichal Privoznik2014-09-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1140998 Up till bb3301ba the wrapper was freeing the passed strings for us. However that changed after the commit. So now we don't free any strings which results in memory leaks as reported upstream [1]: ==14265== 2,407 bytes in 1 blocks are definitely lost in loss record 1,457 of 1,550 ==14265== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==14265== by 0x5C46624: xdr_string (in /usr/lib64/libc-2.17.so) ==14265== by 0xCFD9FCD: xdr_remote_nonnull_string (remote_protocol.c:31) ==14265== by 0xCFDC2C8: xdr_remote_domain_get_xml_desc_ret (remote_protocol.c:1617) ==14265== by 0xCFF0811: virNetMessageDecodePayload (virnetmessage.c:407) ==14265== by 0xCFE68FB: virNetClientProgramCall (virnetclientprogram.c:379) ==14265== by 0xCFBE8B1: callFull.isra.2 (remote_driver.c:6578) ==14265== by 0xCFC7F04: remoteDomainGetXMLDesc (remote_driver.c:6600) ==14265== by 0xCF8167C: virDomainGetXMLDesc (libvirt.c:4380) ==14265== by 0xCC2C4DF: libvirt_virDomainGetXMLDesc (libvirt.c:1141) ==14265== by 0x4F12B93: PyEval_EvalFrameEx (in /usr/lib64/libpython2.7.so.1.0) ==14265== by 0x4F141AC: PyEval_EvalCodeEx (in /usr/lib64/libpython2.7.so.1.0) The python documentation clearly advise us to call free() [2]. From an example in their docs: PyObject *res; char *buf = (char *) malloc(BUFSIZ); /* for I/O */ if (buf == NULL) return PyErr_NoMemory(); ...Do some I/O operation involving buf... res = PyString_FromString(buf); free(buf); /* malloc'ed */ return res; Moreover, instead of using VIR_FREE() (which we are not exporting), I'll just go with bare free(). 1: https://www.redhat.com/archives/libvir-list/2014-September/msg00736.html 2: https://docs.python.org/2/c-api/memory.html Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* override: Fix two uninitialized variables in convertDomainStatsRecordPeter Krempa2014-09-021-2/+2
| | | | | | | | py_record_domain and py_record_stats would be accessed uninitialized if an out-of-memory condition would happen in the first loop. Unlikely, but coverity complained. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1136354
* libvirt-override: fix some build warningsPavel Hrdina2014-09-021-3/+0
| | | | | | | | Remove unused label 'cleanup' in 'libvirt_virConnectGetAllDomainStats' function and remove unused variable 'conn' in function 'libvirt_virDomainListGetStats'. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Post-release version bump for new dev cycleMichal Privoznik2014-09-021-1/+1
| | | | Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* Implement API bindings for virDomainBlockCopyv1.2.8Pavel Hrdina2014-09-023-0/+45
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* API: Implement bindings for virDomainListGetStatsPavel Hrdina2014-09-014-0/+103
| | | | | | | | Implement the function by returning a list of tuples instead the array of virDomainStatsRecords and store the typed parameters as dict. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* API: Implement bindings for virConnectGetAllDomainStatsPeter Krempa2014-09-013-0/+149
| | | | | | | | Implement the function by returning a list of tuples instead the array of virDomainStatsRecords and store the typed parameters as dict. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* API: Skip 'virDomainStatsRecordListFree'Peter Krempa2014-09-012-0/+4
| | | | | | | | The new API function doesn't make sense to be exported in python. The bindings will return native types instead of the struct array. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* generator: resolve one level of enum referencePavel Hrdina2014-09-011-1/+15
| | | | | | | | | | | | | In the libvirt.h we have one enum defined by references from another enum and it leads in wrong order of definitons in python code. To prevent this we should resolve that references before we generate the python code. For now we have only one level of references so we will count with that in the generator but we should update it in the future to be more flexible. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* build: Fix build warning on libvirt-pythonMo Yuxiang2014-08-191-1/+2
| | | | | | | | | | | | | | On compiling libvirt-python, we get such a warning: libvirt-qemu-override.c: In function ‘libvirt_qemu_virConnectDomainQemuMonitorEventRegister’: libvirt-qemu-override.c:304: warning: suggest explicit braces to avoid ambiguous ‘else’ Py_DECREF is a macro using if/else on older Python releases. The solution is to add braces. Python 2.7 and newer has the macro wrapped in a do { } while(0) block. Signed-off-by: Mo Yuxiang <Moyuxiang@huawei.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* Fix libvirt_longlongWrap returning a very large valueZhou Yimin2014-08-112-10/+10
| | | | | | | | | | | | | | | | If hypervisor is not Xen, the errs in struct _virDomainBlockStats will be -1. But in KVM when we call domain.blockStats(), errs is 18446744073709551615. To fix that, this patch has two changes: 1. Replace use of the PyLong_FromUnsignedLongLong with PyLong_FromLongLong in function libvirt_longlongWrap 2. If the paramemter of libvirt_longlongWrap is unsigned long long, use libvirt_ulonglongWrap instead because of above change. After this patch, errs is -1 which is consistent with virDomainBlockStats api. Signed-off-by: Zhou Yimin <zhouyimin@huawei.com> Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
* maint: document use of libvirt's run scriptEric Blake2014-08-041-3/+4
| | | | | | | | | Ever since libvirt commit 78c09530, it's easier to just use the run script. * README: Mention run script. Signed-off-by: Eric Blake <eblake@redhat.com>
* Bump version to 1.2.8 for new dev cycleEric Blake2014-08-041-1/+1
| | | | Signed-off-by: Eric Blake <eblake@redhat.com>
* spec: Reorganize to satisfy buggy spectoolv1.2.7Jiri Denemark2014-07-291-8/+6
| | | | | | | | spectool parses a specfile and strips everything but a preamble. However, if the first section is preceded by %if clause, it keeps it there which then makes rpmbuild complain about unmatched %if. Let's make the buggy tool happy by moving sections around so that the first one is not in any conditional.
* Bump version to 1.2.7 for new dev cycleMartin Kletzander2014-07-221-1/+1
| | | | Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* Implement new virNetworkGetDHCPLeases APIv1.2.6-rc2v1.2.6Nehal J Wani2014-06-276-0/+159
| | | | | | | | | | | | | | | | This API returns a list of DHCP leases for all network interfaces connected to the given virtual network or limited output just for one interface if mac is specified. Example Output: [{'iface': 'virbr3', 'ipaddr': '192.168.150.181', 'hostname': 'ubuntu14', 'expirytime': 1403737495L, 'prefix': 24, 'clientid': None, 'mac': '52:54:00:e8:73:eb', 'iaid': None, 'type': 0}, {'iface': 'virbr3', 'ipaddr': '2001:db8:ca2:2:1::bd', 'hostname': 'fedora20-test', 'expirytime': 1403738587L, 'prefix': 64, 'clientid': '00:04:b1:d8:86:42:e1:6a:aa:cf:d5:86:94:23:6f:94:04:cd', 'mac': '52:54:00:5b:40:98', 'iaid': '5980312', 'type': 1}] Signed-off-by: Peter Krempa <pkrempa@redhat.com>
* maint: document development against uninstalled libvirtEric Blake2014-06-251-0/+15
| | | | | | | | | Thanks to Dan's recent work in libvirt.git, it is much easier to develop against uninstalled libvirt. Mention how. * README: More details. Signed-off-by: Eric Blake <eblake@redhat.com>
* build: use correct int conversion in NodeGetFreePagesNehal J Wani2014-06-251-1/+1
| | | | | | | | | | | | | | | | | | Commit c8ba859bc7 introduced a compiler warning while un-wrapping a python object to uint in libvirt_virNodeGetFreePages. On compiling libvirt-python against libvirt 1.2.6, we get: libvirt-override.c: In function ‘libvirt_virNodeGetFreePages’: libvirt-override.c:7811:9: warning: pointer targets in passing argument 2 of ‘libvirt_intUnwrap’ differ in signedness [-Wpointer-sign] if (libvirt_intUnwrap(tmp, &pages[i]) < 0) ^ In file included from libvirt-override.c:24:0: typewrappers.h:169:5: note: expected ‘int *’ but argument is of type ‘unsigned int *’ int libvirt_intUnwrap(PyObject *obj, int *val); ^ Signed-off-by: Eric Blake <eblake@redhat.com>
* Implement new virNodeGetFreePages APIMichal Privoznik2014-06-203-0/+117
| | | | | | | | | | | | | | | | | | | | The API expose information on host's free pages counts. For easier access, in python this API returns a dictionary such as: In [4]: conn.getFreePages([2048,1*1024*1024], -1, 5) Out[4]: {-1: {2048: 114, 1048576: 4}, 0: {2048: 3, 1048576: 1}, 1: {2048: 100, 1048576: 1}, 2: {2048: 10, 1048576: 1}, 3: {2048: 1, 1048576: 1}} At the top level of the returned dictionary there's a pair of <NUMA node> and another dictionary that contains detailed information on each supported page size. The information then consists of fairs of <page size> and <count of free pages>. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* Correct virDomainMigrateToURI3 definitionJason Andryuk2014-06-191-1/+1
| | | | | dconnuri is a string, so update the definition to match. Without this, the generated python would fail when passed a string.
* build: provide wrapper makefileEric Blake2014-06-181-0/+18
| | | | | | | | | | | After years of finger training, I'm so used to 'make check' just working, that I lose quite a bit of time re-learning that in this project, it is spelled 'python setup.py build check'. A shim makefile bridges the gap. * Makefile: New file. Signed-off-by: Eric Blake <eblake@redhat.com>
* 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.