]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: move keepalived sysctl settings
authorMichael Fritch <mfritch@suse.com>
Mon, 10 May 2021 19:36:20 +0000 (13:36 -0600)
committerSage Weil <sage@newdream.net>
Thu, 20 May 2021 23:11:47 +0000 (18:11 -0500)
from container pre-start to sysctl file

Signed-off-by: Michael Fritch <mfritch@suse.com>
(cherry picked from commit 04127a0d2226c0499af53503a936134aa744a2b3)

src/cephadm/cephadm

index 0fd862058a9c29c52492fc2474fef336dd7bc6c8..c705f96b769871807a398f59a72295da89e7dca0 100755 (executable)
@@ -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: