Skip to content

Commit

Permalink
mgr/dashboard: Improve readability
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Nawracay <[email protected]>
  • Loading branch information
p-se committed Sep 4, 2018
1 parent 81c6cac commit bca8eae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pybind/mgr/dashboard/controllers/osd.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@
class Osd(RESTController):
def list(self):
osds = self.get_osd_map()

# Extending by osd stats information
for s in mgr.get('osd_stats')['osd_stats']:
osds[str(s['osd'])].update({'osd_stats': s})

# Extending by osd node information
nodes = mgr.get('osd_map_tree')['nodes']
osd_tree = [(str(o['id']), o) for o in nodes if o['id'] >= 0]
for o in osd_tree:
osds[o[0]].update({'tree': o[1]})

# Extending by osd parent node information
hosts = [(h['name'], h) for h in nodes if h['id'] < 0]
for h in hosts:
for o_id in h[1]['children']:
if o_id >= 0:
osds[str(o_id)]['host'] = h[1]

# Extending by osd histogram data
for o_id in osds:
o = osds[o_id]
Expand All @@ -40,6 +44,7 @@ def list(self):
# Gauge stats
for s in ['osd.numpg', 'osd.stat_bytes', 'osd.stat_bytes_used']:
o['stats'][s.split('.')[1]] = mgr.get_latest('osd', osd_spec, s)

return list(osds.values())

def get_osd_map(self):
Expand Down

0 comments on commit bca8eae

Please sign in to comment.