Merge pull request #44600 from phlogistonjohn/jjm-mirror-service-module

mgr/cephadm: auto-enable mirroring module when deploying service

Reviewed-by: Michael Fritch <mfritch@suse.com>
This commit is contained in:
Sebastian Wagner 2022-01-19 12:16:29 +01:00 committed by GitHub
commit 2c17af2eb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -986,6 +986,18 @@ class CrashService(CephService):
class CephfsMirrorService(CephService):
TYPE = 'cephfs-mirror'
def config(self, spec: ServiceSpec) -> None:
# make sure mirroring module is enabled
mgr_map = self.mgr.get('mgr_map')
mod_name = 'mirroring'
if mod_name not in mgr_map.get('services', {}):
self.mgr.check_mon_command({
'prefix': 'mgr module enable',
'module': mod_name
})
# we shouldn't get here (mon will tell the mgr to respawn), but no
# harm done if we do.
def prepare_create(self, daemon_spec: CephadmDaemonDeploySpec) -> CephadmDaemonDeploySpec:
assert self.TYPE == daemon_spec.daemon_type

View File

@ -777,3 +777,15 @@ class TestIngressService:
}
assert haproxy_generated_conf[0] == haproxy_expected_conf
class TestCephFsMirror:
@patch("cephadm.serve.CephadmServe._run_cephadm")
def test_config(self, _run_cephadm, cephadm_module: CephadmOrchestrator):
_run_cephadm.side_effect = async_side_effect(('{}', '', 0))
with with_host(cephadm_module, 'test'):
with with_service(cephadm_module, ServiceSpec('cephfs-mirror')):
cephadm_module.assert_issued_mon_command({
'prefix': 'mgr module enable',
'module': 'mirroring'
})