Fix code to support new json format when calling osd crush tree

When doing host-lock in storage nodes when ceph cluster is in warning
state, it verifies the state of the storage node. Doing this involves
calling 'pg dump_stuck' and 'osd crush tree' but their json format has
changed and current code doesn't support this format.

The fix was made to support the new format.

Testing performed:
STANDARD+STORAGE: Set ceph-cluster in warning state and successfully
locked storage-1. To put the cluster in warning state I created a pool
having size 3 and set nosizechange to true. This allows pgs_list to not
be empty and test the loop iteration (which calls 'osd crush tree').

Story: 2009074
Task: 44128

Signed-off-by: Vinicius Lopes da Silva <vinicius.lopesdasilva@windriver.com>
Change-Id: I1b0f76e89222e2de0f95858955ef07ba479a6822
This commit is contained in:
Vinicius Lopes da Silva 2021-12-06 11:27:50 -03:00
parent 5d5912bfc7
commit be55832311

View File

@ -118,7 +118,8 @@ class CephWrapper(CephClient):
and 'output' in _body:
node_map = {}
root_nodes = []
for node in _body['output']:
nodes = _body['output']['nodes']
for node in nodes:
node_map[node['id']] = node
if node['type'] == 'root':
root_nodes.append(node)