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 return start(osd_unit % id_)
32 return stop(osd_unit % id_)
36 return enable(osd_unit % id_)
40 return disable(osd_unit % id_)
43 def enable_volume(id_, fsid, device_type='lvm'):
44 return enable(volume_unit % (device_type, id_, fsid))
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
53 ['ln', '-sf', '/dev/null', '/etc/systemd/system/ceph-disk@.service']
61 osd_unit = "ceph-osd@%s"
62 ceph_disk_unit = "ceph-disk@%s"
63 volume_unit = "ceph-volume@%s-%s-%s"