]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: auto-enable mirroring module when deploying service
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 13 Jan 2022 19:01:51 +0000 (14:01 -0500)
committerAdam King <adking@redhat.com>
Thu, 17 Feb 2022 05:31:34 +0000 (00:31 -0500)
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 50dc1d0decb2fbf7b9129bddba940969410be5cd

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit e030130fd1d680ebf9d2c6c9f95f44109fbf3036)

src/pybind/mgr/cephadm/services/cephadmservice.py

index 72f1b0c40f002d5189676eda84b56a737fd22712..d5063f067b92ea608cfd75440ff19a410e2e08d1 100644 (file)
@@ -995,6 +995,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