]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: remove SSH error logs from health detail when host is unreachable 67070/head
authorJoshua Blanch <joshua.blanch@clyso.com>
Sat, 24 Jan 2026 16:53:14 +0000 (16:53 +0000)
committerJoshua Blanch <joshuamblanch@gmail.com>
Mon, 27 Apr 2026 17:22:26 +0000 (17:22 +0000)
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 <joshua.blanch@clyso.com>
src/pybind/mgr/cephadm/ssh.py

index 563b2447c234301b91f553ea8e29edfd19a5ffd0..1ff6db3bf0dc5c605b0f4f58370ec417324a99fc 100644 (file)
@@ -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)