At least for now we don't have a reasonable way to stamp out N placements
when we're also constraining the name/network/ip--not in the general case.
Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit
42d1f5a0a3843ecc369f1df998e867080d5f178f)
raise ServiceSpecValidationError("count-per-host must be >= 1")
if self.count is not None and self.count_per_host is not None:
raise ServiceSpecValidationError("cannot combine count and count-per-host")
+ if (
+ self.count_per_host is not None
+ and self.hosts
+ and any([hs.network or hs.name for hs in self.hosts])
+ ):
+ raise ServiceSpecValidationError(
+ "count-per-host cannot be combined explicit placement with names or networks"
+ )
if self.host_pattern and self.hosts:
raise ServiceSpecValidationError('cannot combine host patterns and hosts')
for h in self.hosts:
('host=a count-per-host:0'),
('host=a count-per-host:-10'),
('count:2 count-per-host:1'),
+ ('host1=a host2=b count-per-host:2'),
+ ('host1:10/8 count-per-host:2'),
]
)
def test_parse_placement_specs_raises(test_input):