]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
cephadm: have attempt_bind raise up OSErrors
authorAdam King <adking@redhat.com>
Fri, 18 Aug 2023 16:32:38 +0000 (12:32 -0400)
committerAdam King <adking@redhat.com>
Thu, 31 Aug 2023 17:36:15 +0000 (13:36 -0400)
commit5e01dfefcdb8cd43b77977544171b10fac923db6
tree0b95a511cef96a96a05045701a773b3dc7f2701b
parent82a3aacf421f61cf1b58f1e3e46bc996cafa78a2
cephadm: have attempt_bind raise up OSErrors

Before it was always converting the OSError to
our self-defined "Error" class. This causes an issue
with the port_in_use function that has special handling
for OSError when the errno is EADDRNOTAVAIL or
EAFNOSUPPORT. Since the error being raised was no
longer an OSError it wasn't being caught and checked
properly in port_in_use.

This has the additional property of being necessary
to check port availability for haproxy on its VIP. If
we fail deployment when EADDRNOTAVAIL is raised, it becomes
difficult to deploy the ingress service. If we deploy
haproxy first it fails because the VIP isn't available
yet (since keepalive isn't up) and it fails saying the port
it wants to bind to is unavailable (specifically EADDRNOTAVAIL).
If we try to deploy keepalive first it fails because it
needs to know the location of the haproxy daemons in
order to build its config file. This has worked in the past
by just having the haproxy fail to bind at first and then
fix itself once the keepalive daemon is deployed. That
no longer works if the haproxy daemon fails to deploy
because cephadm is reporting the port it needs is
unavailable. Since EADDRNOTAVAIL when deploying
haproxy likely means the VIP is not up rather than
something else is taking up the port it needs, fixing
the handling of this allows ingress deployment to
work while also allowing multiple haproxy daemons
on the same host to use the same frontend port
bound to different VIPs.

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit b2f133fd994cc63f1fa55320aac987e760e43160)
src/cephadm/cephadm.py
src/cephadm/tests/test_cephadm.py