NFS service specs should not allow placement.count_per_host.
Fixes: https://tracker.ceph.com/issues/76579
Signed-off-by: Shweta Bhosale <Shweta.Bhosale1@ibm.com>
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)
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")