]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/ssh: make mds add work
authorSage Weil <sage@redhat.com>
Tue, 22 Oct 2019 20:23:18 +0000 (15:23 -0500)
committerSage Weil <sage@redhat.com>
Mon, 28 Oct 2019 15:42:22 +0000 (10:42 -0500)
This is clearly primitive and not where we want to end up, but an initial
step.

Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/ssh/module.py

index 481e24c4c40893faaacaf21e000eff2f9a0353ae..54154e8cabe9d88caed1ed24bf63258ea4214351 100644 (file)
@@ -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)