From: Sage Weil Date: Tue, 22 Oct 2019 20:23:18 +0000 (-0500) Subject: mgr/ssh: make mds add work X-Git-Tag: v15.1.0~1123^2~10 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3c5ba53060bfb5c3c5c87884291fe62ec61608f0;p=ceph-ci.git mgr/ssh: make mds add work This is clearly primitive and not where we want to end up, but an initial step. Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/ssh/module.py b/src/pybind/mgr/ssh/module.py index 481e24c4c40..54154e8cabe 100644 --- a/src/pybind/mgr/ssh/module.py +++ b/src/pybind/mgr/ssh/module.py @@ -757,3 +757,28 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator): results.append(result) return SSHWriteCompletion(results) + + def add_mds(self, spec): + if len(spec.placement.nodes) < spec.count: + raise RuntimeError("must specify at least %d hosts" % spec.count) + n=0 + results = [] + for host in spec.placement.nodes: + mds_id = spec.name + '-%d' % n + self.log.debug('placing mds.%s on host %s' % (mds_id, host)) + results.append( + self._worker_pool.apply_async(self._create_mds, (mds_id, host)) + ) + n += 1 + return SSHWriteCompletion(results) + + def _create_mds(self, mds_id, host): + # get mgr. key + ret, keyring, err = self.mon_command({ + 'prefix': 'auth get-or-create', + 'entity': 'mds.' + mds_id, + 'caps': ['mon', 'allow profile mds', + 'osd', 'allow rwx', + 'mds', 'allow'], + }) + return self._create_daemon('mds', mds_id, host, keyring)