Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luminous: mgr/restful: fix py got exception when get osd info #26199

merged 2 commits into from Mar 11, 2019


Copy link

commented Jan 30, 2019

when we create pool by device class, then get osd info by restful,
such as
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/", line 570, in __call__
    self.handle_request(req, resp)
  File "/usr/lib/python2.7/site-packages/pecan/", line 508, in handle_request
    result = controller(*args, **kwargs)
  File "/usr/lib64/ceph/mgr/restful/", line 33, in decorated
    return f(*args, **kwargs)
  File "/usr/lib64/ceph/mgr/restful/api/", line 130, in get
    return module.instance.get_osds(pool_id)
  File "/usr/lib64/ceph/mgr/restful/", line 543, in get_osds
    pools_map = self.get_osd_pools()
  File "/usr/lib64/ceph/mgr/restful/", 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/", 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 <>
(cherry picked from commit 23b6c90)

        src/pybind/mgr/restful/api/ Use 'module' instead of

This comment has been minimized.

Copy link

commented Feb 13, 2019


This comment has been minimized.

Copy link

commented Feb 14, 2019

needs #26421 also.

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 <>
(cherry picked from commit fb51bad)
@b-ranto b-ranto added needs-qa luminous-batch-1 and removed DNM labels Feb 14, 2019

This comment has been minimized.

Copy link
Contributor Author

commented Feb 14, 2019

The #26421 was merged to master and back-ported, returning the old labels (all but wip-yuri6-testing, that might need an update).


This comment has been minimized.

Copy link

commented Feb 27, 2019

@yuriw yuriw merged commit 8a7002d into ceph:luminous Mar 11, 2019
4 checks passed
4 checks passed
Docs: build check OK - docs built
Signed-off-by all commits in this PR are signed
Unmodified Submodules submodules for project are unmodified
make check make check succeeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
6 participants
You can’t perform that action at this time.