From 6f95625e90cb0a86f6e538610c9f0f36c3c8a592 Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Mon, 10 May 2021 13:36:20 -0600 Subject: [PATCH] cephadm: move keepalived sysctl settings from container pre-start to sysctl file Signed-off-by: Michael Fritch (cherry picked from commit 04127a0d2226c0499af53503a936134aa744a2b3) --- src/cephadm/cephadm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 0fd862058a9c2..c705f96b76987 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -825,12 +825,12 @@ class Keepalived(object): return envs @staticmethod - def get_prestart(): - return ( - '# keepalived needs IP forwarding and non-local bind\n' - 'sysctl net.ipv4.ip_forward=1\n' - 'sysctl net.ipv4.ip_nonlocal_bind=1\n' - ) + def get_sysctl_settings() -> List[str]: + return [ + '# IP forwarding and non-local bind', + 'net.ipv4.ip_forward = 1', + 'net.ipv4.ip_nonlocal_bind = 1', + ] def extract_uid_gid_keepalived(self): # better directory for this? @@ -2745,8 +2745,6 @@ def deploy_daemon_units( ceph_iscsi = CephIscsi.init(ctx, fsid, daemon_id) tcmu_container = ceph_iscsi.get_tcmu_runner_container() _write_container_cmd_to_bash(ctx, f, tcmu_container, 'iscsi tcmu-runnter container', background=True) - elif daemon_type == Keepalived.daemon_type: - f.write(Keepalived.get_prestart()) _write_container_cmd_to_bash(ctx, f, c, '%s.%s' % (daemon_type, str(daemon_id))) @@ -2974,6 +2972,8 @@ def install_sysctl(ctx: CephadmContext, fsid: str, daemon_type: str) -> None: if daemon_type == 'osd': lines = OSD.get_sysctl_settings() + elif daemon_type == 'keepalived': + lines = Keepalived.get_sysctl_settings() # apply the sysctl settings if lines: -- 2.39.5