From: Sage Weil Date: Mon, 17 Feb 2020 16:55:45 +0000 (-0600) Subject: mgr/cephadm: add prepare-host command X-Git-Tag: v15.1.1~359^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ed368f0616cb0ebeccf9dcbb6523a9af8fde0299;p=ceph.git mgr/cephadm: add prepare-host command Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index a01f9d93076c..189175ff25d2 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1154,6 +1154,27 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): self.event.set() return 0, '%s (%s) ok' % (host, addr), err + @orchestrator._cli_read_command( + 'cephadm prepare-host', + 'name=host,type=CephString ' + 'name=addr,type=CephString,req=false', + 'Prepare a remote host for use with cephadm') + def _prepare_host(self, host, addr=None): + out, err, code = self._run_cephadm(host, 'client', 'prepare-host', + ['--expect-hostname', host], + addr=addr, + error_ok=True, no_fsid=True) + if code: + return 1, '', ('prepare-host failed:\n' + '\n'.join(err)) + # if we have an outstanding health alert for this host, give the + # serve thread a kick + if 'CEPHADM_HOST_CHECK_FAILED' in self.health_checks: + for item in self.health_checks['CEPHADM_HOST_CHECK_FAILED']['detail']: + if item.startswith('host %s ' % host): + self.log.debug('kicking serve thread') + self.event.set() + return 0, '%s (%s) ok' % (host, addr), err + def _get_connection(self, host): """ Setup a connection for running commands on remote host.