]>
git.proxmox.com Git - ceph.git/blob - ceph/src/ceph-volume/ceph_volume/systemd/systemctl.py
2 Utilities to control systemd units
4 from ceph_volume
import process
8 process
.run(['systemctl', 'start', unit
])
12 process
.run(['systemctl', 'stop', unit
])
16 process
.run(['systemctl', 'enable', unit
])
20 process
.run(['systemctl', 'disable', unit
])
24 process
.run(['systemctl', 'mask', unit
])
28 out
, err
, rc
= process
.call(
29 ['systemctl', 'is-active', unit
],
30 verbose_on_failure
=False
36 return start(osd_unit
% id_
)
40 return stop(osd_unit
% id_
)
44 return enable(osd_unit
% id_
)
48 return disable(osd_unit
% id_
)
51 def osd_is_active(id_
):
52 return is_active(osd_unit
% id_
)
55 def enable_volume(id_
, fsid
, device_type
='lvm'):
56 return enable(volume_unit
% (device_type
, id_
, fsid
))
60 # systemctl allows using a glob like '*' for masking, but there was a bug
61 # in that it wouldn't allow this for service templates. This means that
62 # masking ceph-disk@* will not work, so we must link the service directly.
63 # /etc/systemd takes precedence regardless of the location of the unit
65 ['ln', '-sf', '/dev/null', '/etc/systemd/system/ceph-disk@.service']
73 osd_unit
= "ceph-osd@%s"
74 ceph_disk_unit
= "ceph-disk@%s"
75 volume_unit
= "ceph-volume@%s-%s-%s"