]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume systemd.systemctl add helpers for daemon status
authorAlfredo Deza <adeza@redhat.com>
Thu, 29 Mar 2018 12:35:17 +0000 (08:35 -0400)
committerAlfredo Deza <adeza@redhat.com>
Thu, 29 Mar 2018 19:12:39 +0000 (15:12 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
src/ceph-volume/ceph_volume/systemd/systemctl.py

index d5fd0dd8083ef14df1ae40c505a4a72dc7448fb5..ab78456e6c2f9f44003c66c4d24be060ba8776f8 100644 (file)
@@ -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))