From: Sage Weil Date: Thu, 31 Oct 2019 18:46:23 +0000 (-0500) Subject: mgr/ssh: add 'rgw rm' X-Git-Tag: v15.1.0~1031^2~6 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5c096438230fcc1fd545a12cc5b191cc01217b88;p=ceph-ci.git mgr/ssh: add 'rgw rm' Signed-off-by: Sage Weil --- diff --git a/doc/mgr/orchestrator_cli.rst b/doc/mgr/orchestrator_cli.rst index 1c7732e256c..503944706b0 100644 --- a/doc/mgr/orchestrator_cli.rst +++ b/doc/mgr/orchestrator_cli.rst @@ -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 ✔ ✔ ⚪ ⚪ + rgw rm ✔ ✔ ⚪ ✔ rgw update ⚪ ⚪ ⚪ ⚪ =================================== ========= ====== ========= ===== diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 982fdcfd8d0..351212e94f3 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -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()) diff --git a/src/pybind/mgr/ssh/module.py b/src/pybind/mgr/ssh/module.py index 83fce83802c..a5e7d39732d 100644 --- a/src/pybind/mgr/ssh/module.py +++ b/src/pybind/mgr/ssh/module.py @@ -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)