From nobody Mon May 6 20:05:09 2024 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=1568292824; cv=none; d=zoho.com; s=zohoarc; b=km4lwWu9evXjMIMOCUKWXwFlUtovxHywozHDr50qzKb15KOBa8qo9pkah2zXmqsvtebrpo8ggC+86/mEPxyZzc8LjgpuWVkSgS1upgAT/LXOs2g4IZWCeOQj/AGfRbJyVTVo1CAg5NDYc0oFsQZrdRv4xAWMbVEkcAU7XyqzC4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568292824; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=3QZYUgls+repzMyB39AVANwAe0AKiG7p99gIzeHvloA=; b=j3nMzWYRfJLvtr8vX0B483EnXRvFfveS+AAxFgnbnagN1YE9PL4xrazphpBSaZLqmR5FccwAwR03sCzIynTU882HjcTmrJ0sfcR1zHOyWRqMnLS6E97b2CBQ2S2K1vhhnBXK0TVlAPGj7JwZ6eb5MrUptXmc+fqnvQUc1YLp8rk= 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 1568292824459372.70040234425323; Thu, 12 Sep 2019 05:53:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1605C3084025; Thu, 12 Sep 2019 12:53:42 +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 AD2955D9E2; Thu, 12 Sep 2019 12:53:41 +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 9A201180B536; Thu, 12 Sep 2019 12:53:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8CCrdH9010174 for ; Thu, 12 Sep 2019 08:53:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2441F600C4; Thu, 12 Sep 2019 12:53:39 +0000 (UTC) Received: from dhcp-17-64.lcy.redhat.com (unknown [10.42.17.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9407D6013A; Thu, 12 Sep 2019 12:53:35 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 12 Sep 2019 13:53:34 +0100 Message-Id: <20190912125334.31174-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [python PATCH] generator: fix constructor for virNetworkPort 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.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 12 Sep 2019 12:53:42 +0000 (UTC) The virNetworkPort class is passed both the virNetwork parent python class and the virNetworkPort C object. This needs special handling in the generator, similar to how virDomainSnapshots are dealt with. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- generator.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/generator.py b/generator.py index 0b0a5a7..433c1f2 100755 --- a/generator.py +++ b/generator.py @@ -1083,6 +1083,10 @@ class_domain_impl =3D { "virDomainSnapshot": True, } =20 +class_network_impl =3D { + "virNetworkPort": True, +} + functions_noexcept =3D { 'virDomainGetID': True, 'virDomainGetName': True, @@ -1551,6 +1555,8 @@ def buildWrappers(module): classes.write(" def __init__(self, conn, _obj=3DNone):\= n") elif classname in [ "virDomainCheckpoint", "virDomainSnapshot"= ]: classes.write(" def __init__(self, dom, _obj=3DNone):\n= ") + elif classname in [ "virNetworkPort" ]: + classes.write(" def __init__(self, net, _obj=3DNone):\n= ") else: classes.write(" def __init__(self, _obj=3DNone):\n") if classname in [ "virDomain", "virNetwork", "virInterface", @@ -1564,6 +1570,9 @@ def buildWrappers(module): elif classname in [ "virDomainCheckpoint", "virDomainSnapshot"= ]: classes.write(" self._dom =3D dom\n") classes.write(" self._conn =3D dom.connect()\n") + elif classname in [ "virNetworkPort" ]: + classes.write(" self._net =3D net\n") + classes.write(" self._conn =3D net.connect()\n") classes.write(" if type(_obj).__name__ not in [\"PyCaps= ule\", \"PyCObject\"]:\n") classes.write(" raise Exception(\"Expected a wrappe= d C Object but got %s\" % type(_obj))\n") classes.write(" self._o =3D _obj\n\n") @@ -1585,6 +1594,10 @@ def buildWrappers(module): classes.write(" def domain(self):\n") classes.write(" return self._dom\n\n") =20 + if classname in class_network_impl: + classes.write(" def network(self):\n") + classes.write(" return self._net\n\n") + classes.write(" def c_pointer(self):\n") classes.write(" \"\"\"Get C pointer to underlying objec= t\"\"\"\n") classes.write(" return libvirtmod.%s_pointer(self._o)\n= \n" % --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list