From 7b6864d9b398ca601fa9ff866b6b4c9f9cbc1ff0 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 (cherry picked from commit 61d07e0a441aafd84a463868f777d6091f6e92fe) --- 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 0446dc49f8d..a5003d5e657 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 9add893f04b..4b0fa809f66 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': -- 2.39.5