From nobody Sun Feb 8 01:34:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561037013; cv=none; d=zoho.com; s=zohoarc; b=SHrReuP4ObMTlIbmXMIXhbu2bSBdpECJDrraHXsD47AAJmMhkZv2etrPtL8Ser7LcHdtciKc9DNjKW38vMJsYQ8W0UBTStEIW26Ywxkch17/SJrD/WAIiuewXcRDN523tx0ImNg4KEorH1cCcz7nK4tS3a4tAclCVm8cDKjpjkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561037013; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=EnWwKpTjD2TisnjxqDR93p9apweSs+JiEnvatFME8M8=; b=hjwsofFSmeX+Et/lDobXBBi1mpwg+5219NAIjZjv3uadNRMaQwwyo337dilhipCAUwCeTdgEVCPlR22D3F0IJAniA7IZYotKYuZz4F4Hnf28HF3cSDs4/cLhc+5S5/6uEIFCXFc4oMPosYVZAB4HHLUAVFp2u6FZfR7xEPtKDYs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561037013188481.97239236475366; Thu, 20 Jun 2019 06:23:33 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 29BCE30872F5; Thu, 20 Jun 2019 13:23:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 00A301001DDC; Thu, 20 Jun 2019 13:23:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5672A1806B0F; Thu, 20 Jun 2019 13:23:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5KDN9sW028980 for ; Thu, 20 Jun 2019 09:23:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3D89919C5B; Thu, 20 Jun 2019 13:23:09 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-65.ams2.redhat.com [10.36.112.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 764C719C4F; Thu, 20 Jun 2019 13:23:08 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 20 Jun 2019 14:22:57 +0100 Message-Id: <20190620132257.6233-6-berrange@redhat.com> In-Reply-To: <20190620132257.6233-1-berrange@redhat.com> References: <20190620132257.6233-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH python 5/5] Add missing impl of virNetworkListAllPorts X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 20 Jun 2019 13:23:31 +0000 (UTC) This API needs manual impl as the generator cannot cope Signed-off-by: Daniel P. Berrang=C3=A9 --- libvirt-override-virNetwork.py | 11 ++++++++ libvirt-override.c | 46 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 libvirt-override-virNetwork.py diff --git a/libvirt-override-virNetwork.py b/libvirt-override-virNetwork.py new file mode 100644 index 0000000..749ee44 --- /dev/null +++ b/libvirt-override-virNetwork.py @@ -0,0 +1,11 @@ + def listAllPorts(self, flags=3D0): + """List all domains and returns a list of domain objects""" + ret =3D libvirtmod.virNetworkListAllPorts(self._o, flags) + if ret is None: + raise libvirtError("virNetworkListAllPorts() failed", conn=3Ds= elf) + + retlist =3D list() + for domptr in ret: + retlist.append(virNetwork(self, _obj=3Ddomptr)) + + return retlist diff --git a/libvirt-override.c b/libvirt-override.c index c73305b..5ae4406 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -9946,6 +9946,51 @@ libvirt_virNodeGetSEVInfo(PyObject *self ATTRIBUTE_U= NUSED, #endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */ =20 #if LIBVIR_CHECK_VERSION(5, 5, 0) +static PyObject * +libvirt_virNetworkListAllPorts(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *pyobj_conn; + PyObject *py_retval =3D NULL; + virNetworkPtr conn; + virNetworkPortPtr *doms =3D NULL; + int c_retval =3D 0; + ssize_t i; + unsigned int flags; + + if (!PyArg_ParseTuple(args, (char *)"OI:virNetworkListAllPorts", + &pyobj_conn, &flags)) + return NULL; + conn =3D (virNetworkPtr) PyvirNetwork_Get(pyobj_conn); + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval =3D virNetworkListAllPorts(conn, &doms, flags); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) + return VIR_PY_NONE; + + if (!(py_retval =3D PyList_New(c_retval))) + goto cleanup; + + for (i =3D 0; i < c_retval; i++) { + VIR_PY_LIST_SET_GOTO(py_retval, i, libvirt_virNetworkPortPtrWrap(d= oms[i]), error); + /* python steals the pointer */ + doms[i] =3D NULL; + } + + cleanup: + for (i =3D 0; i < c_retval; i++) + if (doms[i]) + virNetworkPortFree(doms[i]); + VIR_FREE(doms); + return py_retval; + + error: + Py_CLEAR(py_retval); + goto cleanup; +} + static PyObject * libvirt_virNetworkPortSetParameters(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) @@ -10286,6 +10331,7 @@ static PyMethodDef libvirtMethods[] =3D { {(char *) "virNodeGetSEVInfo", libvirt_virNodeGetSEVInfo, METH_VARARGS= , NULL}, #endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */ #if LIBVIR_CHECK_VERSION(5, 5, 0) + {(char *) "virNetworkListAllPorts", libvirt_virNetworkListAllPorts, ME= TH_VARARGS, NULL}, {(char *) "virNetworkPortSetParameters", libvirt_virNetworkPortSetPara= meters, METH_VARARGS, NULL}, {(char *) "virNetworkPortGetParameters", libvirt_virNetworkPortGetPara= meters, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(5, 5, 0) */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list