Merge pull request #42997 from josephsawaya/wip-mgr-rook-orch-ls

mgr/rook: orch ls displays info about OSDs

Reviewed-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
This commit is contained in:
Sebastian Wagner 2021-10-14 17:33:26 +02:00 committed by GitHub
commit c19250ce3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -342,7 +342,19 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
size=active,
last_refresh=now,
)
if service_type == 'osd' or service_type is None:
# OSDs
all_osds = self.rook_cluster.get_osds()
svc = 'osd'
spec[svc] = orchestrator.ServiceDescription(
spec=DriveGroupSpec(
service_type='osd',
placement=PlacementSpec(count=len(all_osds), hosts=[osd.metadata.labels['topology-location-host'] for osd in all_osds]),
),
size=len(all_osds),
last_refresh=now,
running= sum(osd.status.phase == 'Running' for osd in all_osds)
)
for dd in self._list_daemons():
if dd.service_name() not in spec:
continue

View File

@ -704,6 +704,10 @@ class RookCluster(object):
self.fetcher.fetch()
return self.fetcher.devices()
def get_osds(self) -> List:
osd_pods: KubernetesResource = KubernetesResource(self.coreV1_api.list_namespaced_pod, namespace='rook-ceph', label_selector='app=rook-ceph-osd')
return list(osd_pods.items)
def get_nfs_conf_url(self, nfs_cluster: str, instance: str) -> Optional[str]:
#
# Fetch cephnfs object for "nfs_cluster" and then return a rados://