From 3c3a97eaaa9d3939209abe492d1bc7c5ff0f26a8 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Tue, 19 May 2020 15:28:03 +0200 Subject: [PATCH] mgr/orch: allow RGWs with explicit naming Signed-off-by: Sebastian Wagner --- src/pybind/mgr/cephadm/tests/test_spec.py | 13 +++++++++++++ src/pybind/mgr/orchestrator/_interface.py | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/src/pybind/mgr/cephadm/tests/test_spec.py b/src/pybind/mgr/cephadm/tests/test_spec.py index 530dae1fb5a2b..a15e327e17e35 100644 --- a/src/pybind/mgr/cephadm/tests/test_spec.py +++ b/src/pybind/mgr/cephadm/tests/test_spec.py @@ -267,6 +267,19 @@ def test_spec_octopus(): ), True ), + ( + # explicit naming + RGWSpec( + rgw_realm="realm", + rgw_zone="zone", + ), + DaemonDescription( + daemon_type='rgw', + daemon_id="realm.zone.a", + hostname="smithi028", + ), + True + ), ( # without host RGWSpec( diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index 6b0866042aae8..471529b8350f7 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -1314,6 +1314,11 @@ class DaemonDescription(object): if m: return m.group(1) + if self.daemon_type == 'rgw': + v = self.daemon_id.split('.') + if len(v) in [3, 4]: + return '.'.join(v[0:2]) + raise OrchestratorError("DaemonDescription: Cannot calculate service_id: " \ f"daemon_id='{self.daemon_id}' hostname='{self.hostname}'") -- 2.39.5