]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/orchestrator/_interface.py
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / pybind / mgr / orchestrator / _interface.py
index 47009f4f4151fb1847fc95e78a4f0da6f73b3d5b..733e1cdcb5fac499a5912571cc6f22d400ac991f 100644 (file)
@@ -406,7 +406,7 @@ class Orchestrator(object):
         """
         raise NotImplementedError()
 
-    def enter_host_maintenance(self, hostname: str, force: bool = False) -> OrchResult:
+    def enter_host_maintenance(self, hostname: str, force: bool = False, yes_i_really_mean_it: bool = False) -> OrchResult:
         """
         Place a host in maintenance, stopping daemons and disabling it's systemd target
         """
@@ -437,6 +437,14 @@ class Orchestrator(object):
         """
         raise NotImplementedError()
 
+    def service_discovery_dump_cert(self) -> OrchResult:
+        """
+        Returns service discovery server root certificate
+
+        :return: service discovery root certificate
+        """
+        raise NotImplementedError()
+
     def describe_service(self, service_type: Optional[str] = None, service_name: Optional[str] = None, refresh: bool = False) -> OrchResult[List['ServiceDescription']]:
         """
         Describe a service (of any kind) that is already configured in
@@ -494,6 +502,14 @@ class Orchestrator(object):
             return OrchResult(l_res)
         return raise_if_exception(reduce(merge, [fns[spec.service_type](spec) for spec in specs], OrchResult([])))
 
+    def set_unmanaged(self, service_name: str, value: bool) -> OrchResult[str]:
+        """
+        Set unmanaged parameter to True/False for a given service
+
+        :return: None
+        """
+        raise NotImplementedError()
+
     def plan(self, spec: Sequence["GenericSpec"]) -> OrchResult[List]:
         """
         Plan (Dry-run, Preview) a List of Specs.
@@ -573,12 +589,14 @@ class Orchestrator(object):
     def remove_osds(self, osd_ids: List[str],
                     replace: bool = False,
                     force: bool = False,
-                    zap: bool = False) -> OrchResult[str]:
+                    zap: bool = False,
+                    no_destroy: bool = False) -> OrchResult[str]:
         """
         :param osd_ids: list of OSD IDs
         :param replace: marks the OSD as being destroyed. See :ref:`orchestrator-osd-replace`
         :param force: Forces the OSD removal process without waiting for the data to be drained first.
         :param zap: Zap/Erase all devices associated with the OSDs (DESTROYS DATA)
+        :param no_destroy: Do not destroy associated VGs/LVs with the OSD.
 
 
         .. note:: this can only remove OSDs that were successfully
@@ -652,6 +670,14 @@ class Orchestrator(object):
         """Update prometheus cluster"""
         raise NotImplementedError()
 
+    def get_prometheus_access_info(self) -> OrchResult[Dict[str, str]]:
+        """get prometheus access information"""
+        raise NotImplementedError()
+
+    def get_alertmanager_access_info(self) -> OrchResult[Dict[str, str]]:
+        """get alertmanager access information"""
+        raise NotImplementedError()
+
     def apply_node_exporter(self, spec: ServiceSpec) -> OrchResult[str]:
         """Update existing a Node-Exporter daemon(s)"""
         raise NotImplementedError()
@@ -777,6 +803,10 @@ def daemon_type_to_service(dtype: str) -> str:
         'container': 'container',
         'agent': 'agent',
         'snmp-gateway': 'snmp-gateway',
+        'elasticsearch': 'elasticsearch',
+        'jaeger-agent': 'jaeger-agent',
+        'jaeger-collector': 'jaeger-collector',
+        'jaeger-query': 'jaeger-query'
     }
     return mapping[dtype]
 
@@ -804,6 +834,11 @@ def service_to_daemon_types(stype: str) -> List[str]:
         'container': ['container'],
         'agent': ['agent'],
         'snmp-gateway': ['snmp-gateway'],
+        'elasticsearch': ['elasticsearch'],
+        'jaeger-agent': ['jaeger-agent'],
+        'jaeger-collector': ['jaeger-collector'],
+        'jaeger-query': ['jaeger-query'],
+        'jaeger-tracing': ['elasticsearch', 'jaeger-query', 'jaeger-collector', 'jaeger-agent']
     }
     return mapping[stype]
 
@@ -990,6 +1025,24 @@ class DaemonDescription(object):
             return (daemon_type_to_service(self.daemon_type) + '.' + self.daemon_id).startswith(service_name + '.')
         return False
 
+    def matches_digests(self, digests: Optional[List[str]]) -> bool:
+        # the DaemonDescription class maintains a list of container digests
+        # for the container image last reported as being used for the daemons.
+        # This function checks if any of those digests match any of the digests
+        # in the list of digests provided as an arg to this function
+        if not digests or not self.container_image_digests:
+            return False
+        return any(d in digests for d in self.container_image_digests)
+
+    def matches_image_name(self, image_name: Optional[str]) -> bool:
+        # the DaemonDescription class has an attribute that tracks the image
+        # name of the container image last reported as being used by the daemon.
+        # This function compares if the image name provided as an arg matches
+        # the image name in said attribute
+        if not image_name or not self.container_image_name:
+            return False
+        return image_name == self.container_image_name
+
     def service_id(self) -> str:
         assert self.daemon_id is not None
         assert self.daemon_type is not None
@@ -1241,7 +1294,8 @@ class ServiceDescription(object):
     def get_port_summary(self) -> str:
         if not self.ports:
             return ''
-        return f"{(self.virtual_ip or '?').split('/')[0]}:{','.join(map(str, self.ports or []))}"
+        ports = sorted([int(x) for x in self.ports])
+        return f"{(self.virtual_ip or '?').split('/')[0]}:{','.join(map(str, ports or []))}"
 
     def to_json(self) -> OrderedDict:
         out = self.spec.to_json()
@@ -1317,7 +1371,7 @@ class InventoryFilter(object):
 
     Typical use:
 
-      filter by host when presentig UI workflow for configuring
+      filter by host when presenting UI workflow for configuring
       a particular server.
       filter by label when not all of estate is Ceph servers,
       and we want to only learn about the Ceph servers.
@@ -1517,7 +1571,7 @@ class OrchestratorClientMixin(Orchestrator):
 
     >>> import mgr_module
     >>> #doctest: +SKIP
-    ... class MyImplentation(mgr_module.MgrModule, Orchestrator):
+    ... class MyImplementation(mgr_module.MgrModule, Orchestrator):
     ...     def __init__(self, ...):
     ...         self.orch_client = OrchestratorClientMixin()
     ...         self.orch_client.set_mgr(self.mgr))
@@ -1525,7 +1579,7 @@ class OrchestratorClientMixin(Orchestrator):
 
     def set_mgr(self, mgr: MgrModule) -> None:
         """
-        Useable in the Dashbord that uses a global ``mgr``
+        Useable in the Dashboard that uses a global ``mgr``
         """
 
         self.__mgr = mgr  # Make sure we're not overwriting any other `mgr` properties