From 47ffc518de296ce6a0e2e45e6adb8c482a9202b1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 11 Nov 2021 11:42:32 -0500 Subject: [PATCH] mgr/cephadm: show unmanaged OSDs under 'osd' service 1- If the unit.meta file service_name = osd.NNN (which is true for lots of OSDs deployed on older version of cephadm) then ignore the field entirely. 2- If an OSD has not service_name (see above) then show it under the 'osd' service (instead of 'osd.unmanaged'). Sample 'ceph orch ls' output with a drivegroup + unmanaged OSD: NAME PORTS RUNNING REFRESHED AGE PLACEMENT ... osd 1 85s ago - osd.hdds 5 85s ago 2s * ... Fixes: https://tracker.ceph.com/issues/53235 Signed-off-by: Sage Weil (cherry picked from commit f13a3e5b3ca1547bba9deae3615252165bc7cac9) --- src/pybind/mgr/orchestrator/_interface.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index 18eb1d9be6376..e43f843ba13c1 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -910,7 +910,7 @@ class DaemonDescription(object): if self.daemon_type == 'osd': if self.osdspec_affinity and self.osdspec_affinity != 'None': return self.osdspec_affinity - return 'unmanaged' + return '' def _match() -> str: assert self.daemon_id is not None @@ -1056,6 +1056,15 @@ class DaemonDescription(object): status_int = c.pop('status', None) if 'daemon_name' in c: del c['daemon_name'] + if 'service_name' in c and c['service_name'].startswith('osd.'): + # if the service_name is a osd.NNN (numeric osd id) then + # ignore it -- it is not a valid service_name and + # (presumably) came from an older version of cephadm. + try: + int(c['service_name'][4:]) + del c['service_name'] + except ValueError: + pass status = DaemonDescriptionStatus(status_int) if status_int is not None else None return cls(events=events, status=status, **c) -- 2.39.5