]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: Add CephfsMirrorService
authorSebastian Wagner <sebastian.wagner@suse.com>
Tue, 23 Feb 2021 13:45:02 +0000 (14:45 +0100)
committerSage Weil <sage@newdream.net>
Tue, 16 Mar 2021 12:56:18 +0000 (07:56 -0500)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
(cherry picked from commit f2f9f51d742c582c08fb590cdaa4d959ee9fb7f5)

src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/services/cephadmservice.py
src/pybind/mgr/cephadm/tests/test_cephadm.py
src/pybind/mgr/orchestrator/_interface.py
src/python-common/ceph/deployment/service_spec.py

index 6b07d4a97f68d0ab82b5c82723a28d7dc2bf52ce..b46b7e3db71ae98a4a09fcb0abfbbc25633e0b69 100644 (file)
@@ -46,7 +46,7 @@ from . import remotes
 from . import utils
 from .migrations import Migrations
 from .services.cephadmservice import MonService, MgrService, MdsService, RgwService, \
-    RbdMirrorService, CrashService, CephadmService
+    RbdMirrorService, CrashService, CephadmService, CephfsMirrorService
 from .services.container import CustomContainerService
 from .services.iscsi import IscsiService
 from .services.ha_rgw import HA_RGWService
@@ -416,7 +416,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
             OSDService, NFSService, MonService, MgrService, MdsService,
             RgwService, RbdMirrorService, GrafanaService, AlertmanagerService,
             PrometheusService, NodeExporterService, CrashService, IscsiService,
-            HA_RGWService, CustomContainerService, CephadmExporter
+            HA_RGWService, CustomContainerService, CephadmExporter, CephfsMirrorService
         ]
 
         # https://github.com/python/mypy/issues/8993
@@ -2127,6 +2127,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
                 'ha-rgw': PlacementSpec(count=2),
                 'iscsi': PlacementSpec(count=1),
                 'rbd-mirror': PlacementSpec(count=2),
+                'cephfs-mirror': PlacementSpec(count=1),
                 'nfs': PlacementSpec(count=1),
                 'grafana': PlacementSpec(count=1),
                 'alertmanager': PlacementSpec(count=1),
index 12578438797b8f1167d3737f1b56fa205a2ddbc9..de2e14e3879a425d11bb4c1bd6d9da697fd8bcdf 100644 (file)
@@ -351,7 +351,7 @@ class CephService(CephadmService):
         """
         # despite this mapping entity names to daemons, self.TYPE within
         # the CephService class refers to service types, not daemon types
-        if self.TYPE in ['rgw', 'rbd-mirror', 'nfs', "iscsi", 'ha-rgw']:
+        if self.TYPE in ['rgw', 'rbd-mirror', 'cephfs-mirror', 'nfs', "iscsi", 'ha-rgw']:
             return AuthEntity(f'client.{self.TYPE}.{daemon_id}')
         elif self.TYPE == 'crash':
             if host == "":
@@ -829,3 +829,23 @@ class CrashService(CephService):
         daemon_spec.final_config, daemon_spec.deps = self.generate_config(daemon_spec)
 
         return daemon_spec
+
+
+class CephfsMirrorService(CephService):
+    TYPE = 'cephfs-mirror'
+
+    def prepare_create(self, daemon_spec: CephadmDaemonDeploySpec) -> CephadmDaemonDeploySpec:
+        assert self.TYPE == daemon_spec.daemon_type
+
+        ret, keyring, err = self.mgr.check_mon_command({
+            'prefix': 'auth get-or-create',
+            'entity': self.get_auth_entity(daemon_spec.daemon_id),
+            'caps': ['mon', 'allow r',
+                     'mds', 'allow r',
+                     'osd', 'allow rw tag cephfs metadata=*, allow r tag cephfs data=*',
+                     'mgr', 'allow r'],
+        })
+
+        daemon_spec.keyring = keyring
+        daemon_spec.final_config, daemon_spec.deps = self.generate_config(daemon_spec)
+        return daemon_spec
index 7b3985b35ef42b714c2ed61cfb68d85d0fb96c4f..0372924dcc9bdd76acc9d49f70d1c3a7c0497161 100644 (file)
@@ -701,6 +701,7 @@ class TestCephadm(object):
             ServiceSpec('node-exporter'),
             ServiceSpec('alertmanager'),
             ServiceSpec('rbd-mirror'),
+            ServiceSpec('cephfs-mirror'),
             ServiceSpec('mds', service_id='fsname'),
             RGWSpec(rgw_realm='realm', rgw_zone='zone'),
             RGWSpec(service_id="foo"),
@@ -833,6 +834,7 @@ class TestCephadm(object):
             (ServiceSpec('node-exporter'), CephadmOrchestrator.apply_node_exporter),
             (ServiceSpec('alertmanager'), CephadmOrchestrator.apply_alertmanager),
             (ServiceSpec('rbd-mirror'), CephadmOrchestrator.apply_rbd_mirror),
+            (ServiceSpec('cephfs-mirror'), CephadmOrchestrator.apply_rbd_mirror),
             (ServiceSpec('mds', service_id='fsname'), CephadmOrchestrator.apply_mds),
             (ServiceSpec(
                 'mds', service_id='fsname',
index e62db08298bbfcafe9e887a5ef0bcef37fe0da53..f44a5983e95aa520f64a613d5aa2547db3582441 100644 (file)
@@ -691,6 +691,7 @@ def daemon_type_to_service(dtype: str) -> str:
         'keepalived': 'ha-rgw',
         'iscsi': 'iscsi',
         'rbd-mirror': 'rbd-mirror',
+        'cephfs-mirror': 'cephfs-mirror',
         'nfs': 'nfs',
         'grafana': 'grafana',
         'alertmanager': 'alertmanager',
@@ -714,6 +715,7 @@ def service_to_daemon_types(stype: str) -> List[str]:
         'ha-rgw': ['haproxy', 'keepalived'],
         'iscsi': ['iscsi'],
         'rbd-mirror': ['rbd-mirror'],
+        'cephfs-mirror': ['cephfs-mirror'],
         'nfs': ['nfs'],
         'grafana': ['grafana'],
         'alertmanager': ['alertmanager'],
index bc54a7fd51b9f15ac449354419eaaaa563b7c2a6..ed9e6cab2fbe22987aa2a6ebcb41b96c321b8580 100644 (file)
@@ -389,7 +389,7 @@ class ServiceSpec(object):
     """
     KNOWN_SERVICE_TYPES = 'alertmanager crash grafana iscsi mds mgr mon nfs ' \
                           'node-exporter osd prometheus rbd-mirror rgw ' \
-                          'container cephadm-exporter ha-rgw'.split()
+                          'container cephadm-exporter ha-rgw cephfs-mirror'.split()
     REQUIRES_SERVICE_ID = 'iscsi mds nfs osd rgw container ha-rgw '.split()
     MANAGED_CONFIG_OPTIONS = [
         'mds_join_fs',