]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orch: add grafana hooks
authorPatrick Seidensal <pseidensal@suse.com>
Fri, 21 Feb 2020 11:41:43 +0000 (12:41 +0100)
committerPatrick Seidensal <pseidensal@suse.com>
Tue, 25 Feb 2020 08:27:55 +0000 (09:27 +0100)
Signed-off-by: Patrick Seidensal <pseidensal@suse.com>
src/pybind/mgr/orchestrator/_interface.py
src/pybind/mgr/orchestrator/module.py

index e1747b10bf166de45599559e80b8607e248ffda3..6a521744d8fba37e1c6396118f7c957e1a886c1e 100644 (file)
@@ -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()
index 59e3728433fe218322e119a605f20910e7209a5c..4aaea608928358f5a5c4d7abff5ee5b5536a942a 100644 (file)
@@ -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 "