From 513dca7134161206d96d969d4643aa0b4bbcbb99 Mon Sep 17 00:00:00 2001 From: Jerry Pu Date: Thu, 3 Dec 2020 15:44:50 +0800 Subject: [PATCH] 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) --- src/pybind/mgr/restful/common.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 -- 2.39.5