From: Boris Ranto Date: Thu, 24 Oct 2019 14:54:05 +0000 (+0200) Subject: restful: Query nodes_by_id for items X-Git-Tag: v14.2.5~30^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a4602189e0e16f820ac66853713f322bef5c8ffe;p=ceph.git restful: Query nodes_by_id for items The node dict that is passed to the _gather_leaf_ids function from the _gather_osds function does not have 'items' in it. We also can't use buckets at this point since those only exist for leaf nodes, not all nodes. We need to query the nodes_by_id dict to get 'items' for a node inside the _gather_leaf_ids function instead. Signed-off-by: Boris Ranto (cherry picked from commit 4f17cbc8651c4b96f006eeabd62373a6cd992865) --- diff --git a/src/pybind/mgr/restful/common.py b/src/pybind/mgr/restful/common.py index 6eb3e416a800..fb6ab86937d7 100644 --- a/src/pybind/mgr/restful/common.py +++ b/src/pybind/mgr/restful/common.py @@ -96,11 +96,8 @@ def crush_rule_osds(node_buckets, rule): return set([node['id']]) result = set() - for item in node['items']: - if item['id'] >= 0: - result.add(item['id']) - else: - result |= _gather_leaf_ids(nodes_by_id[item['id']]) + for item in nodes_by_id[node['id']]['items']: + result |= _gather_leaf_ids(item) return result