From: Joshua Blanch Date: Sat, 24 Jan 2026 16:53:14 +0000 (+0000) Subject: mgr/cephadm: remove SSH error logs from health detail when host is unreachable X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6c242eb6480213afce9fe23b1c59bcd7bf24edbe;p=ceph.git mgr/cephadm: remove SSH error logs from health detail when host is unreachable HostConnectionError exception includes verbose logs from asyncssh which creates noise when looking at ceph health detail. This moves the SSH logs to log.exception() and remove it from appearing under `health detail`. Fixes: https://tracker.ceph.com/issues/74551 Signed-off-by: Joshua Blanch --- diff --git a/src/pybind/mgr/cephadm/ssh.py b/src/pybind/mgr/cephadm/ssh.py index 563b2447c234..1ff6db3bf0dc 100644 --- a/src/pybind/mgr/cephadm/ssh.py +++ b/src/pybind/mgr/cephadm/ssh.py @@ -233,19 +233,25 @@ class SSHManager: log_content = log_string.getvalue() msg = f"Can't communicate with remote host `{addr}`, possibly because the host is not reachable or python3 is not installed on the host. {str(e)}" logger.exception(msg) + if log_content: + logger.debug(f'SSH log for {host} ({addr}): {log_content}') raise HostConnectionError(msg, host, addr) except asyncssh.Error as e: self.mgr.offline_hosts.add(host) log_content = log_string.getvalue() - msg = f'Failed to connect to {host} ({addr}). {str(e)}' + '\n' + f'Log: {log_content}' + msg = f'Failed to connect to {host} ({addr}). {str(e)}' logger.exception(msg) + if log_content: + logger.debug(f'SSH log for {host} ({addr}): {log_content}') raise HostConnectionError(msg, host, addr) except Exception as e: self.mgr.offline_hosts.add(host) log_content = log_string.getvalue() - logger.exception(str(e)) - raise HostConnectionError( - f'Failed to connect to {host} ({addr}): {repr(e)}' + '\n' f'Log: {log_content}', host, addr) + msg = f'Failed to connect to {host} ({addr}): {repr(e)}' + logger.exception(msg) + if log_content: + logger.debug(f'SSH log for {host} ({addr}): {log_content}') + raise HostConnectionError(msg, host, addr) finally: log_string.flush() asyncssh_logger.removeHandler(ch)