From: Alfredo Deza Date: Wed, 28 Jun 2017 17:49:39 +0000 (-0400) Subject: ceph-volume: systemd: create a systemctl module X-Git-Tag: ses5-milestone10~3^2~5^2~81 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d382d041bf45cf65e0faae3b4dafbe774bbc4153;p=ceph.git ceph-volume: systemd: create a systemctl module Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/systemd/systemctl.py b/src/ceph-volume/ceph_volume/systemd/systemctl.py new file mode 100644 index 000000000000..b137260ce423 --- /dev/null +++ b/src/ceph-volume/ceph_volume/systemd/systemctl.py @@ -0,0 +1,43 @@ +""" +Utilities to control systemd units +""" +from ceph_volume import process + + +def start(unit): + process.run(['sudo', 'systemctl', 'start', unit]) + + +def stop(unit): + process.run(['sudo', 'systemctl', 'stop', unit]) + + +def enable(unit): + process.run(['sudo', 'systemctl', 'enable', unit]) + + +def disable(unit): + process.run(['sudo', 'systemctl', 'disable', unit]) + + +def start_osd(id_): + return start(osd_unit % id_) + + +def stop_osd(id_): + return stop(osd_unit % id_) + + +def enable_osd(id_): + return enable(osd_unit % id_) + + +def disable_osd(id_): + return disable(osd_unit % id_) + + +# +# templates +# + +osd_unit = "ceph-osd@%s"