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
merged 2 commits into from Mar 11, 2019

Conversation

@b-ranto
Copy link
Contributor

commented Jan 30, 2019

when we create pool by device class, then get osd info by restful,
such as https://192.7.7.36: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 <zou.aiguo@zte.com.cn>
(cherry picked from commit 23b6c90)

Conflicts:
        src/pybind/mgr/restful/api/crush.py: Use 'module' instead of
	'context'
@yuriw

This comment has been minimized.

Copy link
Contributor

commented Feb 13, 2019

@tchaikov

This comment has been minimized.

Copy link
Contributor

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

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).

@yuriw

This comment has been minimized.

Copy link
Contributor

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
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.