]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr/cephadm: Also catch concurrent.futures.TimeoutError for timeouts
authorAdam King <adking@redhat.com>
Wed, 7 Jun 2023 14:33:13 +0000 (10:33 -0400)
committerAdam King <adking@redhat.com>
Wed, 28 Feb 2024 20:04:48 +0000 (15:04 -0500)
commit548bde99e68b24e87bedd718cc28ad6ddb062f3f
tree2df20e41ff495a537577d013ce5e75da22b6bfb9
parent5f501fe72171f96fdc52b866d0d69821e8192eb9
mgr/cephadm: Also catch concurrent.futures.TimeoutError for timeouts

On python 3.6 which Ceph currently uses for its
container builds (which are based on centos 8 stream builds
hence the python version) the exception raised by a timeout
from a concurrent.futures.Future is successfully caught by
looking for asyncio.TimeoutError. However, in builds with
later python versions, e.g. 3.9.16, the timeout is no
longer caught. This results in situations like

Traceback (most recent call last):
  File "/usr/share/ceph/mgr/cephadm/utils.py", line 79, in do_work
    return f(*arg)
  File "/usr/share/ceph/mgr/cephadm/serve.py", line 241, in refresh
    r = self._refresh_host_devices(host)
  File "/usr/share/ceph/mgr/cephadm/serve.py", line 352, in _refresh_host_devices
    devices = self.mgr.wait_async(self._run_cephadm_json(
  File "/usr/share/ceph/mgr/cephadm/module.py", line 635, in wait_async
    return self.event_loop.get_result(coro, timeout)
  File "/usr/share/ceph/mgr/cephadm/ssh.py", line 63, in get_result
    return future.result(timeout)
  File "/lib64/python3.9/concurrent/futures/_base.py", line 448, in result
    raise TimeoutError()
concurrent.futures._base.TimeoutError

which causes the cephadm module to crash whenever one of these
command timeouts happen. This patch is to also catch the
newer exception type so it works on later python versions as well

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 4df348c17ba0c72d2ecf08d3607b70b3ae253176)
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/ssh.py