From: Guillaume Abrioux Date: Tue, 28 Nov 2023 16:28:46 +0000 (+0000) Subject: node-proxy: update the data structure for summary report X-Git-Tag: v18.2.4~314^2~26 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7b6864d9b398ca601fa9ff866b6b4c9f9cbc1ff0;p=ceph.git node-proxy: update the data structure for summary report This extends the current data structure for the 'summary' report. It adds `sn` (serial number information) and the `firmwares` dict to the current data structure. Signed-off-by: Guillaume Abrioux (cherry picked from commit 61d07e0a441aafd84a463868f777d6091f6e92fe) --- diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py index 0446dc49f8d5..a5003d5e657f 100644 --- a/src/pybind/mgr/cephadm/inventory.py +++ b/src/pybind/mgr/cephadm/inventory.py @@ -1481,11 +1481,14 @@ class NodeProxyCache: for host in hosts: _result[host] = {} + _result[host]['status'] = {} data = self.data[host] for component, details in data['status'].items(): res = any([member['status']['health'].lower() != 'ok' for member in data['status'][component].values()]) - _result[host][component] = mapper[res] - + _result[host]['status'][component] = mapper[res] + _result[host]['sn'] = data['sn'] + _result[host]['host'] = data['host'] + _result[host]['firmwares'] = data['firmwares'] return _result def common(self, endpoint: str, **kw: Any) -> Dict[str, Any]: diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 9add893f04b0..4b0fa809f663 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1668,7 +1668,7 @@ Then run the following: data = self.node_proxy.summary(hostname=hostname) for k, v in data.items(): row = [k] - row.extend([v[key] for key in ['storage', 'processors', 'network', 'memory', 'power', 'fans']]) + row.extend([v['status'][key] for key in ['storage', 'processors', 'network', 'memory', 'power', 'fans']]) table.add_row(row) output = table.get_string() elif category == 'firmwares':