From: John Mulligan Date: Tue, 3 Oct 2023 20:52:09 +0000 (-0400) Subject: cephadm: convert ceph exporter type to a ContainerDaemonForm X-Git-Tag: v19.0.0~277^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F53802%2Fhead;p=ceph.git cephadm: convert ceph exporter type to a ContainerDaemonForm 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 --- diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index a3b2c22c4813..a64b0b49404d 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -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 ##################################