From bec4138ceee9c2bcf811afc3dc9b3df5c85fe01a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 1 Mar 2020 11:38:42 -0600 Subject: [PATCH] mgr/orch: add crash hooks Signed-off-by: Sage Weil --- src/pybind/mgr/orchestrator/_interface.py | 10 +++++++++ src/pybind/mgr/orchestrator/module.py | 26 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index 198771f21cde..de285f64c60e 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -1104,6 +1104,16 @@ class Orchestrator(object): """Update existing a Node-Exporter daemon(s)""" raise NotImplementedError() + def add_crash(self, spec): + # type: (ServiceSpec) -> Completion + """Create a new crash service""" + raise NotImplementedError() + + def apply_crash(self, spec): + # type: (ServiceSpec) -> Completion + """Update existing a crash daemon(s)""" + raise NotImplementedError() + def add_grafana(self, spec): # type: (ServiceSpec) -> Completion """Create a new Node-Exporter service""" diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 6f9dfc11dca3..bcc43f20bd35 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -638,6 +638,19 @@ Usage: self._orchestrator_wait([completion]) return HandleCommandResult(stdout=completion.result_str()) + @_cli_write_command( + 'orch daemon add crash', + 'name=placement,type=CephString,n=N,req=false', + 'Add node-exporter daemon(s)') + def _daemon_add_crash(self, placement=None): + spec = ServiceSpec( + 'crash', + placement=PlacementSpec.from_strings(placement), + ) + completion = self.add_crash(spec) + self._orchestrator_wait([completion]) + return HandleCommandResult(stdout=completion.result_str()) + @_cli_write_command( 'orch daemon add grafana', 'name=placement,type=CephString,n=N,req=false', @@ -844,6 +857,19 @@ Usage: self._orchestrator_wait([completion]) return HandleCommandResult(stdout=completion.result_str()) + @_cli_write_command( + 'orch apply crash', + 'name=placement,type=CephString,n=N,req=false', + 'Update node_exporter service') + def _apply_crash(self, placement=None): + spec = ServiceSpec( + 'crash', + placement=PlacementSpec.from_strings(placement), + ) + completion = self.apply_crash(spec) + self._orchestrator_wait([completion]) + return HandleCommandResult(stdout=completion.result_str()) + @_cli_write_command( 'orch set backend', "name=module_name,type=CephString,req=true", -- 2.47.3