]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: update check-host to handle new HostConnectionError exception
authorAdam King <adking@redhat.com>
Fri, 21 Oct 2022 18:41:03 +0000 (14:41 -0400)
committerAdam King <adking@redhat.com>
Fri, 17 Feb 2023 15:45:50 +0000 (10:45 -0500)
Otherwise we'll return a message about the host not being found
and to check 'ceph orch host ls' when the actual problem is the
host being offline

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 29bff27ccfcbaac1b008b03354736c35b629e81a)

src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/tests/test_ssh.py

index 0d5e6edc91a17ed004cdefff0c162e76cec0dc99..bd02b3527ae0748d3664fe4b1eca7eba983e4105 100644 (file)
@@ -1060,6 +1060,10 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
                                                                              error_ok=True, no_fsid=True))
             if code:
                 return 1, '', ('check-host failed:\n' + '\n'.join(err))
+        except ssh.HostConnectionError as e:
+            self.log.exception(f"check-host failed for '{host}' at addr ({e.addr}) due to connection failure: {str(e)}")
+            return 1, '', ('check-host failed:\n'
+                           + f"Failed to connect to {host} at address ({e.addr}): {str(e)}")
         except OrchestratorError:
             self.log.exception(f"check-host failed for '{host}'")
             return 1, '', ('check-host failed:\n'
index 3282295e5ca93d68348e253ed0f389b34c9cf15d..4197d8d7ef0ede87bbdf529aa62d25cc06e9b3e4 100644 (file)
@@ -38,7 +38,7 @@ class TestWithSSH:
                 asyncssh_connect.side_effect = ConnectionLost('reason')
                 code, out, err = cephadm_module.check_host('test')
                 assert out == ''
-                assert "Host 'test' not found" in err
+                assert "Failed to connect to test at address (1::4)" in err
 
                 out = wait(cephadm_module, cephadm_module.get_hosts())[0].to_json()
                 assert out == HostSpec('test', '1::4', status='Offline').to_json()