Fix: cts: Start corosync using systemd if available
As of corosync upstream commit ae859515, in systemd builds,
StateDirectory is set in the systemd corosync.service file. The corosync
state directory defaults to this value if not set in the corosync config
file. Corosync falls back to using /var/lib/corosync only if the systemd
StateDirectory is not set.
The same commit removes /var/lib/corosync from RPM builds with systemd.
As a result, if corosync was built with systemd, then starting corosync
outside of systemd fails unless /var/lib/corosync has been created
manually or through some other means. Starting corosync directly from
the command line fails with the following error, because the
STATE_DIRECTORY environment variable was not set by systemd:
Cannot chdir to state directory /var/lib/corosync. No such file or
directory
This causes Pacemaker's cts-fencing script to fail.
This seems like a bug in corosync, as it now assumes that corosync will
always be started by systemd if available. Here, we work around it in
cts by doing exactly that.
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>