Description of problem: Cann't get network port uuid by UUID() or UUIDString() 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: 1. Network port uuid is '43d3260d-0fcb-44aa-9571-d2efc53fad07'. Get network port uuid by UUIDString(). # 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 = net.portLookupByUUIDString('43d3260d-0fcb-44aa-9571-d2efc53fad07') >>> port <libvirt.virNetworkPort object at 0x7f41b43b45c0> >>> buf = '' >>> port.UUIDString(buf) 0 >>> buf '' >>> port.UUIDString(buf) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/python3.6/site-packages/libvirt.py", line 3220, in UUIDString ret = libvirtmod.virNetworkPortGetUUIDString(self._o, buf) ValueError: embedded null character 2. Network port uuid is '43d3260d-0fcb-44aa-9571-d2efc53fad07'. Get network port uuid by UUID(). # 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 = net.portLookupByUUIDString('43d3260d-0fcb-44aa-9571-d2efc53fad07') >>> uuid = '' >>> port.UUID(uuid) 0 >>> uuid '' >>> port.UUID(uuid) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/python3.6/site-packages/libvirt.py", line 3213, in UUID ret = libvirtmod.virNetworkPortGetUUID(self._o, uuid) ValueError: embedded null character Actual results: Cann't get network port uuid. Expected results: Can get network port uuid.
Fix proposed: https://www.redhat.com/archives/libvir-list/2020-January/msg00063.html Note that in addition to what's reported in the description, the 'net.portLookupByUUID()' method was also broken.
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') >>> port = net.portLookupByUUIDString('43d3260d-0fcb-44aa-9571-d2efc53fad07') >>> port <libvirt.virNetworkPort object at 0x7f4eb159dc88> >>> port.UUIDString() '43d3260d-0fcb-44aa-9571-d2efc53fad07' >>> uuid = port.UUID() >>> uuid b'C\xd3&\r\x0f\xcbD\xaa\x95q\xd2\xef\xc5?\xad\x07' >>> import binascii >>> binascii.hexlify(uuid).decode() '43d3260d0fcb44aa9571d2efc53fad07' 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