From 0b26b5a823758c45d11b3159423af2a5fab144a2 Mon Sep 17 00:00:00 2001 From: Teoman ONAY Date: Tue, 26 Mar 2024 09:34:16 +0100 Subject: [PATCH] mgr/cephadm: Allows enabling NFS Ganesha NLM Enable_NLM was harcoded to "false" which prevented enabling file locking. It can now be enabled using enable_nlm in spec file Fixes: https://tracker.ceph.com/issues/65144 Signed-off-by: Teoman ONAY (cherry picked from commit 29331919df222e136ce7b0788376859b3a9cb2aa) --- src/pybind/mgr/cephadm/services/nfs.py | 1 + src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 | 2 +- src/pybind/mgr/cephadm/tests/test_services.py | 3 ++- src/python-common/ceph/deployment/service_spec.py | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/cephadm/services/nfs.py b/src/pybind/mgr/cephadm/services/nfs.py index e0c61b117e7eb..f46f65b084bea 100644 --- a/src/pybind/mgr/cephadm/services/nfs.py +++ b/src/pybind/mgr/cephadm/services/nfs.py @@ -120,6 +120,7 @@ class NFSService(CephService): "bind_addr": bind_addr, "haproxy_hosts": [], "nfs_idmap_conf": nfs_idmap_conf, + "enable_nlm": str(spec.enable_nlm).lower(), } if spec.enable_haproxy_protocol: context["haproxy_hosts"] = self._haproxy_hosts() diff --git a/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 b/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 index 7bc0278d7ed12..ded403169c976 100644 --- a/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 +++ b/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 @@ -1,6 +1,6 @@ # {{ cephadm_managed }} NFS_CORE_PARAM { - Enable_NLM = false; + Enable_NLM = {{ enable_nlm }}; Enable_RQUOTA = false; Protocols = 4; NFS_Port = {{ port }}; diff --git a/src/pybind/mgr/cephadm/tests/test_services.py b/src/pybind/mgr/cephadm/tests/test_services.py index be92ae7c874ec..5d86e53ca51a5 100644 --- a/src/pybind/mgr/cephadm/tests/test_services.py +++ b/src/pybind/mgr/cephadm/tests/test_services.py @@ -2430,6 +2430,7 @@ class TestIngressService: hosts=['host1', 'host2']), port=12049, enable_haproxy_protocol=True, + enable_nlm=True, ) ispec = IngressSpec( @@ -2499,7 +2500,7 @@ class TestIngressService: nfs_ganesha_txt = ( "# This file is generated by cephadm.\n" 'NFS_CORE_PARAM {\n' - ' Enable_NLM = false;\n' + ' Enable_NLM = true;\n' ' Enable_RQUOTA = false;\n' ' Protocols = 4;\n' ' NFS_Port = 2049;\n' diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index 55548076a1cea..259a16287a401 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -1091,6 +1091,7 @@ class NFSServiceSpec(ServiceSpec): networks: Optional[List[str]] = None, port: Optional[int] = None, virtual_ip: Optional[str] = None, + enable_nlm: bool = False, enable_haproxy_protocol: bool = False, extra_container_args: Optional[GeneralArgList] = None, extra_entrypoint_args: Optional[GeneralArgList] = None, @@ -1108,6 +1109,7 @@ class NFSServiceSpec(ServiceSpec): self.virtual_ip = virtual_ip self.enable_haproxy_protocol = enable_haproxy_protocol self.idmap_conf = idmap_conf + self.enable_nlm = enable_nlm def get_port_start(self) -> List[int]: if self.port: -- 2.39.5