| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Philipp Hahn <hahn@univention.de>
|
|
|
|
|
|
|
| |
static typing forbids re-declaring a variable with different types.
Rename the variable.
Signed-off-by: Philipp Hahn <hahn@univention.de>
|
|
|
|
| |
Signed-off-by: Philipp Hahn <hahn@univention.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
sys.exc_info() returns a 3-tuple (type, value, traceback). Raising just
`value` again looses the traceback information as this creates a new
exception.
Just use `raise` which re-raises the previous exception including the
original traceback.
FYI: There is a subtile difference between Python 2 and Python 3:
> try:
> raise ValueError()
> except ValueError:
> try:
> raise TypeError()
> except TypeError:
> pass
> raise
With Python 3 the exception environment is dropped after the exception
has been handled - as such Python 3 re-raises the outer ValueError.
With Python 2 the last (inner) exception is raised: TypeError
Signed-off-by: Philipp Hahn <hahn@univention.de>
|
|
|
|
|
|
| |
as it also catches SystemExit, InterruptedError, SyntaxError and such.
Signed-off-by: Philipp Hahn <hahn@univention.de>
|
|
|
|
|
|
|
| |
handler() should either return bytes or -2 or -3.
Explicitly raise ValueError or TypeError to silence mypy.
Signed-off-by: Philipp Hahn <hahn@univention.de>
|
|
|
|
| |
Signed-off-by: Philipp Hahn <hahn@univention.de>
|
|
|
|
|
|
|
| |
indent by 4 spaces
one spaces around assignments
Signed-off-by: Philipp Hahn <hahn@univention.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are four methods which receive/send entire stream
(sendAll(), recvAll(), sparseSendAll() and sparseRecvAll()). All
these have an intermediary buffer which is either filled by
incoming stream and passed to a user provided callback to handle
the data, or the other way round - user fills it with data they
want to send and the buffer is handed over to virStream.
But the buffer is incredibly small which leads to smaller packets
being sent and thus increased overhead. What we can do is to use
the same buffer as their C counterparts do (e.g.
virStreamSendAll()) - they all use VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX
long buffer (which is the maximum size of a stream packet we
send) - this is almost exactly 256KiB (it's 256KiB - 24B for the
header).
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
|
|
|
|
| |
Variable ret is used before assignment.
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.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>
|
|
|
|
|
| |
In Python 3, if the file is open in binary mode, @got will end up
being equal to b"" and b"" != "" in Python 3.
|
|
|
|
|
|
| |
Consistent spelling of all-uppercase I/O.
Signed-off-by: Philipp Hahn <hahn@univention.de>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
Consistently use "is" or "is not" to compare variables to None,
because doing so is preferrable, as per PEP 8
(http://www.python.org/dev/peps/pep-0008/#programming-recommendations):
> Comparisons to singletons like None should always be done with is or
> is not, never the equality operators.
|
|
|
|
|
|
| |
* python/libvirt-override-virStream.py: fix a copy-paste error in sendAll().
Signed-off-by: Alex Jia <ajia@redhat.com>
|
|
|
|
| |
This was fixed in be757a3f7baf93b for libvirt.c.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
Pure python implementation. The handler callbacks have been altered
a bit compared to the C API: RecvAll doesn't pass length of the data read
since that can be trivially obtained from python string objects, and SendAll
requires the handler to return the string data to send rather than
store the data in a string pointer.
|
|
|
|
|
|
|
| |
The return values for the python version are different that the C version
of virStreamSend: on success we return a string, an error raises an exception,
and if the stream would block we return int(-2). We need to do this
since strings aren't passed by reference in python.
|
|
|
|
|
| |
v2:
Don't generate virStreamFree
|
|
* include/libvirt/libvirt.h.in: Public API contract for
virStreamPtr object
* src/libvirt_public.syms: Export data stream APIs
* src/libvirt_private.syms: Export internal helper APIs
* src/libvirt.c: Data stream API driver dispatch
* src/datatypes.h, src/datatypes.c: Internal helpers for virStreamPtr
object
* src/driver.h: Define internal driver API for streams
* .x-sc_avoid_write: Ignore src/libvirt.c because it trips
up on comments including write()
* python/Makefile.am: Add libvirt-override-virStream.py
* python/generator.py: Add rules for virStreamPtr class
* python/typewrappers.h, python/typewrappers.c: Wrapper
for virStreamPtr
* docs/libvirt-api.xml, docs/libvirt-refs.xml: Regenerate
with new APIs
|