Comment 20 for bug 1740892

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Currently, in bionic:
$ systemctl cat pacemaker.service
# /lib/systemd/system/pacemaker.service
After=corosync.service
Requires=corosync.service

$ systemctl cat corosync.service
<nothing about pacemaker>

Desired properties:
i) when corosync is started, attempt to start pacemaker
ii) when corosync is restarted, attempt to restart pacemaker too
iii) when corosync is stopped, do not stop pacemaker

1) Property i) can be satisfied with [Install] WantedBy=corosync.service, in pacemaker.service.

2) Requires=corosync.service is too strong, as it means that pacemaker cannot operate without corosync. Is this true?

3) Currently on upgrade corosync prerm script does "stop corosync" and later postinst does "start corosync". My understanding it would be better, on upgrades to simply "restart" corosync, instead of doing stop&start. Please consider switching corosync package to use dh_systemd and use restart-on-upgrade dh_installinit/systemd option.

4) Properties ii) and iii) cannot currently be satisfied simultaneously with simple stanzas. If pacemaker requires corosync at all time, then pacemaker.service should declare PartOf=corosync.service. Then stop/restart of corosync will stop and restart pacemaker. Condition ii) is good. However that will violate condition iii). However, we can instead introduce a helper unit to achieve both ii) and iii) simultaneously. e.g.:

pacemaker-restart.service
[Unit]
PartOf=corosync.service
[Service]
ExecStart=/bin/true
ExecStop=/bin/systemctl restart pacemaker.service
[Install]
WantedBy=corosync.service

This means that whenever corosync is stopped, or restarted, pacemaker.service will be restarted too. This extra unit will satisfy the conditions `ii` and `iii` as stated.