From 0f15096a12e045df70546e78a80430fe77176686 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 14 Feb 2024 09:02:50 +0000 Subject: [PATCH] mgr/cephadm: add fullreport in ceph orch CLI (node-proxy) This adds the `fullreport` category to the `ceph orch hardware status` CLI. Signed-off-by: Guillaume Abrioux (cherry picked from commit 056d4f7a3d4ca8564b374880551a574858e68395) --- src/pybind/mgr/cephadm/module.py | 4 ++++ src/pybind/mgr/orchestrator/_interface.py | 8 ++++++++ src/pybind/mgr/orchestrator/module.py | 10 ++++++++++ 3 files changed, 22 insertions(+) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 54bbd63b4b0f..b59cf6687f9f 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1700,6 +1700,10 @@ Then run the following: raise OrchestratorValidationError(f"Can't perform powercycle on node {hostname}: {e}") return f'Powercycle scheduled on {hostname}' + @handle_orch_error + def node_proxy_fullreport(self, hostname: Optional[str] = None) -> Dict[str, Any]: + return self.node_proxy_cache.fullreport(hostname=hostname) + @handle_orch_error def node_proxy_summary(self, hostname: Optional[str] = None) -> Dict[str, Any]: return self.node_proxy_cache.summary(hostname=hostname) diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index 7892f4946f8a..e5ee5035133e 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -403,6 +403,14 @@ class Orchestrator(object): """ raise NotImplementedError() + def node_proxy_fullreport(self, hostname: Optional[str] = None) -> OrchResult[Dict[str, Any]]: + """ + Return node-proxy full report + + :param hostname: hostname + """ + raise NotImplementedError() + def node_proxy_firmwares(self, hostname: Optional[str] = None) -> OrchResult[Dict[str, Any]]: """ Return node-proxy firmwares report diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 0763cdcc5d13..054cd58f8b0d 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -496,6 +496,7 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, """ table_heading_mapping = { 'summary': ['HOST', 'STORAGE', 'CPU', 'NET', 'MEMORY', 'POWER', 'FANS'], + 'fullreport': [], 'firmwares': ['HOST', 'COMPONENT', 'NAME', 'DATE', 'VERSION', 'STATUS'], 'criticals': ['HOST', 'COMPONENT', 'NAME', 'STATUS', 'STATE'], 'memory': ['HOST', 'NAME', 'STATUS', 'STATE'], @@ -524,6 +525,15 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, row.extend([v['status'][key] for key in ['storage', 'processors', 'network', 'memory', 'power', 'fans']]) table.add_row(row) output = table.get_string() + elif category == 'fullreport': + if hostname is None: + output = "Missing host name" + elif format != Format.json: + output = "fullreport only supports json output" + else: + completion = self.node_proxy_fullreport(hostname=hostname) + fullreport: Dict[str, Any] = raise_if_exception(completion) + output = json.dumps(fullreport) elif category == 'firmwares': output = "Missing host name" if hostname is None else self._firmwares_table(hostname, table, format) elif category == 'criticals': -- 2.47.3