]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: check-host on 'host add'
authorSage Weil <sage@redhat.com>
Wed, 18 Dec 2019 16:02:31 +0000 (10:02 -0600)
committerSage Weil <sage@redhat.com>
Thu, 16 Jan 2020 13:23:06 +0000 (07:23 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/tests/test_cephadm.py

index b68b52c91d027f2999a38a1f5f68d7176e346eb4..bc34e77156497812194396cf2e8c0a63a3f7a9db 100644 (file)
@@ -685,6 +685,11 @@ class CephadmOrchestrator(MgrModule, orchestrator.Orchestrator):
 
         :param host: host name
         """
+        out, err, code = self._run_cephadm(host, '', 'check-host', [],
+                                           error_ok=True, no_fsid=True)
+        if code:
+            raise OrchestratorError('New host %s failed check: %s' % (host, err))
+
         self.inventory[host] = {}
         self._save_inventory()
         self.inventory_cache[host] = orchestrator.OutdatableData()
index 76da7561ebc0c151788cf2910b8272948a09b779..5d45cef90cabb08ebf8d78d801b39fa3f2453a15 100644 (file)
@@ -73,7 +73,9 @@ class TestCephadm(object):
         assert new_mon.startswith('mon.')
         assert new_mon != 'mon.a'
 
-    def test_host(self, cephadm_module):
+    @mock.patch("cephadm.module.CephadmOrchestrator._get_connection")
+    @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('[]'))
+    def test_host(self, _get_connection, cephadm_module):
         with self._with_host(cephadm_module, 'test'):
             assert self._wait(cephadm_module, cephadm_module.get_hosts()) == [InventoryNode('test')]
         c = cephadm_module.get_hosts()