From be55832311b953f914cf5cdf4aeb6cb18edd7469 Mon Sep 17 00:00:00 2001 From: Vinicius Lopes da Silva Date: Mon, 6 Dec 2021 11:27:50 -0300 Subject: [PATCH] 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 Change-Id: I1b0f76e89222e2de0f95858955ef07ba479a6822 --- ceph/python-cephclient/python-cephclient/cephclient/wrapper.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ceph/python-cephclient/python-cephclient/cephclient/wrapper.py b/ceph/python-cephclient/python-cephclient/cephclient/wrapper.py index 126edcad..5e0de0f2 100644 --- a/ceph/python-cephclient/python-cephclient/cephclient/wrapper.py +++ b/ceph/python-cephclient/python-cephclient/cephclient/wrapper.py @@ -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)