]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: allow services to be conditionally ranked 58517/head
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 8 Jul 2024 19:14:30 +0000 (15:14 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 10 Jul 2024 17:40:19 +0000 (13:40 -0400)
Add a spec argument to the `ranked` function. If this function returns
true the service will use ranks. In some cases we want 'rankedness'
to be conditional on parameters of the given service spec.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/serve.py
src/pybind/mgr/cephadm/services/cephadmservice.py
src/pybind/mgr/cephadm/services/nfs.py

index bd7981edc56f1cc6d94c8b3bdca4f9ef43f71dff..9cd3dae807ffe1f26cfd61e9ff7c4495e03fffcf 100644 (file)
@@ -3296,6 +3296,9 @@ Then run the following:
                     'data': self._preview_osdspecs(osdspecs=[cast(DriveGroupSpec, spec)])}
 
         svc = self.cephadm_services[spec.service_type]
+        rank_map = None
+        if svc.ranked(spec):
+            rank_map = self.spec_store[spec.service_name()].rank_map
         ha = HostAssignment(
             spec=spec,
             hosts=self.cache.get_schedulable_hosts(),
@@ -3304,7 +3307,7 @@ Then run the following:
             networks=self.cache.networks,
             daemons=self.cache.get_daemons_by_service(spec.service_name()),
             allow_colo=svc.allow_colo(),
-            rank_map=self.spec_store[spec.service_name()].rank_map if svc.ranked() else None
+            rank_map=rank_map
         )
         ha.validate()
         hosts, to_add, to_remove = ha.place()
index 59e06bbd024e6338704bcad4f78a6d87c4691533..eaaf4386f622ef7523f7582ac0d6587df1bf773a 100644 (file)
@@ -780,7 +780,7 @@ class CephadmServe:
         }
 
         rank_map = None
-        if svc.ranked():
+        if svc.ranked(spec):
             rank_map = self.mgr.spec_store[spec.service_name()].rank_map or {}
         ha = HostAssignment(
             spec=spec,
index ec9df98413a3d69fc3adaaaeac1aa4b7630246f6..72e6177bc1d068b031f1b6dfd9c5cb8841629d2c 100644 (file)
@@ -288,7 +288,7 @@ class CephadmService(metaclass=ABCMeta):
         """
         return None
 
-    def ranked(self) -> bool:
+    def ranked(self, spec: ServiceSpec) -> bool:
         """
         If True, we will assign a stable rank (0, 1, ...) and monotonically increasing
         generation (0, 1, ...) to each daemon we create/deploy.
index f46f65b084beaeb3da97ac6665ba34f99da2e7ca..a0d7da9bb7e4674976f6ff9e8fc661e403f0b6b5 100644 (file)
@@ -23,7 +23,7 @@ logger = logging.getLogger(__name__)
 class NFSService(CephService):
     TYPE = 'nfs'
 
-    def ranked(self) -> bool:
+    def ranked(self, spec: ServiceSpec) -> bool:
         return True
 
     def fence(self, daemon_id: str) -> None: