]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: Retry command when SSH connection closes 60590/head
authorJoshua Blanch <joshua.blanch@clyso.com>
Fri, 1 Nov 2024 21:19:42 +0000 (21:19 +0000)
committerJoshua Blanch <joshua.blanch@clyso.com>
Tue, 14 Jan 2025 17:37:21 +0000 (17:37 +0000)
Handle scenarios where the SSH connection is closed or broken. Ensure
commands like exiting maintenance attempt to reconnect rather than
throwing an error to the user.

Fixes: https://tracker.ceph.com/issues/67905
Signed-off-by: Joshua Blanch <joshua.blanch@clyso.com>
src/pybind/mgr/cephadm/serve.py

index 4a7959ae04502d735089e65b1ba0f1a6e6996bba..5fc26b10fa86b16a2e01e2dbaf2485aed66a3ecb 100644 (file)
@@ -1696,7 +1696,12 @@ class CephadmServe:
                 self.log.debug('stdin: %s' % stdin)
 
             cmd = ssh.RemoteCommand(WHICH, ['python3'])
-            python = await self.mgr.ssh._check_execute_command(host, cmd, addr=addr)
+            try:
+                # when connection was broken/closed, retrying resets the connection
+                python = await self.mgr.ssh._check_execute_command(host, cmd, addr=addr)
+            except ssh.HostConnectionError:
+                python = await self.mgr.ssh._check_execute_command(host, cmd, addr=addr)
+
             # N.B. because the python3 executable is based on the results of the
             # which command we can not know it ahead of time and must be converted
             # into a RemoteExecutable.