IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
This is particularly useful on operating systems that don't ship
Python as part of the base system (eg. FreeBSD) while still working
just as well as it did before on Linux.
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Most of the code treats libvirt API calls as separate block, keeping one
blank line before the LIBVIRT_BEGIN_ALLOW_THREAD, and one blank line
after LIBVIRT_END_ALLOW_THREADS. Unify the whitespace so all calls
wrapped with these macros are treated as a separate block.
We discovered that the entire python process get stuck for about 30
seconds when calling virDomain.getMemoryStats() if libvirt is stuck in
virConnect.getAllDomainStats() on inaccessible storage. This blocking
cause a horrible mess in oVirt.
This patches adds the standard *_ALLOW_THREADS around the call to avoid
this unwanted blocking.
Signed-off-by: Nir Soffer <nirsof@gmail.com>
Latest GCC versions are unhappy with us treating an integer
arithmetic result as a boolean:
libvirt-utils.c: In function ‘virReallocN’:
libvirt-utils.c:111:23: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
if (!tmp && (size * count)) {
~~~~~~^~~~~~~~
Add an explicit comparison '!= 0' to keep it happy, since its
suggestion to use '&&' is nonsense.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
When python3 builds C modules, it adds the -Wsign-compare flag to GCC.
This creates lots of warnings where we compare a 'size_t' value against
an 'int' value due to signed/unsigned difference. Change all the size_t
types to ssize_t to address this.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
The intended use is to ensure that the implementation is empty, which is
one way to ensure that all connections were properly closed and file
descriptors reclaimed.
Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
Since 7534c19 it is not possible to register event implementation twice.
Instead, allow for retrieving the current one, should it be needed
afterwards.
Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
- Descriptor.close() was a dead code, never used.
- TimeoutCallback.close(), as a cleanup function, should have called
super() as last statement, not first
Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
This was a harmless bug, without any impact, but it is wrong to manage
the collection of callbacks from it's members.
Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
When the callback causes something that results in changes wrt
registered handles, python aborts iteration.
Relevant error message:
Exception in callback None()
handle: <Handle cancelled>
Traceback (most recent call last):
File "/usr/lib64/python3.5/asyncio/events.py", line 126, in _run
self._callback(*self._args)
File "/usr/lib64/python3.5/site-packages/libvirtaio.py", line 99, in _handle
for callback in self.callbacks.values():
RuntimeError: dictionary changed size during iteration
QubesOS/qubes-issues#2805
Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
This logging is helpful for tracing problems with unclosed connections
and leaking file descriptors.
Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
Enable builds on several python versions, and against several versions
of libvirt. Ideally we would build all the way back to 0.9.11, since
that is the min supported libvirt for python binding. It is not possible
to build this old libvirt version on modern distros though, so using
1.2.0 as the oldest for now.
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
The sanity test check aims to ensure that every function listed in
the Python code maps to a corresponding C function. The Sparse
send/recv methods are special though - we're never calling the
corresponding C APIs, instead we have a pure python impl.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
The C library will now ignore an attempt to register an event
loop twice. It is unable to report an error in this case though
due to the C API returning 'void'. To improve this we must
manually report an error at the python level.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
We only want to obsolete versions which actually had the
original name, not all future versions.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This complies with Fedora naming policy for python packages
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
We've forgot to include VIR_DOMAIN_MEMORY_STAT_USABLE and
VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE constants.
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
In commit a8eba5036cb4b0e2ec827e9e6e019ce70e451377, libvirt added
support for two more details. In python bindings it all worked fine
automagically except an example that was not updated.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1463188
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
The virDomainGetTime returns either a dict or None, but the python
glue layer for checking for '-1'. Thus it failed to raise an
exception on error.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Sparse streams are not that straight forward to use for the very
first time. Especially the sparseRecvAll() and sparseSendAll()
methods which expects callbacks. What we can do to make it easier
for developers is to have an example where they can take an
inspiration from.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Yet again, our parser is not capable of generating proper
wrapper. To be fair, this one wold be really tough anyway.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Yet again, we need a custom wrapper over virStreamRecvFlags
because our generator is not capable of generating it.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
The return value for virStreamRecvHole is slightly different to
its C counterpart. In python, either it returns the hole size or
None if C API fails.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This was being done due to now deprecated policy and that file should
be installed so that pip can recognize that the packages is already
installed in the system.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
The event test program '--loop' arg is modified to take the name
of an event loop impl to run. eg 'event-test.py --loop asyncio'
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Use the name 'Poll' instead of 'Pure' for the event loop demo,
since there's now a second pure python loop impl available.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
In order to test cleanup code paths we must unregister all callbacks
and close the connection on shutdown. Since cleanup happens in the
background, we do a short sleep to allow the main loop to run its
cleanup too.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
The pure python event loop impl has to call
libvirt.virEventInvokeFreeCallback
to free the event opaque data from a clean stack context
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This is usable only on python >= 3.4 (or 3.3 with out-of-tree asyncio),
however it should be harmless for anyone with older python versions.
In simplest case, to have the callbacks queued on the default loop:
>>> import libvirtaio
>>> libvirtaio.virEventRegisterAsyncIOImpl()
The function is not present on non-compatible platforms.
Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
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>
The 'functions_list_exception_test' data structure and associated code
in the generator is inherited from libxml. This has never
been used in libvirt, so delete it to simplify the generator.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
The 'converter_type' data structure and associated code
in the generator is inherited from libxml. This has never
been used in libvirt, so delete it to simplify the generator.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>