From 1bd86d33166246d0b49997aabe6d146be2171c1a Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Fri, 11 Sep 2020 14:18:54 +0200 Subject: [PATCH] mgr/cephadm: allow iscsi to be named by teuthology Signed-off-by: Sebastian Wagner --- src/pybind/mgr/cephadm/tests/test_spec.py | 13 +++++++++++++ src/pybind/mgr/orchestrator/_interface.py | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/pybind/mgr/cephadm/tests/test_spec.py b/src/pybind/mgr/cephadm/tests/test_spec.py index 55001f036d867..663e09a551d1c 100644 --- a/src/pybind/mgr/cephadm/tests/test_spec.py +++ b/src/pybind/mgr/cephadm/tests/test_spec.py @@ -531,6 +531,19 @@ def test_dd_octopus(dd_json): ), True ), + ( + # fixed daemon id for teuthology. + IscsiServiceSpec( + service_type='iscsi', + service_id='iscsi', + ), + DaemonDescription( + daemon_type='iscsi', + daemon_id="iscsi.a", + hostname="host1", + ), + True + ), ]) def test_daemon_description_service_name(spec: ServiceSpec, dd: DaemonDescription, diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index ee32fd33013eb..117d3d0b3d6d0 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -1291,6 +1291,10 @@ class DaemonDescription(object): if len(v) in [3, 4]: return '.'.join(v[0:2]) + if self.daemon_type == 'iscsi': + v = self.daemon_id.split('.') + return '.'.join(v[0:-1]) + # daemon_id == "service_id" return self.daemon_id -- 2.39.5