mgr/restful: fix py got exception when get osd info
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>