]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #67025 from ShwetaBhosale1/fix_issue_74492_set_nfs_default_protoco...
authorRedouane Kachach <rkachach@ibm.com>
Mon, 6 Jul 2026 10:30:37 +0000 (12:30 +0200)
committerGitHub <noreply@github.com>
Mon, 6 Jul 2026 10:30:37 +0000 (12:30 +0200)
mgr/cephadm: Updated NFS default protocol to v4 and v3 is enabled only when enable_nfsv3 is set in the spec

Reviewed-by: Redouane Kachach <rkachach@ibm.com>
Reviewed-by: Adam King <adking@redhat.com>
1  2 
doc/cephadm/services/nfs.rst
src/pybind/mgr/cephadm/services/nfs.py
src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2
src/pybind/mgr/cephadm/tests/services/test_ingress.py
src/pybind/mgr/cephadm/tests/services/test_nfs.py
src/pybind/mgr/nfs/cluster.py
src/pybind/mgr/nfs/module.py
src/pybind/mgr/nfs/tests/test_nfs.py
src/python-common/ceph/deployment/service_spec.py

Simple merge
index 5e8b2f61b2f36b2efb61b7580223f45bb8aa2ca6,aa0c4d367200fdab5e68a036ea0839d4dfaf9f3c..e3555f25adc2b436978758bf4072768b93c5e1e4
@@@ -588,16 -589,33 +589,42 @@@ class TestNFS
                  assert "nfsrdma" not in ganesha_conf
                  assert "NFS_RDMA_Port" not in ganesha_conf
  
+     @patch("cephadm.serve.CephadmServe._run_cephadm")
+     @patch("cephadm.services.nfs.NFSService.fence_old_ranks", MagicMock())
+     @patch("cephadm.services.nfs.NFSService.run_grace_tool", MagicMock())
+     @patch("cephadm.services.nfs.NFSService.purge", MagicMock())
+     @patch("cephadm.services.nfs.NFSService.create_rados_config_obj", MagicMock())
+     def test_nfs_enable_nfsv3(self, _run_cephadm, cephadm_module: CephadmOrchestrator):
+         _run_cephadm.side_effect = async_side_effect(('{}', '', 0))
+         with with_host(cephadm_module, 'test'):
+             # Test with enable_nfsv3=False (default)
+             nfs_spec = NFSServiceSpec(service_id="foo", placement=PlacementSpec(hosts=['test']))
+             with with_service(cephadm_module, nfs_spec) as _:
+                 nfs_generated_conf, _ = service_registry.get_service('nfs').generate_config(
+                     CephadmDaemonDeploySpec(host='test', daemon_id='foo.test.0.0', service_name=nfs_spec.service_name()))
+                 ganesha_conf = nfs_generated_conf['files']['ganesha.conf']
+                 assert "Protocols = 4;" in ganesha_conf
+             # Test with enable_nfsv3=True
+             nfs_spec = NFSServiceSpec(service_id="foo", placement=PlacementSpec(hosts=['test']),
+                                       enable_nfsv3=True)
+             with with_service(cephadm_module, nfs_spec) as _:
+                 nfs_generated_conf, _ = service_registry.get_service('nfs').generate_config(
+                     CephadmDaemonDeploySpec(host='test', daemon_id='foo.test.0.0', service_name=nfs_spec.service_name()))
+                 ganesha_conf = nfs_generated_conf['files']['ganesha.conf']
+                 assert "Protocols = 3, 4;" in ganesha_conf
  
 +def test_nfs_placement_count_per_host_rejected():
 +    spec = NFSServiceSpec(
 +        service_id='mynfs',
 +        placement=PlacementSpec(hosts=['h1'], count_per_host=1),
 +    )
 +    with pytest.raises(SpecValidationError, match="count_per_host.*not supported"):
 +        spec.validate()
 +
 +
  def test_nfs_colocation_ports_validation():
      """Test validation of colocation_ports in NFSServiceSpec"""
      # Valid case: correct number of colocation_ports (count=3, need 2 additional)
Simple merge
Simple merge
Simple merge