]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/ssh: (broken) mds rm
authorSage Weil <sage@redhat.com>
Wed, 23 Oct 2019 21:15:23 +0000 (16:15 -0500)
committerSage Weil <sage@redhat.com>
Mon, 28 Oct 2019 15:42:22 +0000 (10:42 -0500)
This wrong because it takes a daemon name, not a group name, and because
it relies on mds_metadata--connected daemons, not deployed daemons.  Must
fix once we have better inventory.

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

index 54154e8cabe9d88caed1ed24bf63258ea4214351..75d9317eea1d256342bd4f6a3763d51d9bb16b48 100644 (file)
@@ -782,3 +782,23 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator):
                      'mds', 'allow'],
         })
         return self._create_daemon('mds', mds_id, host, keyring)
+
+    def remove_mds(self, mds_id):
+        # FIXME: this location should come from the inventory, not
+        # mds_metadata, so that we can remove/clean-up daemons that
+        # aren't correctly starting.
+        self.log.debug('metadtata %s' % self.get('mds_metadata'))
+        host = self.get('mds_metadata').get(mds_id, {}).get('hostname')
+        if not host:
+            raise RuntimeError('Unable to identify location of mds.%s' % mds_id)
+        return SSHWriteCompletion([
+            self._worker_pool.apply_async(self._remove_mds, (mds_id, host))
+        ])
+
+    def _remove_mds(self, mds_id, host):
+        name = 'mds.' + mds_id
+        out, code = self._run_ceph_daemon(
+            host, name, 'rm-daemon',
+            ['--name', name])
+        self.log.debug('remove_mds code %s out %s' % (code, out))
+        return "Removed {} from host '{}'".format(name, host)