| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
dconnuri is a string, so update the definition to match. Without this,
the generated python would fail when passed a string.
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
As is now done with libvirt. git head will always have the version
number of the expected *next* release.
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
This means we call it twice for a build operation, but I don't think
that's a big deal.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Add the config file to ease creation of tags to help navigation in
editors.
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
* .gitignore: Add exemption.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
| |
Eric pointed this out on the last patch, but I pushed it before noticing
his message.
|
|
|
|
|
| |
Right now, on failure, libvirt.py doesn't raise an exception and just
returns -1 to the user.
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Consistent spelling of all-uppercase I/O.
Signed-off-by: Philipp Hahn <hahn@univention.de>
|
|
|
|
|
|
|
|
|
| |
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>
|