]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/restful: fix TypeError occurring in _gather_osds() 38480/head
authorJerry Pu <jerrypu@qnap.com>
Thu, 3 Dec 2020 07:44:50 +0000 (15:44 +0800)
committerJerry Pu <yician1000@gmail.com>
Tue, 8 Dec 2020 10:20:30 +0000 (18:20 +0800)
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 <yician1000@gmail.com>
src/pybind/mgr/restful/common.py

index fbe5e208670d0bcd4b8a3b657655f4a80bf03113..1b957d6b5ecfa3bd99f2e696f0c9494ec2271923 100644 (file)
@@ -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