]> git-server-git.apps.pok.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)
committerSage Weil <sage@newdream.net>
Thu, 11 Nov 2021 18:53:33 +0000 (13:53 -0500)
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>
src/pybind/mgr/orchestrator/_interface.py

index 9f86abe8db0a35ee4989322799cea24f363513bd..f6bc97fae657e193e069728be9ad8c6da5045bb4 100644 (file)
@@ -905,7 +905,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
@@ -1051,6 +1051,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)