]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/ssh: add 'rgw rm'
authorSage Weil <sage@redhat.com>
Thu, 31 Oct 2019 18:46:23 +0000 (13:46 -0500)
committerSage Weil <sage@redhat.com>
Tue, 5 Nov 2019 14:46:00 +0000 (08:46 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
doc/mgr/orchestrator_cli.rst
src/pybind/mgr/orchestrator_cli/module.py
src/pybind/mgr/ssh/module.py

index 1c7732e256ca9253862d2b13e010f92b6ecf44e2..503944706b0af17ca79eec891ddcd55d621b0b01 100644 (file)
@@ -311,7 +311,7 @@ This is an overview of the current implementation status of the orchestrators.
  rbd-mirror rm                       ⚪         ⚪       ⚪         ⚪
  rbd-mirror update                   ⚪         ⚪       ⚪         ⚪
  rgw add                             ✔         ✔       ⚪         ✔
- rgw rm                              â\9c\94         â\9c\94       â\9aª         â\9aª
+ rgw rm                              â\9c\94         â\9c\94       â\9aª         â\9c\94
  rgw update                          ⚪         ⚪       ⚪         ⚪
 =================================== ========= ====== ========= =====
 
index 982fdcfd8d0f3f33895929970955904291c6a5bf..351212e94f3c63f36675c449e784e5d76016261e 100644 (file)
@@ -321,10 +321,10 @@ Usage:
         return HandleCommandResult(stdout=completion.result_str())
 
     @_write_cli('orchestrator rgw rm',
-                "name=svc_id,type=CephString",
+                "name=name,type=CephString",
                 'Remove an RGW service')
-    def _rgw_rm(self, svc_id):
-        completion = self.remove_rgw(svc_id)
+    def _rgw_rm(self, name):
+        completion = self.remove_rgw(name)
         self._orchestrator_wait([completion])
         orchestrator.raise_if_exception(completion)
         return HandleCommandResult(stdout=completion.result_str())
index 83fce83802ca42a40bd9ba73e5bfe53236ffeb5b..a5e7d39732d6882dfb60eb6964d1d0969a6f7b9d 100644 (file)
@@ -1003,3 +1003,22 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator):
                      'osd', 'allow rwx'],
         })
         return self._create_daemon('rgw', rgw_id, host, keyring)
+
+    def remove_rgw(self, name):
+        daemons = self._get_services('rgw')
+        results = []
+        for d in daemons:
+            if d.service_instance == name or d.service_instance.startswith(name + '-'):
+                results.append(self._worker_pool.apply_async(
+                    self._remove_rgw, (d.service_instance, d.nodename)))
+        if not results:
+            raise RuntimeError('Unable to find rgw.%s[-*] daemon(s)' % name)
+        return SSHWriteCompletion(results)
+
+    def _remove_rgw(self, rgw_id, host):
+        name = 'rgw.' + rgw_id
+        out, code = self._run_ceph_daemon(
+            host, name, 'rm-daemon',
+            ['--name', name])
+        self.log.debug('remove_rgw code %s out %s' % (code, out))
+        return "Removed {} from host '{}'".format(name, host)