Bug 2037070

Summary: python3-os-ken sockaddr incompatible with python3
Product: Red Hat OpenStack Reporter: François Rigault <francois.rigault>
Component: python-os-kenAssignee: Bernard Cafarelli <bcafarel>
Status: CLOSED ERRATA QA Contact: Toni Freger <tfreger>
Severity: low Docs Contact:
Priority: low    
Version: 16.2 (Train)Keywords: Triaged
Target Milestone: z2   
Target Release: 16.2 (Train on RHEL 8.4)   
Hardware: noarch   
OS: Linux   
Whiteboard:
Fixed In Version: python-os-ken-0.4.1-2.20220110134903.8f7851a.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-23 22:12:53 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:

Description François Rigault 2022-01-04 20:28:09 UTC
Description of problem:
os-ken fails with

2021-10-01 09:37:19.153 812 ERROR os_ken.lib.hub [-] hub: uncaught exception: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/os_ken/lib/hub.py", line 59, in _launch
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/os_ken/services/protocols/bgp/peer.py", line 1300, in _connect_loop
    password=password)
  File "/usr/lib/python3.6/site-packages/os_ken/services/protocols/bgp/base.py", line 422, in _connect_tcp
    sockopt.set_tcp_md5sig(sock, peer_addr[0], password)
  File "/usr/lib/python3.6/site-packages/os_ken/lib/sockopt.py", line 71, in set_tcp_md5sig
    impl(s, addr, key)
  File "/usr/lib/python3.6/site-packages/os_ken/lib/sockopt.py", line 38, in _set_tcp_md5sig_linux
    sa = sockaddr.sa_in4(addr)
  File "/usr/lib/python3.6/site-packages/os_ken/lib/sockaddr.py", line 63, in sa_in4
    return _pad_to(hdr + data, _SIN_SIZE)
  File "/usr/lib/python3.6/site-packages/os_ken/lib/sockaddr.py", line 57, in _pad_to
    return data + pad_len * '\0'
TypeError: can't concat str to bytes

Version-Release number of selected component (if applicable):
python3-os-ken-0.4.1-2.20210527163303.8f7851a.el8ost.1.noarch

How reproducible:
using bgpspeaker. Also unit test is provided on 
https://github.com/openstack/os-ken/commit/9a5aa8b7209308a44e463632132c2173216379a6#diff-231a6d938b3f8194f75999207fe3a81fc13c54d45bea6e91795b1b47d9012f80


Steps to Reproduce:
1. see unit test
2.
3.

Actual results:
TypeError: can't concat str to bytes

Expected results:
should work

Additional info:
anyway to get that extra "b" character (the diff is literally a single character!) in python3-os-ken? while not officially supported in OSP16.2 I am experimenting with this, and it is installed in neutron-api  container image.

Comment 1 Bernard Cafarelli 2022-01-05 13:08:17 UTC
A small python3 fix like that can certainly be added

Comment 2 François Rigault 2022-01-10 16:25:53 UTC
Thanks! I should have mentioned the last just above this exception (where the password is logged in clear)

Opening https://storyboard.openstack.org/#!/story/2009779 for that

Comment 3 Bernard Cafarelli 2022-01-12 14:31:04 UTC
(In reply to François Rigault from comment #2)
> Thanks! I should have mentioned the last just above this exception (where
> the password is logged in clear)
> 
> Opening https://storyboard.openstack.org/#!/story/2009779 for that

Thanks for reporting it, I mentioned it in upstream meeting and fix is underway (may be too late for 16.2.2 inclusion though)

Comment 4 François Rigault 2022-01-12 14:37:39 UTC
super! (I actually added a comment on https://review.opendev.org/c/openstack/os-ken/+/824215/1/os_ken/services/protocols/bgp/api/base.py).
this is very low priority.

Regarding this bug, I confirm it is fixed in python-os-ken-0.4.1-2.20220110134903.8f7851a.el8ost.

Comment 12 errata-xmlrpc 2022-03-23 22:12:53 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 (Release of components for Red Hat OpenStack Platform 16.2.2), 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-2022:1001