From 2e8249f9e233d408fc45b772e45995c00f5180d7 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 29 Mar 2018 08:35:17 -0400 Subject: [PATCH] ceph-volume systemd.systemctl add helpers for daemon status Signed-off-by: Alfredo Deza --- src/ceph-volume/ceph_volume/systemd/systemctl.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ceph-volume/ceph_volume/systemd/systemctl.py b/src/ceph-volume/ceph_volume/systemd/systemctl.py index d5fd0dd8083ef..ab78456e6c2f9 100644 --- a/src/ceph-volume/ceph_volume/systemd/systemctl.py +++ b/src/ceph-volume/ceph_volume/systemd/systemctl.py @@ -24,6 +24,14 @@ def mask(unit): process.run(['systemctl', 'mask', unit]) +def is_active(unit): + out, err, rc = process.call( + ['systemctl', 'is-active', unit], + verbose_on_failure=False + ) + return rc == 0 + + def start_osd(id_): return start(osd_unit % id_) @@ -40,6 +48,10 @@ def disable_osd(id_): return disable(osd_unit % id_) +def osd_is_active(id_): + return is_active(osd_unit % id_) + + def enable_volume(id_, fsid, device_type='lvm'): return enable(volume_unit % (device_type, id_, fsid)) -- 2.39.5