From: Sage Weil Date: Wed, 4 Mar 2020 17:05:20 +0000 (-0600) Subject: mgr/orch: PlacementSpec: allow 'count:123' X-Git-Tag: v15.1.1~74^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=92d5af3b749942dd32ad850275dac3cff4f7127b;p=ceph.git mgr/orch: PlacementSpec: allow 'count:123' Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index e1fd1af93391..8d83c9acbdf6 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -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: diff --git a/src/pybind/mgr/tests/test_orchestrator.py b/src/pybind/mgr/tests/test_orchestrator.py index be4f89a77714..7bf176980f5d 100644 --- a/src/pybind/mgr/tests/test_orchestrator.py +++ b/src/pybind/mgr/tests/test_orchestrator.py @@ -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)"),