Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1750677

Summary: net.portLookupByUUIDString got multiple values for argument '_obj'
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: yalzhang <yalzhang>
Component: libvirt-pythonAssignee: Daniel Berrangé <berrange>
Status: CLOSED ERRATA QA Contact: lcheng
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1CC: berrange, jdenemar, lcheng, lhuang, lmen, xuzhang
Target Milestone: rcFlags: knoel: mirror+
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-python-5.9.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-05 09:49:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1585087    

Description yalzhang@redhat.com 2019-09-10 08:42:41 UTC
Description of problem:
net.portLookupByUUIDString got multiple values for argument '_obj'

Version-Release number of selected component (if applicable):
# rpm -q libvirt python3-libvirt
libvirt-5.6.0-2.el8.x86_64
python3-libvirt-5.6.0-1.module+el8.1.0+3891+3b51c436.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
# python3
Python 3.6.8 (default, Aug  6 2019, 19:43:07) 
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open()
>>> net = conn.networkLookupByName("default")
>>> net.portLookupByUUIDString('00b7c5cb-d5b0-4552-90f1-0522b51ceec9')
<capsule object "virNetworkPortPtr" at 0x7fd4dc5d1d50>
Exception ignored in: <bound method virNetworkPort.__del__ of <libvirt.virNetworkPort object at 0x7fd4daf97ef0>>
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 3169, in __del__
    if self._o is not None:
AttributeError: 'virNetworkPort' object has no attribute '_o'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 3124, in portLookupByUUIDString
    __tmp = virNetworkPort(self, _obj=ret)
TypeError: __init__() got multiple values for argument '_obj'


Actual results:
net.portLookupByUUIDString got multiple values for argument '_obj'

Expected results:
it should not report error

Additional info:

Comment 1 Daniel Berrangé 2019-09-12 12:55:20 UTC
Patch proposed upstream

https://www.redhat.com/archives/libvir-list/2019-September/msg00480.html

Comment 2 Daniel Berrangé 2019-09-12 15:14:17 UTC
Merged upstream as

commit 6dff8e4f3f7c817cd3b1b50ce2d7f396523ae24c (net-port-cons)
Author: Daniel P. Berrangé <berrange>
Date:   Thu Sep 12 13:51:00 2019 +0100

    generator: fix constructor for virNetworkPort
    
    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.
    
    Reviewed-by: Michal Privoznik <mprivozn>
    Signed-off-by: Daniel P. Berrangé <berrange>

commit 6b2b3b7ea2de7affa7f1345099bab490418bad98 
Author: Daniel P. Berrangé <berrange>
Date:   Thu Sep 12 16:09:58 2019 +0100

    sanitytest: whitelist 'network' method as having no C impl
    
    Signed-off-by: Daniel P. Berrangé <berrange>

Comment 4 lcheng 2020-02-02 04:41:45 UTC
Verified on python3-libvirt-6.0.0-1.module+el8.2.0+5453+31b2b136.x86_64.

# python
Python 3.6.8 (default, Dec  5 2019, 15:45:45) 
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open()
>>> net = conn.networkLookupByName('default')
>>> net.portLookupByUUIDString('43d3260d-0fcb-44aa-9571-d2efc53fad07')
<libvirt.virNetworkPort object at 0x7f65cebfd6d8>
>>> net.portLookupByUUID(b'C\xd3&\r\x0f\xcbD\xaa\x95q\xd2\xef\xc5?\xad\x07')<libvirt.virNetworkPort object at 0x7f65ce52cd30>


Move to VERIFIED.

Comment 6 errata-xmlrpc 2020-05-05 09:49:41 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2017