]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: add daemon_name in daemon description
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 20 May 2021 14:06:05 +0000 (16:06 +0200)
committerSebastian Wagner <sewagner@redhat.com>
Tue, 2 Nov 2021 09:01:20 +0000 (10:01 +0100)
This adds the daemon_name in json output when asking for daemon
description.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 19ee16a46b90d92f1a49ace5ba1a3c47eb8c1403)

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 dfa3cb4b6efad10d7dffade300f4c14c80b66818..649c09013fb792ad6f97e21408070f27ec9b586b 100644 (file)
@@ -115,6 +115,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 35f4b64b8782df4ca866d630f258bdd0585eddf6..7ccd06146661a3e92f3122a0705931725c023b3c 100644 (file)
@@ -84,6 +84,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