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)