From: Shweta Bhosale Date: Wed, 13 May 2026 14:19:11 +0000 (+0530) Subject: python-common: Adding precheck for placement.count_per_host in NFSServiceSpec X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=59b1191ed7defcf39a88ba12d5bfb3a0b8a279da;p=ceph.git python-common: Adding precheck for placement.count_per_host in NFSServiceSpec NFS service specs should not allow placement.count_per_host. Fixes: https://tracker.ceph.com/issues/76579 Signed-off-by: Shweta Bhosale --- diff --git a/src/pybind/mgr/cephadm/tests/services/test_nfs.py b/src/pybind/mgr/cephadm/tests/services/test_nfs.py index 376fdea25e3..5079a517ebd 100644 --- a/src/pybind/mgr/cephadm/tests/services/test_nfs.py +++ b/src/pybind/mgr/cephadm/tests/services/test_nfs.py @@ -589,6 +589,15 @@ class TestNFS: assert "NFS_RDMA_Port" not 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) diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index 857446eb115..8e274368348 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -1529,6 +1529,11 @@ class NFSServiceSpec(ServiceSpec): def validate(self) -> None: super(NFSServiceSpec, self).validate() + if self.placement is not None and self.placement.count_per_host is not None: + raise SpecValidationError( + "Placement 'count_per_host' is not supported for nfs service." + ) + if self.virtual_ip and (self.ip_addrs or self.networks): raise SpecValidationError("Invalid NFS spec: Cannot set virtual_ip and " f"{'ip_addrs' if self.ip_addrs else 'networks'} fields")