diff options
author | John Mulligan <jmulligan@redhat.com> | 2023-09-21 23:57:43 +0200 |
---|---|---|
committer | John Mulligan <jmulligan@redhat.com> | 2023-10-04 21:17:57 +0200 |
commit | 14f3cf173846d68ae3d1b3a908b2e5d276544bed (patch) | |
tree | 9f5e27d16e2d25a157a600c419b9d1cef5f02ed7 | |
parent | cephadm: add test_daemon_form.py (diff) | |
download | ceph-14f3cf173846d68ae3d1b3a908b2e5d276544bed.tar.xz ceph-14f3cf173846d68ae3d1b3a908b2e5d276544bed.zip |
cephadm: remove direct daemon-type deps from sysctl
Using the appropriate daemon form we can break the direct dependency
that the sysctl setup function has on particular classes and use
a generic interface.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
-rwxr-xr-x | src/cephadm/cephadm.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 665d065c59d..7ddad159b6b 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -165,6 +165,8 @@ from cephadmlib.host_facts import HostFacts, list_networks from cephadmlib.ssh import authorize_ssh_key, check_ssh_connectivity from cephadmlib.daemon_form import ( DaemonForm, + SysctlDaemonForm, + create as daemon_form_create, register as register_daemon_form, ) @@ -2955,7 +2957,7 @@ def deploy_daemon_units( f.write(container.image + '\n') # sysctl - install_sysctl(ctx, fsid, daemon_type) + install_sysctl(ctx, fsid, daemon_form_create(ctx, ident)) # systemd install_base_units(ctx, fsid) @@ -3211,7 +3213,7 @@ def update_firewalld(ctx, daemon_type): firewall.apply_rules() -def install_sysctl(ctx: CephadmContext, fsid: str, daemon_type: str) -> None: +def install_sysctl(ctx: CephadmContext, fsid: str, daemon: DaemonForm) -> None: """ Set up sysctl settings """ @@ -3225,17 +3227,13 @@ def install_sysctl(ctx: CephadmContext, fsid: str, daemon_type: str) -> None: with write_new(conf, owner=None, perms=None) as f: f.write('\n'.join(lines)) + if not isinstance(daemon, SysctlDaemonForm): + return + + daemon_type = daemon.identity.daemon_type conf = Path(ctx.sysctl_dir).joinpath(f'90-ceph-{fsid}-{daemon_type}.conf') - lines: List = [] - if daemon_type == 'osd': - lines = OSD.get_sysctl_settings() - elif daemon_type == 'haproxy': - lines = HAproxy.get_sysctl_settings() - elif daemon_type == 'keepalived': - lines = Keepalived.get_sysctl_settings() - elif daemon_type == CephNvmeof.daemon_type: - lines = CephNvmeof.get_sysctl_settings() + lines = daemon.get_sysctl_settings() lines = filter_sysctl_settings(ctx, lines) # apply the sysctl settings |