]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: add daemon_name in daemon description 41445/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 20 May 2021 14:06:05 +0000 (16:06 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 22 Sep 2021 08:22:18 +0000 (10:22 +0200)
This adds the daemon_name in json output when asking for daemon
description.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
src/pybind/mgr/cephadm/tests/test_cephadm.py
src/pybind/mgr/cephadm/tests/test_spec.py
src/pybind/mgr/orchestrator/_interface.py
src/pybind/mgr/orchestrator/tests/test_orchestrator.py

index a2af2fb110a7839c78a6e11c710aa0cba40a7e3b..a741c250d064c0d225ca3d6928e02fac63c5c653 100644 (file)
@@ -114,6 +114,7 @@ class TestCephadm(object):
                     out = dd.to_json()
                     del out['daemon_id']
                     del out['events']
+                    del out['daemon_name']
                     return out
 
                 assert [remove_id_events(dd) for dd in wait(cephadm_module, c)] == [
index d46cbfe7f17ff3c454a26a1d093f03476ddc646a..23fcf9c2367a0c925e1ffccb6cacca9bd776003e 100644 (file)
@@ -284,6 +284,7 @@ def test_dd_octopus(dd_json):
                   'last_configured']:
             if k in j:
                 j[k] = j[k].rstrip('Z')
+        del j['daemon_name']
         return j
 
     assert dd_json == convert_to_old_style_json(
index 34beb5e2a3fb640cfef8e1f3e2296a9f8011d40c..a88ab9c71c7b37f95312a45e657d1b0f5aac9770 100644 (file)
@@ -829,6 +829,7 @@ class DaemonDescription(object):
         # This is the <foo> in mds.<foo>, the ID that will appear
         # in the FSMap/ServiceMap.
         self.daemon_id: Optional[str] = daemon_id
+        self.daemon_name = self.name()
 
         # Some daemon types have a numeric rank assigned
         self.rank: Optional[int] = rank
@@ -962,6 +963,7 @@ class DaemonDescription(object):
         out['daemon_type'] = self.daemon_type
         out['daemon_id'] = self.daemon_id
         out['service_name'] = self._service_name
+        out['daemon_name'] = self.name()
         out['hostname'] = self.hostname
         out['container_id'] = self.container_id
         out['container_image_id'] = self.container_image_id
@@ -998,6 +1000,7 @@ class DaemonDescription(object):
         out: Dict[str, Any] = OrderedDict()
         out['daemon_type'] = self.daemon_type
         out['daemon_id'] = self.daemon_id
+        out['daemon_name'] = self.name()
         out['hostname'] = self.hostname
         out['container_id'] = self.container_id
         out['container_image_id'] = self.container_image_id
@@ -1039,6 +1042,8 @@ class DaemonDescription(object):
                 c[k] = str_to_datetime(c[k])
         events = [OrchestratorEvent.from_json(e) for e in event_strs]
         status_int = c.pop('status', None)
+        if 'daemon_name' in c:
+            del c['daemon_name']
         status = DaemonDescriptionStatus(status_int) if status_int is not None else None
         return cls(events=events, status=status, **c)
 
index 35154270449f83f658e67c07750073ef4118b519..63d831ca50c9bbd7a154edb4a07ee744b383e019 100644 (file)
@@ -83,6 +83,7 @@ def test_apply():
 def test_yaml():
     y = """daemon_type: crash
 daemon_id: ubuntu
+daemon_name: crash.ubuntu
 hostname: ubuntu
 status: 1
 status_desc: starting