]> git.apps.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)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 18 Jan 2022 18:34:25 +0000 (13:34 -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>
src/pybind/mgr/cephadm/services/cephadmservice.py

index f44dc62b1349e8763d1912a8005d9dbba2f2e81b..a052c2cf8ded72cd18ee5013a28b3dad9a90d49c 100644 (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