From: Sebastian Wagner Date: Mon, 18 May 2020 10:35:34 +0000 (+0200) Subject: cephadm: `ls`: also return systemd_unit X-Git-Tag: v15.2.4~73^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=16a1a037f6512809b1073db026a181074a6bab6f;p=ceph.git cephadm: `ls`: also return systemd_unit 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 (cherry picked from commit d8f81540600ee1687030259ed535a390a5b65f09) --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index badcb77a5906..f0d452460107 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -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)