]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: `ls`: also return systemd_unit
authorSebastian Wagner <sebastian.wagner@suse.com>
Mon, 18 May 2020 10:35:34 +0000 (12:35 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 21 May 2020 21:33:18 +0000 (23:33 +0200)
Let users directly know the systemd unit name.

Enable things like

```
cephadm ls | jq -r '.[].systemd_unit' | xargs -n 1 systemctl status | cat
```

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
(cherry picked from commit d8f81540600ee1687030259ed535a390a5b65f09)

src/cephadm/cephadm

index badcb77a59065e6b4d8ac61c817327579c59bb57..f0d4524601079e61a5e13f128aca907bb469a651 100755 (executable)
@@ -2993,14 +2993,15 @@ def list_daemons(detail=True, legacy_dir=None):
                     fsid = get_legacy_daemon_fsid(
                             cluster, daemon_type, daemon_id,
                             legacy_dir=legacy_dir)
+                    legacy_unit_name = 'ceph-%s@%s' % (daemon_type, daemon_id)
                     i = {
                         'style': 'legacy',
                         'name': '%s.%s' % (daemon_type, daemon_id),
                         'fsid': fsid if fsid is not None else 'unknown',
+                        'systemd_unit': legacy_unit_name,
                     }
                     if detail:
-                        (i['enabled'], i['state'], _) = check_unit(
-                            'ceph-%s@%s' % (daemon_type, daemon_id))
+                        (i['enabled'], i['state'], _) = check_unit(legacy_unit_name)
                         if not host_version:
                             try:
                                 out, err, code = call(['ceph', '-v'])
@@ -3108,6 +3109,7 @@ def list_daemons(detail=True, legacy_dir=None):
                             os.path.join(data_dir, fsid, j, 'unit.image'))
                         i['configured'] = get_file_timestamp(
                             os.path.join(data_dir, fsid, j, 'unit.configured'))
+                        i['systemd_unit'] = unit_name
 
                     ls.append(i)