From f59a40186be9eb555da018c71ea7b2298412e1dc Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 31 Oct 2019 14:22:39 -0500 Subject: [PATCH] mgr/ssh: implement 'rgw update' Signed-off-by: Sage Weil --- doc/mgr/orchestrator_cli.rst | 2 +- src/pybind/mgr/ssh/module.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/mgr/orchestrator_cli.rst b/doc/mgr/orchestrator_cli.rst index 503944706b0af..c6f9b420126a1 100644 --- a/doc/mgr/orchestrator_cli.rst +++ b/doc/mgr/orchestrator_cli.rst @@ -312,7 +312,7 @@ This is an overview of the current implementation status of the orchestrators. rbd-mirror update ⚪ ⚪ ⚪ ⚪ rgw add ✔ ✔ ⚪ ✔ rgw rm ✔ ✔ ⚪ ✔ - rgw update ⚪ ⚪ ⚪ ⚪ + rgw update ⚪ ⚪ ⚪ ✔ =================================== ========= ====== ========= ===== where diff --git a/src/pybind/mgr/ssh/module.py b/src/pybind/mgr/ssh/module.py index a5e7d39732d68..bd9c637a0a637 100644 --- a/src/pybind/mgr/ssh/module.py +++ b/src/pybind/mgr/ssh/module.py @@ -1022,3 +1022,18 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator): ['--name', name]) self.log.debug('remove_rgw code %s out %s' % (code, out)) return "Removed {} from host '{}'".format(name, host) + + def update_rgw(self, spec): + daemons = self._get_services('rgw', service_name=spec.name) + results = [] + if len(daemons) > spec.count: + # remove some + to_remove = len(daemons) - spec.count + for d in daemons[0:to_remove]: + results.append(self._worker_pool.apply_async( + self._remove_rgw, (d.service_instance, d.nodename))) + elif len(daemons) < spec.count: + # add some + spec.count -= len(daemons) + return self.add_rgw(spec) + return SSHWriteCompletion(results) -- 2.39.5