From 623bc8b05fd0c209a3c0ddb48630bc2e349be788 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 21 Mar 2018 14:53:28 +0100 Subject: [PATCH] mgr/dashboard: Change `crush_rule` serialization of Pools from id to name Signed-off-by: Sebastian Wagner --- src/pybind/mgr/dashboard/controllers/pool.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/controllers/pool.py b/src/pybind/mgr/dashboard/controllers/pool.py index c1216333b8af3..9a5176f646e5d 100644 --- a/src/pybind/mgr/dashboard/controllers/pool.py +++ b/src/pybind/mgr/dashboard/controllers/pool.py @@ -15,7 +15,9 @@ class Pool(RESTController): @classmethod def _serialize_pool(cls, pool, attrs): if not attrs or not isinstance(attrs, list): - return pool + attrs = pool.keys() + + crush_rules = {r['rule_id']: r["rule_name"] for r in mgr.get('osd_map_crush')['rules']} res = {} for attr in attrs: @@ -23,6 +25,8 @@ class Pool(RESTController): continue if attr == 'type': res[attr] = {1: 'replicated', 3: 'erasure'}[pool[attr]] + elif attr == 'crush_rule': + res[attr] = crush_rules[pool[attr]] else: res[attr] = pool[attr] -- 2.39.5