Join GitHub today
luminous: mgr/restful: fix py got exception when get osd info #26199
when we create pool by device class, then get osd info by restful, such as https://184.108.40.206:8003/osd browser display error, and found excetion in /var/log/ceph/ceph-mgr****.log 2018-03-30 16:07:52.756560 7feef9f17700 0 mgr[restful] Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/pecan/core.py", line 570, in __call__ self.handle_request(req, resp) File "/usr/lib/python2.7/site-packages/pecan/core.py", line 508, in handle_request result = controller(*args, **kwargs) File "/usr/lib64/ceph/mgr/restful/decorators.py", line 33, in decorated return f(*args, **kwargs) File "/usr/lib64/ceph/mgr/restful/api/osd.py", line 130, in get return module.instance.get_osds(pool_id) File "/usr/lib64/ceph/mgr/restful/module.py", line 543, in get_osds pools_map = self.get_osd_pools() File "/usr/lib64/ceph/mgr/restful/module.py", line 516, in get_osd_pools pool_osds = common.crush_rule_osds(self.get('osd_map_tree')['nodes'], rule) File "/usr/lib64/ceph/mgr/restful/common.py", line 149, in crush_rule_osds osds |= _gather_osds(nodes_by_id[step['item']], rule['steps'][i + 1:]) KeyError: -8L buckets in osd_map_crush has more infomation than nodes in osd_map_tree so we can use buckets instead op nodes to get rule osds Signed-off-by: zouaiguo <email@example.com> (cherry picked from commit 23b6c90) Conflicts: src/pybind/mgr/restful/api/crush.py: Use 'module' instead of 'context'
The commit 23b6c90 introduced a regression when traversing leaf nodes. The issue is that it traverses the keys of a `dict` returned by `nodes_by_id`, not the actual `items` of the node. That resulted in an 500 error because it tried to treat `str` as a `dict` and failed. Signed-off-by: Boris Ranto <firstname.lastname@example.org> (cherry picked from commit fb51bad)
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews.