]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common/ceph/deployment/service_spec: disallow max-per-host + explicit placement
authorSage Weil <sage@newdream.net>
Tue, 9 Mar 2021 21:09:12 +0000 (16:09 -0500)
committerSage Weil <sage@newdream.net>
Tue, 16 Mar 2021 12:56:18 +0000 (07:56 -0500)
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)

src/python-common/ceph/deployment/service_spec.py
src/python-common/ceph/tests/test_service_spec.py

index 2e6b4ab1e59cea293e32ff41efa94902a76e653a..2a954f6d313fb064ba841ff394e9b496aa989d54 100644 (file)
@@ -295,6 +295,14 @@ class PlacementSpec(object):
             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:
index 7364ce07c5a0a277edf1378b6dca65244690f4a1..8cbadcf8c8a39b6d56788a699e05cff629cc7bb3 100644 (file)
@@ -78,6 +78,8 @@ def test_parse_placement_specs(test_input, expected):
         ('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):