]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: show unmanaged OSDs under 'osd' service
authorSage Weil <sage@newdream.net>
Thu, 11 Nov 2021 16:42:32 +0000 (11:42 -0500)
committerSebastian Wagner <sewagner@redhat.com>
Mon, 3 Jan 2022 13:14:00 +0000 (14:14 +0100)
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    -    <unmanaged>
osd.hdds               5  85s ago    2s   *
...

Fixes: https://tracker.ceph.com/issues/53235
Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit f13a3e5b3ca1547bba9deae3615252165bc7cac9)

src/pybind/mgr/orchestrator/_interface.py

index 18eb1d9be6376f7cf2d1e0527d7ba92ea1d2a9fd..e43f843ba13c1913d8714fb98c3b1d5df487c56f 100644 (file)
@@ -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)