Project

General

Profile

Bug #42571

restful: Query nodes_by_id for items

Added by Brad Hubbard 4 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
restful module
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
nautilus, mimic, luminous
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature:

Description

 curl --insecure --user a-user https://xxx.com:8003/osd
Enter host password for user 'a-user':
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or there is an error in the application.</p>

in _gather_leaf_ids, it failing with KeyError exceptions for 'items' :
2019-10-23 17:41:47.470506 7f07075ce700  1 mgr.server reply handle_command (0) Success
2019-10-23 17:41:47.843314 7f0705dcb700  0 mgr[restful] Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pecan/core.py", line 678, in __call__
    self.invoke_controller(controller, args, kwargs, state)
  File "/usr/lib/python2.7/site-packages/pecan/core.py", line 569, in invoke_controller
    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 536, in get_osds
    pools_map = self.get_osd_pools()
  File "/usr/lib64/ceph/mgr/restful/module.py", line 512, in get_osd_pools
    pool_osds = common.crush_rule_osds(crush['buckets'], rule)
  File "/usr/lib64/ceph/mgr/restful/common.py", line 159, in crush_rule_osds
    osds |= _gather_osds(nodes_by_id[step['item']], rule['steps'][i + 1:])
  File "/usr/lib64/ceph/mgr/restful/common.py", line 149, in _gather_osds
    osds |= _gather_leaf_ids(desc_node)
  File "/usr/lib64/ceph/mgr/restful/common.py", line 99, in _gather_leaf_ids
    for item in node['items']:
KeyError: 'items'

The node dict that is passed to the _gather_leaf_ids function from the
_gather_osds function does not have 'items' in it. We also can't use
buckets at this point since those only exist for leaf nodes, not all
nodes.

We need to query the nodes_by_id dict to get 'items' for a node inside
the _gather_leaf_ids function instead.


Related issues

Copied to mgr - Backport #42572: mimic: restful: Query nodes_by_id for items Resolved
Copied to mgr - Backport #42573: luminous: restful: Query nodes_by_id for items Resolved
Copied to mgr - Backport #42574: nautilus: restful: Query nodes_by_id for items Resolved

History

#1 Updated by Boris Ranto 4 months ago

I have already created nautilus back-port, here:

https://github.com/ceph/ceph/pull/31261

#2 Updated by Brad Hubbard 4 months ago

  • Status changed from New to Pending Backport

#3 Updated by Brad Hubbard 4 months ago

  • Copied to Backport #42572: mimic: restful: Query nodes_by_id for items added

#4 Updated by Brad Hubbard 4 months ago

  • Copied to Backport #42573: luminous: restful: Query nodes_by_id for items added

#5 Updated by Brad Hubbard 4 months ago

  • Copied to Backport #42574: nautilus: restful: Query nodes_by_id for items added

#6 Updated by Nathan Cutler 3 months ago

  • Status changed from Pending Backport to Resolved

While running with --resolve-parent, the script "backport-create-issue" noticed that all backports of this issue are in status "Resolved" or "Rejected".

Also available in: Atom PDF