]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: make DaemonPlacement print nicer
authorSage Weil <sage@newdream.net>
Wed, 17 Mar 2021 19:38:57 +0000 (15:38 -0400)
committerSage Weil <sage@newdream.net>
Wed, 17 Mar 2021 21:45:41 +0000 (17:45 -0400)
'host(ip:port)' or 'host(*:port)' so we can show it to a user.

Signed-off-by: Sage Weil <sage@newdream.net>
src/pybind/mgr/cephadm/schedule.py
src/pybind/mgr/cephadm/tests/test_scheduling.py

index 914f178f3cad020ca09a634f5c9034131267ab11..c7774167068fa0d715e1119c613ed65c3aa2d495 100644 (file)
@@ -25,10 +25,8 @@ class DaemonPlacement(NamedTuple):
             other.append(f'network={self.network}')
         if self.name:
             other.append(f'name={self.name}')
-        if self.ip:
-            other.append(f'ip={self.ip}')
         if self.port:
-            other.append(f'port={self.port}')
+            other.append(f'{self.ip or "*"}:{self.port}')
         if other:
             res += '(' + ' '.join(other) + ')'
         return res
index f149066fc15d142309999518a0f23c388b5a494c..2a2c6a1d79ff71c6166af57db5ab4855944b3e6d 100644 (file)
@@ -534,10 +534,10 @@ class NodeAssignmentTest(NamedTuple):
             PlacementSpec(count=6, label='foo'),
             'host1 host2 host3'.split(),
             [],
-            ['host1(port=80)', 'host2(port=80)', 'host3(port=80)',
-             'host1(port=81)', 'host2(port=81)', 'host3(port=81)'],
-            ['host1(port=80)', 'host2(port=80)', 'host3(port=80)',
-             'host1(port=81)', 'host2(port=81)', 'host3(port=81)'],
+            ['host1(*:80)', 'host2(*:80)', 'host3(*:80)',
+             'host1(*:81)', 'host2(*:81)', 'host3(*:81)'],
+            ['host1(*:80)', 'host2(*:80)', 'host3(*:80)',
+             'host1(*:81)', 'host2(*:81)', 'host3(*:81)'],
             []
         ),
         # label + count_per_host + ports (+ xisting)
@@ -550,10 +550,10 @@ class NodeAssignmentTest(NamedTuple):
                 DaemonDescription('rgw', 'b', 'host2', ports=[80]),
                 DaemonDescription('rgw', 'c', 'host1', ports=[82]),
             ],
-            ['host1(port=80)', 'host2(port=80)', 'host3(port=80)',
-             'host1(port=81)', 'host2(port=81)', 'host3(port=81)'],
-            ['host1(port=80)', 'host3(port=80)',
-             'host2(port=81)', 'host3(port=81)'],
+            ['host1(*:80)', 'host2(*:80)', 'host3(*:80)',
+             'host1(*:81)', 'host2(*:81)', 'host3(*:81)'],
+            ['host1(*:80)', 'host3(*:80)',
+             'host2(*:81)', 'host3(*:81)'],
             ['rgw.c']
         ),
         # cephadm.py teuth case
@@ -753,12 +753,12 @@ class NodeAssignmentTest4(NamedTuple):
                 'host3': {'192.168.0.0/16': ['192.168.0.1']},
             },
             [],
-            ['host1(ip=10.0.0.1 port=80)', 'host2(ip=10.0.0.2 port=80)',
-             'host1(ip=10.0.0.1 port=81)', 'host2(ip=10.0.0.2 port=81)',
-             'host1(ip=10.0.0.1 port=82)', 'host2(ip=10.0.0.2 port=82)'],
-            ['host1(ip=10.0.0.1 port=80)', 'host2(ip=10.0.0.2 port=80)',
-             'host1(ip=10.0.0.1 port=81)', 'host2(ip=10.0.0.2 port=81)',
-             'host1(ip=10.0.0.1 port=82)', 'host2(ip=10.0.0.2 port=82)'],
+            ['host1(10.0.0.1:80)', 'host2(10.0.0.2:80)',
+             'host1(10.0.0.1:81)', 'host2(10.0.0.2:81)',
+             'host1(10.0.0.1:82)', 'host2(10.0.0.2:82)'],
+            ['host1(10.0.0.1:80)', 'host2(10.0.0.2:80)',
+             'host1(10.0.0.1:81)', 'host2(10.0.0.2:81)',
+             'host1(10.0.0.1:82)', 'host2(10.0.0.2:82)'],
             []
         ),
     ])