From: Sebastian Wagner Date: Wed, 21 Mar 2018 13:53:28 +0000 (+0100) Subject: mgr/dashboard: Change `crush_rule` serialization of Pools from id to name X-Git-Tag: v13.1.0~506^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=623bc8b05fd0c209a3c0ddb48630bc2e349be788;p=ceph.git mgr/dashboard: Change `crush_rule` serialization of Pools from id to name Signed-off-by: Sebastian Wagner --- 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]