From: Boris Ranto Date: Fri, 25 Oct 2019 12:24:19 +0000 (+0200) Subject: restful: Use node_id for _gather_leaf_ids X-Git-Tag: v15.1.0~1135^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a325f28d93defbec48793060d6768204da94edd5;p=ceph-ci.git restful: Use node_id for _gather_leaf_ids The _gather_leaf_ids function doesn't need the node structure, it only needs the id. Signed-off-by: Boris Ranto --- diff --git a/src/pybind/mgr/restful/common.py b/src/pybind/mgr/restful/common.py index f249c520766..fbe5e208670 100644 --- a/src/pybind/mgr/restful/common.py +++ b/src/pybind/mgr/restful/common.py @@ -91,13 +91,13 @@ def pool_update_commands(pool_name, args): def crush_rule_osds(node_buckets, rule): nodes_by_id = dict((b['id'], b) for b in node_buckets) - def _gather_leaf_ids(node): - if node['id'] >= 0: - return set([node['id']]) + def _gather_leaf_ids(node_id): + if node_id >= 0: + return set([node_id]) result = set() - for item in nodes_by_id[node['id']]['items']: - result |= _gather_leaf_ids(item) + for item in nodes_by_id[node_id]['items']: + result |= _gather_leaf_ids(item['id']) return result @@ -143,7 +143,7 @@ def crush_rule_osds(node_buckets, rule): # Short circuit another iteration to find the emit # and assume anything we've done a chooseleaf on # is going to be part of the selected set of osds - osds |= _gather_leaf_ids(desc_node) + osds |= _gather_leaf_ids(desc_node['id']) elif step['op'] == 'emit': if root['id'] >= 0: osds |= root['id']