From 03636c6fcb0132225e0cada370c59fcb290fe2e4 Mon Sep 17 00:00:00 2001 From: Daniel Badea Date: Fri, 12 Jul 2019 17:14:00 +0000 Subject: [PATCH] python-cephclient: populate items list for all nodes except osd cephclient wrapper is converting a flat list of dictionaries returned by Ceph Mimic's osd_crush_tree() to nested dictionaries (actual tree) as expected sysinv. While doing this it looks at the "children" attribute and if there's none then it skips populating current node "items". For storage nodes that don't have any attached OSDs the corresponding tree entry will not have an "items" attribute. When sysinv tries to get OSD's by storage it tries to access it and crashes. Fix by creating empty "items" attribute unless node type is "osd". Closes-Bug: 1834539 Change-Id: Icc5988407c9773d10d2cd1078e08ae213075f793 Signed-off-by: Daniel Badea --- ceph/python-cephclient/python-cephclient/cephclient/wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ceph/python-cephclient/python-cephclient/cephclient/wrapper.py b/ceph/python-cephclient/python-cephclient/cephclient/wrapper.py index 0f976a3f7..126edcad1 100644 --- a/ceph/python-cephclient/python-cephclient/cephclient/wrapper.py +++ b/ceph/python-cephclient/python-cephclient/cephclient/wrapper.py @@ -101,7 +101,7 @@ class CephWrapper(CephClient): def _osd_crush_tree_populate_tree(self, node, node_map): children = node.get('children') node = self._osd_crush_tree_convert_node(node) - if children: + if node['type'] != 'osd': node['items'] = [] for _id in children: node['items'].append(