From f281a2fba9bc2a6ea50fb7fbd1ad951d250159d3 Mon Sep 17 00:00:00 2001 From: Patrick Seidensal Date: Fri, 21 Feb 2020 12:41:43 +0100 Subject: [PATCH] mgr/orch: add grafana hooks Signed-off-by: Patrick Seidensal --- src/pybind/mgr/orchestrator/_interface.py | 10 ++++++++++ src/pybind/mgr/orchestrator/module.py | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index e1747b10bf166..6a521744d8fba 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -1071,6 +1071,16 @@ class Orchestrator(object): """Update existing a Node-Exporter daemon(s)""" raise NotImplementedError() + def add_grafana(self, spec): + # type: (ServiceSpec) -> Completion + """Create a new Node-Exporter service""" + raise NotImplementedError() + + def apply_grafana(self, spec): + # type: (ServiceSpec) -> Completion + """Update existing a Node-Exporter daemon(s)""" + raise NotImplementedError() + def upgrade_check(self, image, version): # type: (Optional[str], Optional[str]) -> Completion raise NotImplementedError() diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 59e3728433fe2..4aaea60892835 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -601,6 +601,21 @@ Usage: self._orchestrator_wait([completion]) return HandleCommandResult(stdout=completion.result_str()) + @_cli_write_command( + 'orch daemon add grafana', + 'name=num,type=CephInt,req=false ' + 'name=hosts,type=CephString,n=N,req=false ' + 'name=label,type=CephString,req=false', + 'Add grafana daemon(s)') + def _daemon_add_grafana(self, num=None, label=None, hosts=[]): + # type: (Optional[int], Optional[str], List[str]) -> HandleCommandResult + spec = ServiceSpec( + placement=PlacementSpec(label=label, hosts=hosts, count=num), + ) + completion = self.add_grafana(spec) + self._orchestrator_wait([completion]) + return HandleCommandResult(stdout=completion.result_str()) + @_cli_write_command( 'orch', "name=action,type=CephChoices,strings=start|stop|restart|redeploy|reconfig " -- 2.39.5