]> git.proxmox.com Git - ceph.git/blame - ceph/src/ceph-volume/ceph_volume/systemd/systemctl.py
update sources to v12.2.3
[ceph.git] / ceph / src / ceph-volume / ceph_volume / systemd / systemctl.py
CommitLineData
d2e6a577
FG
1"""
2Utilities to control systemd units
3"""
4from ceph_volume import process
5
6
7def start(unit):
b32b8144 8 process.run(['systemctl', 'start', unit])
d2e6a577
FG
9
10
11def stop(unit):
b32b8144 12 process.run(['systemctl', 'stop', unit])
d2e6a577
FG
13
14
15def enable(unit):
b32b8144 16 process.run(['systemctl', 'enable', unit])
d2e6a577
FG
17
18
19def disable(unit):
b32b8144 20 process.run(['systemctl', 'disable', unit])
d2e6a577
FG
21
22
3efd9988 23def mask(unit):
b32b8144 24 process.run(['systemctl', 'mask', unit])
3efd9988
FG
25
26
d2e6a577
FG
27def start_osd(id_):
28 return start(osd_unit % id_)
29
30
31def stop_osd(id_):
32 return stop(osd_unit % id_)
33
34
35def enable_osd(id_):
36 return enable(osd_unit % id_)
37
38
39def disable_osd(id_):
40 return disable(osd_unit % id_)
41
42
43def enable_volume(id_, fsid, device_type='lvm'):
44 return enable(volume_unit % (device_type, id_, fsid))
45
46
3efd9988
FG
47def mask_ceph_disk():
48 # systemctl allows using a glob like '*' for masking, but there was a bug
49 # in that it wouldn't allow this for service templates. This means that
50 # masking ceph-disk@* will not work, so we must link the service directly.
51 # /etc/systemd takes precendence regardless of the location of the unit
52 process.run(
b32b8144 53 ['ln', '-sf', '/dev/null', '/etc/systemd/system/ceph-disk@.service']
3efd9988
FG
54 )
55
56
d2e6a577
FG
57#
58# templates
59#
60
61osd_unit = "ceph-osd@%s"
3efd9988 62ceph_disk_unit = "ceph-disk@%s"
d2e6a577 63volume_unit = "ceph-volume@%s-%s-%s"