]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orch: add prom hooks
authorSage Weil <sage@redhat.com>
Tue, 4 Feb 2020 19:13:55 +0000 (13:13 -0600)
committerSage Weil <sage@redhat.com>
Thu, 13 Feb 2020 19:59:36 +0000 (13:59 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/orchestrator.py
src/pybind/mgr/orchestrator_cli/module.py

index 6a6ae9959612f0dcba45a9bc8b16431ec826e24e..f098cf759d1de896473f9f0cd411387ef266fd5c 100644 (file)
@@ -1011,6 +1011,16 @@ class Orchestrator(object):
         """Update RGW cluster"""
         raise NotImplementedError()
 
+    def add_prometheus(self, spec):
+        # type: (ServiceSpec) -> Completion
+        """Create new prometheus daemon"""
+        raise NotImplementedError()
+
+    def apply_prometheus(self, spec):
+        # type: (ServiceSpec) -> Completion
+        """Update prometheus cluster"""
+        raise NotImplementedError()
+
     def upgrade_check(self, image, version):
         # type: (Optional[str], Optional[str]) -> Completion
         raise NotImplementedError()
index 09762d21b660a23d2a2807db1a95b3d2dec92405..204a6638b9899135189d763b472e136ac3050cdc 100644 (file)
@@ -500,6 +500,21 @@ Usage:
         orchestrator.raise_if_exception(completion)
         return HandleCommandResult(stdout=completion.result_str())
 
+    @orchestrator._cli_write_command(
+        'orch daemon add prometheus',
+        'name=num,type=CephInt,req=false '
+        'name=hosts,type=CephString,n=N,req=false '
+        'name=label,type=CephString,req=false',
+        'Add prometheus daemon(s)')
+    def _daemon_add_prometheus(self, num=None, label=None, hosts=[]):
+        # type: (Optional[int], Optional[str], List[str]) -> HandleCommandResult
+        spec = orchestrator.ServiceSpec(
+            placement=orchestrator.PlacementSpec(label=label, hosts=hosts, count=num),
+        )
+        completion = self.add_prometheus(spec)
+        self._orchestrator_wait([completion])
+        return HandleCommandResult(stdout=completion.result_str())
+
     @orchestrator._cli_write_command(
         'orch',
         "name=action,type=CephChoices,strings=start|stop|restart|redeploy|reconfig "
@@ -668,6 +683,21 @@ Usage:
         self._orchestrator_wait([completion])
         return HandleCommandResult(stdout=completion.result_str())
 
+    @orchestrator._cli_write_command(
+        'orch apply prometheus',
+        'name=num,type=CephInt,req=false '
+        'name=hosts,type=CephString,n=N,req=false '
+        'name=label,type=CephString,req=false',
+        'Scale prometheus service')
+    def _apply_prometheus(self, num=None, label=None, hosts=[]):
+        # type: (Optional[int], Optional[str], List[str]) -> HandleCommandResult
+        spec = orchestrator.ServiceSpec(
+            placement=orchestrator.PlacementSpec(label=label, hosts=hosts, count=num),
+        )
+        completion = self.apply_prometheus(spec)
+        self._orchestrator_wait([completion])
+        return HandleCommandResult(stdout=completion.result_str())
+
     @orchestrator._cli_write_command(
         'orch set backend',
         "name=module_name,type=CephString,req=true",