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

Automatically enable the mgr's mirroring module when creating
cephfs-mirror services. This will trigger a mgr respawn.

Fixes: https://tracker.ceph.com/issues/50593

Based roughly on 50dc1d0dec

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2022-01-13 14:01:51 -05:00
parent e11654d130
commit e030130fd1

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