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é <berrange@xxxxxxxxxx> --- 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 = { "virDomainSnapshot": True, } +class_network_impl = { + "virNetworkPort": True, +} + functions_noexcept = { 'virDomainGetID': True, 'virDomainGetName': True, @@ -1551,6 +1555,8 @@ def buildWrappers(module): classes.write(" def __init__(self, conn, _obj=None):\n") elif classname in [ "virDomainCheckpoint", "virDomainSnapshot" ]: classes.write(" def __init__(self, dom, _obj=None):\n") + elif classname in [ "virNetworkPort" ]: + classes.write(" def __init__(self, net, _obj=None):\n") else: classes.write(" def __init__(self, _obj=None):\n") if classname in [ "virDomain", "virNetwork", "virInterface", @@ -1564,6 +1570,9 @@ def buildWrappers(module): elif classname in [ "virDomainCheckpoint", "virDomainSnapshot" ]: classes.write(" self._dom = dom\n") classes.write(" self._conn = dom.connect()\n") + elif classname in [ "virNetworkPort" ]: + classes.write(" self._net = net\n") + classes.write(" self._conn = net.connect()\n") classes.write(" if type(_obj).__name__ not in [\"PyCapsule\", \"PyCObject\"]:\n") classes.write(" raise Exception(\"Expected a wrapped C Object but got %s\" % type(_obj))\n") classes.write(" self._o = _obj\n\n") @@ -1585,6 +1594,10 @@ def buildWrappers(module): classes.write(" def domain(self):\n") classes.write(" return self._dom\n\n") + 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 object\"\"\"\n") classes.write(" return libvirtmod.%s_pointer(self._o)\n\n" % -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list