From a943217ad3e03635f4e82be6e2e620d87a28562a Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 28 Nov 2023 16:28:46 +0000 Subject: [PATCH] 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 --- src/pybind/mgr/cephadm/inventory.py | 7 +++++-- src/pybind/mgr/cephadm/module.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py index 15e81fa57f4..27bf55c921c 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 1bf86a65dd8..648cdc179c0 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1684,7 +1684,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': -- 2.39.5