]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: systemd: create a systemctl module
authorAlfredo Deza <adeza@redhat.com>
Wed, 28 Jun 2017 17:49:39 +0000 (13:49 -0400)
committerAlfredo Deza <adeza@redhat.com>
Fri, 4 Aug 2017 14:25:57 +0000 (10:25 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
src/ceph-volume/ceph_volume/systemd/systemctl.py [new file with mode: 0644]

diff --git a/src/ceph-volume/ceph_volume/systemd/systemctl.py b/src/ceph-volume/ceph_volume/systemd/systemctl.py
new file mode 100644 (file)
index 0000000..b137260
--- /dev/null
@@ -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"