]>
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
])
15 def enable(unit
, runtime
=False):
17 process
.run(['systemctl', 'enable', '--runtime', unit
])
19 process
.run(['systemctl', 'enable', unit
])
23 process
.run(['systemctl', 'disable', unit
])
27 process
.run(['systemctl', 'mask', unit
])
31 out
, err
, rc
= process
.call(
32 ['systemctl', 'is-active', unit
],
33 verbose_on_failure
=False
39 return start(osd_unit
% id_
)
43 return stop(osd_unit
% id_
)
47 return enable(osd_unit
% id_
, runtime
=True)
51 return disable(osd_unit
% id_
)
54 def osd_is_active(id_
):
55 return is_active(osd_unit
% id_
)
58 def enable_volume(id_
, fsid
, device_type
='lvm'):
59 return enable(volume_unit
% (device_type
, id_
, fsid
))
63 # systemctl allows using a glob like '*' for masking, but there was a bug
64 # in that it wouldn't allow this for service templates. This means that
65 # masking ceph-disk@* will not work, so we must link the service directly.
66 # /etc/systemd takes precedence regardless of the location of the unit
68 ['ln', '-sf', '/dev/null', '/etc/systemd/system/ceph-disk@.service']
76 osd_unit
= "ceph-osd@%s"
77 ceph_disk_unit
= "ceph-disk@%s"
78 volume_unit
= "ceph-volume@%s-%s-%s"