Description of problem: listAllPorts() cann't list all network ports. Version-Release number of selected component (if applicable): python3-libvirt-5.10.0-1.module+el8.2.0+5145+c579b816.x86_64 libvirt-5.10.0-1.module+el8.2.0+5135+ed3b2489.x86_64 How reproducible: 100% Steps to Reproduce: # 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") >>> port_list = net.listAllPorts() >>> port_list [<libvirt.virNetwork object at 0x7f978e547550>, <libvirt.virNetwork object at 0x7f978e547ac8>] >>> port_list[0].XMLDesc() libvirt: Network Driver error : invalid network pointer in virNetworkGetXMLDesc Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/python3.6/site-packages/libvirt.py", line 3063, in XMLDesc if ret is None: raise libvirtError ('virNetworkGetXMLDesc() failed', net=self) libvirt.libvirtError: invalid network pointer in virNetworkGetXMLDesc Actual results: listAllPorts() get a libvirt.virNetwork object list. Expected results: listAllPorts() get a libvirt.virNetworkPort object list. Additional info: Repeat listAllPorts() will get following error. >>> port_list = net.listAllPorts() libvirt: Network Driver error : invalid network pointer in virNetworkFree >>> port_list = net.listAllPorts() libvirt: Network Driver error : invalid network pointer in virNetworkFree libvirt: Network Driver error : invalid network pointer in virNetworkFree >>> port_list = net.listAllPorts() libvirt: Network Driver error : invalid network pointer in virNetworkFree libvirt: Network Driver error : invalid network pointer in virNetworkFree
Fix proposed https://www.redhat.com/archives/libvir-list/2020-January/msg00062.html
Merged upstream for forthcoming 6.0.0
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.listAllPorts() [<libvirt.virNetworkPort object at 0x7f4eb14429e8>, <libvirt.virNetworkPort object at 0x7f4eb1442978>] >>> net.listAllPorts()[0].UUIDString() '43d3260d-0fcb-44aa-9571-d2efc53fad08' >>> net.listAllPorts()[1].UUIDString() '43d3260d-0fcb-44aa-9571-d2efc53fad07' >>> net.listAllPorts()[0].XMLDesc() "<networkport>\n <uuid>43d3260d-0fcb-44aa-9571-d2efc53fad08</uuid>\n <owner>\n <name>rhel</name>\n <uuid>6fc9e4e3-980c-43df-8d62-673cd69b00e3</uuid>\n </owner>\n <mac address='52:54:00:e6:e8:32'/>\n <bandwidth classID='1'>\n <inbound average='600' peak='500' burst='400'/>\n <outbound average='700' peak='800' burst='600'/>\n </bandwidth>\n <plug type='network' bridge='virbr0'/>\n</networkport>\n" >>> net.listAllPorts()[0].UUID() b'C\xd3&\r\x0f\xcbD\xaa\x95q\xd2\xef\xc5?\xad\x08' Move to VERIFIED.
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