From: Jerry Pu Date: Thu, 3 Dec 2020 07:44:50 +0000 (+0800) Subject: mgr/restful: fix TypeError occurring in _gather_osds() X-Git-Tag: v14.2.17~10^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=513dca7134161206d96d969d4643aa0b4bbcbb99;p=ceph.git mgr/restful: fix TypeError occurring in _gather_osds() In _gather_osds() processing `choose_firstn`, it tries to traverse the keys of a `dict` (nodes_by_id[node_id]) but not real nodes, thus mistakenly passing `str` to _gather_osds() to do recursion. Fixes: http://tracker.ceph.com/issues/48488 Signed-off-by: Jerry Pu (cherry picked from commit 7244343e8535739c782a517a50742c038abaec04) --- diff --git a/src/pybind/mgr/restful/common.py b/src/pybind/mgr/restful/common.py index fbe5e208670d0..1b957d6b5ecfa 100644 --- a/src/pybind/mgr/restful/common.py +++ b/src/pybind/mgr/restful/common.py @@ -129,8 +129,7 @@ def crush_rule_osds(node_buckets, rule): if node_id >= 0: osds.add(node_id) else: - for desc_node in nodes_by_id[node_id]: - osds |= _gather_osds(desc_node, steps[1:]) + osds |= _gather_osds(nodes_by_id[node_id], steps[1:]) elif step['op'] == 'chooseleaf_firstn': # Choose all descendents of the current node of type 'type', # and select all leaves beneath those