]> git.proxmox.com Git - ceph.git/blob - ceph/src/ceph-volume/ceph_volume/systemd/systemctl.py
update sources to v12.1.3
[ceph.git] / ceph / src / ceph-volume / ceph_volume / systemd / systemctl.py
1 """
2 Utilities to control systemd units
3 """
4 from ceph_volume import process
5
6
7 def start(unit):
8 process.run(['sudo', 'systemctl', 'start', unit])
9
10
11 def stop(unit):
12 process.run(['sudo', 'systemctl', 'stop', unit])
13
14
15 def enable(unit):
16 process.run(['sudo', 'systemctl', 'enable', unit])
17
18
19 def disable(unit):
20 process.run(['sudo', 'systemctl', 'disable', unit])
21
22
23 def start_osd(id_):
24 return start(osd_unit % id_)
25
26
27 def stop_osd(id_):
28 return stop(osd_unit % id_)
29
30
31 def enable_osd(id_):
32 return enable(osd_unit % id_)
33
34
35 def disable_osd(id_):
36 return disable(osd_unit % id_)
37
38
39 def enable_volume(id_, fsid, device_type='lvm'):
40 return enable(volume_unit % (device_type, id_, fsid))
41
42
43 #
44 # templates
45 #
46
47 osd_unit = "ceph-osd@%s"
48 volume_unit = "ceph-volume@%s-%s-%s"