]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: convert ceph exporter type to a ContainerDaemonForm 53802/head
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 3 Oct 2023 20:52:09 +0000 (16:52 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 10 Oct 2023 14:33:48 +0000 (10:33 -0400)
CephExporter was being (partially) over-shadowed by the Ceph class as
the Ceph class listed 'ceph-exporter' as one of the daemon types it
handled. This change updates CephExporter to a ContainerDaemonForm while
simultaneously breaking the link between Ceph and 'ceph-exporter',
allowing CephExporter to handle all the duty of managing ceph-exporter,
continuing the process of having clearer logical responsibilities and
class hierarchy in cephadm.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py

index a3b2c22c48130953fa79498b61e3c29b920b6cfb..a64b0b49404dd8e9ebb453d946a0a8013c15ef56 100755 (executable)
@@ -210,7 +210,7 @@ class ContainerInfo:
 @register_daemon_form
 class Ceph(ContainerDaemonForm):
     _daemons = ('mon', 'mgr', 'osd', 'mds', 'rgw', 'rbd-mirror',
-                'crash', 'cephfs-mirror', 'ceph-exporter')
+                'crash', 'cephfs-mirror')
 
     @classmethod
     def for_daemon_type(cls, daemon_type: str) -> bool:
@@ -1196,7 +1196,7 @@ class CephNvmeof(ContainerDaemonForm):
 
 
 @register_daemon_form
-class CephExporter(DaemonForm):
+class CephExporter(ContainerDaemonForm):
     """Defines a Ceph exporter container"""
 
     daemon_type = 'ceph-exporter'
@@ -1264,6 +1264,17 @@ class CephExporter(DaemonForm):
         if not os.path.isdir(self.sock_dir):
             raise Error(f'Directory does not exist. Got: {self.sock_dir}')
 
+    def container(self, ctx: CephadmContext) -> CephContainer:
+        return get_deployment_container(ctx, self.identity)
+
+    def uid_gid(self, ctx: CephadmContext) -> Tuple[int, int]:
+        return extract_uid_gid(ctx)
+
+    def config_and_keyring(
+        self, ctx: CephadmContext
+    ) -> Tuple[Optional[str], Optional[str]]:
+        return get_config_and_keyring(ctx)
+
 
 ##################################
 
@@ -1724,7 +1735,9 @@ def get_supported_daemons():
 
 
 def ceph_daemons() -> List[str]:
-    return list(Ceph._daemons)
+    cds = list(Ceph._daemons)
+    cds.append(CephExporter.daemon_type)
+    return cds
 
 ##################################