On Tue, May 23, 2017 at 12:52:34PM +0200, Martin Kletzander wrote:
On Mon, May 22, 2017 at 12:57:12PM +0200, Michal Privoznik wrote: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@xxxxxxxxxx> --- generator.py | 2 ++ libvirt-override-virStream.py | 21 +++++++++++++++ libvirt-override.c | 63 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) diff --git a/libvirt-override.c b/libvirt-override.c index a762941..b5e11ed 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -9463,6 +9463,65 @@ libvirt_virConnectSecretEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED, } #endif /* LIBVIR_CHECK_VERSION(3, 0, 0)*/ + +#if LIBVIR_CHECK_VERSION(3, 4, 0) +static PyObject * +libvirt_virStreamRecvHole(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *pyobj_stream; + virStreamPtr stream; + long long length = -1; + unsigned int flags; + int ret; + + if (!PyArg_ParseTuple(args, (char *) "OI:virStreamRecvHole", + &pyobj_stream, &flags)) + return NULL; + + stream = PyvirStream_Get(pyobj_stream); + + LIBVIRT_BEGIN_ALLOW_THREADS; + ret = virStreamRecvHole(stream, &length, flags); + LIBVIRT_END_ALLOW_THREADS; + + DEBUG("StreamRecvHole ret=%d length=%lld\n", ret, length); + + if (ret < 0) + return VIR_PY_NONE; + + return libvirt_longlongWrap(length); +} + + +static PyObject * +libvirt_virStreamSendHole(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *pyobj_stream; + virStreamPtr stream; + long long length; + unsigned int flags; + int ret; + + if (!PyArg_ParseTuple(args, (char *) "OKI:virStreamSendHole",s/OKI/OLI/, I believe
Oh, and ACK of course.
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list