]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orch: PlacementSpec: allow 'count:123'
authorSage Weil <sage@redhat.com>
Wed, 4 Mar 2020 17:05:20 +0000 (11:05 -0600)
committerSage Weil <sage@redhat.com>
Sat, 7 Mar 2020 03:27:48 +0000 (21:27 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/orchestrator/_interface.py
src/pybind/mgr/tests/test_orchestrator.py

index e1fd1af9339154173f59d4bac7065cd927ce87bf..8d83c9acbdf6249d5dc12d27e731aacee7c63453 100644 (file)
@@ -1360,6 +1360,14 @@ class PlacementSpec(object):
                 strings = strings[1:]
             except ValueError:
                 pass
+        for s in strings:
+            if s.startswith('count:'):
+                try:
+                    count = int(s[6:])
+                    strings.remove(s)
+                    break
+                except ValueError:
+                    pass
 
         all_hosts = False
         if '*' in strings:
index be4f89a777145322eb7fa49ca0d47efc0b3a0d17..7bf176980f5d0831e2ec50e176700fc54a70a9df 100644 (file)
@@ -34,6 +34,7 @@ def test_parse_host_placement_specs(test_input, expected, require_network):
     "test_input,expected",
     [
         ('', "PlacementSpec()"),
+        ("count:2", "PlacementSpec(count:2)"),
         ("3", "PlacementSpec(count:3)"),
         ("host1 host2", "PlacementSpec(host1,host2)"),
         ("host1=a host2=b", "PlacementSpec(host1=a,host2=b)"),