Comment 18 for bug 1740892

Revision history for this message
Eric Desrochers (slashd) wrote :

As per nacc's comment it seems like "Wants=" is the recommended way to hook start-up of one unit to the start-up of another unit.[1]

[1] - https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Wants=

So far I have tested using 2 scenarios (including "Wants=pacemaker.service") and it look good so far.

---------------------------------------
* Scenario #1
[Both corosync & pacemaker installed]
---------------------------------------

- pacemaker start on corosync start.

root@xenialcorosyncpacemaker:~# systemctl status corosync | egrep "PID|Active:"
   Active: active (running) since Mon 2018-01-08 19:29:44 UTC; 21s ago
 Main PID: 445 (corosync)

root@xenialcorosyncpacemaker:~# systemctl status pacemaker | egrep "PID|Active:"
   Active: active (running) since Mon 2018-01-08 19:29:44 UTC; 27s ago
 Main PID: 447 (pacemakerd)

root@xenialcorosyncpacemaker:~# systemctl stop corosync

root@xenialcorosyncpacemaker:~# systemctl status corosync | egrep "PID|Active:"
   Active: inactive (dead) since Mon 2018-01-08 19:30:29 UTC; 1s ago
 Main PID: 445 (code=exited, status=0/SUCCESS)

root@xenialcorosyncpacemaker:~# systemctl status pacemaker | egrep "PID|Active:"
   Active: inactive (dead) since Mon 2018-01-08 19:30:29 UTC; 3s ago
 Main PID: 447 (code=exited, status=0/SUCCESS)

root@xenialcorosyncpacemaker:~# systemctl start corosync

root@xenialcorosync:~# systemctl status corosync | egrep "PID|Active:"
   Active: active (running) since Mon 2018-01-08 19:30:56 UTC; 1s ago
 Main PID: 474 (corosync)

root@xenialcorosyncpacemaker:~# systemctl status pacemaker | egrep "PID|Active:"
   Active: active (running) since Mon 2018-01-08 19:30:56 UTC; 3s ago
 Main PID: 476 (pacemakerd)

---------------------------------------
* Scenario #2
[corosync installed & pacemaker not installed]
---------------------------------------

- It doesn't seem to have any side-effects when pacemaker isn't installed.
The Wants= options is simply ignore since the pacemaker.service is not present.

root@xenialcorosyncnopacemaker:~# systemctl status corosync | egrep "PID|Active:"
   Active: active (running) since Mon 2018-01-08 19:32:11 UTC; 53s ago
 Main PID: 1284 (corosync)

root@xenialcorosyncnopacemake:~# systemctl status pacemaker
● pacemaker.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

root@v:~# systemctl stop corosync

root@xenialcorosyncnopacemake:~# systemctl status pacemaker
● pacemaker.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

root@xenialcorosyncnopacemake:~# systemctl status corosync | egrep "PID|Active:"
   Active: inactive (dead) since Mon 2018-01-08 19:33:17 UTC; 4s ago
 Main PID: 1284 (code=exited, status=0/SUCCESS)

root@xenialcorosyncnopacemake:~# systemctl start corosync

root@xenialcorosyncnopacemake:~# systemctl status corosync | egrep "PID|Active:"
   Active: active (running) since Mon 2018-01-08 19:33:26 UTC; 1s ago
 Main PID: 1378 (corosync)

- Eric