From d2385e88360110640a11c454420f4afb37b99ab4 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Fri, 5 Feb 2021 14:14:25 +0100 Subject: [PATCH] mgr/cephadm: _add_daemon: remove config_func Signed-off-by: Sebastian Wagner (cherry picked from commit 1e3d98ee1e15744c1eb57bba578765bbaeb1096d) --- src/pybind/mgr/cephadm/module.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 96a08b7330b6b..09fae47d2c37c 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1903,8 +1903,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, def _add_daemon(self, daemon_type: str, spec: ServiceSpec, - create_func: Callable[..., CephadmDaemonSpec], - config_func: Optional[Callable] = None) -> List[str]: + create_func: Callable[..., CephadmDaemonSpec]) -> List[str]: """ Add (and place) a daemon. Require explicit host placement. Do not schedule, and do not apply the related scheduling limitations. @@ -1921,7 +1920,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, daemons = self.cache.get_daemons_by_service(spec.service_name()) return self._create_daemons(daemon_type, spec, daemons, spec.placement.hosts, count, - create_func, config_func) + create_func) def _create_daemons(self, daemon_type: str, @@ -1929,13 +1928,13 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, daemons: List[DaemonDescription], hosts: List[HostPlacementSpec], count: int, - create_func: Callable[..., CephadmDaemonSpec], - config_func: Optional[Callable] = None) -> List[str]: + create_func: Callable[..., CephadmDaemonSpec]) -> List[str]: if count > len(hosts): raise OrchestratorError('too few hosts: want %d, have %s' % ( count, hosts)) did_config = False + service_type = daemon_type_to_service(daemon_type) args = [] # type: List[CephadmDaemonSpec] for host, network, name in hosts: @@ -1943,11 +1942,11 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, prefix=spec.service_id, forcename=name) - if not did_config and config_func: - config_func(spec, daemon_id) + if not did_config: + self.cephadm_services[service_type].config(spec, daemon_id) did_config = True - daemon_spec = self.cephadm_services[daemon_type_to_service(daemon_type)].make_daemon_spec( + daemon_spec = self.cephadm_services[service_type].make_daemon_spec( host, daemon_id, network, spec) self.log.debug('Placing %s.%s on host %s' % ( daemon_type, daemon_id, host)) @@ -2081,7 +2080,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, @trivial_completion def add_mds(self, spec: ServiceSpec) -> List[str]: - return self._add_daemon('mds', spec, self.mds_service.prepare_create, self.mds_service.config) + return self._add_daemon('mds', spec, self.mds_service.prepare_create) @trivial_completion def apply_mds(self, spec: ServiceSpec) -> str: @@ -2089,7 +2088,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, @trivial_completion def add_rgw(self, spec: ServiceSpec) -> List[str]: - return self._add_daemon('rgw', spec, self.rgw_service.prepare_create, self.rgw_service.config) + return self._add_daemon('rgw', spec, self.rgw_service.prepare_create) @trivial_completion def apply_rgw(self, spec: ServiceSpec) -> str: @@ -2102,7 +2101,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, @trivial_completion def add_iscsi(self, spec): # type: (ServiceSpec) -> List[str] - return self._add_daemon('iscsi', spec, self.iscsi_service.prepare_create, self.iscsi_service.config) + return self._add_daemon('iscsi', spec, self.iscsi_service.prepare_create) @trivial_completion def apply_iscsi(self, spec: ServiceSpec) -> str: @@ -2118,7 +2117,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, @trivial_completion def add_nfs(self, spec: ServiceSpec) -> List[str]: - return self._add_daemon('nfs', spec, self.nfs_service.prepare_create, self.nfs_service.config) + return self._add_daemon('nfs', spec, self.nfs_service.prepare_create) @trivial_completion def apply_nfs(self, spec: ServiceSpec) -> str: -- 2.39.5