[libvirt] [libvirt-python][PATCH 1/4] Implement virStreamSendHole/virStreamRecvHole

Martin Kletzander mkletzan at redhat.com
Tue May 23 12:11:49 UTC 2017


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 at redhat.com>
>>---
>> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170523/c324e310/attachment-0001.sig>


More information about the libvir-list mailing list