Commit Graph

76 Commits

Author SHA1 Message Date
Jan Friesse
0d1a1b1329 init: Use cpgtool instead of cfgtool
Init script used to use corosync-cfgtool -s to wait till
corosync accepts ipc connection. Problem with this approach
is that error code is returned not only if ipc cannot be initialized,
but also when one of the ring is marked as failed, making corosync
service not to start. Corosync with one failed ring can work just
fine and there is no need to fail startup.

Patch is changing call of corosync-cfgtool to corosync-cpgtool. Also to
make spotting of broken ring easier, corosync-cfgtool -s is called after
successful return of the cpgtool, and warning is issued if cfgtool
fails.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2019-07-08 16:00:39 +02:00
Jan Friesse
527e30a8d0 Revert "init: Enable StopWhenUnneeded"
This reverts commit 03d9321bc8.

Reverted because when corosync service is not enabled and corosync
is executed by "systemctl start corosync" it is then immediately
shutdown because of "Unit not needed anymore. Stopping.".

This is really not expected behavior.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2019-04-04 11:51:23 +02:00
Ferenc Wágner
6a476017b9 build: Use the SED variable provided by configure
Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2019-02-06 16:04:55 +01:00
Jan Pokorný
03d9321bc8 init: Enable StopWhenUnneeded
It shall be a rule of thumb not to combine "application stack"
components run under particular init/supervision mechanism and
run by whatever other means (without transitive relationships
like when corosync's client runs from other pacemaker that is
itself started through systemd) when there's a directed graph
of reliance between them (sans constrained corner cases like
when of such components is a kernel module).

And corosync on its own is just a service provider that only
appears useful when utilized as a basic building block for
application specific distributed environments.

Therefore, we may assume whenever corosync gets started by the
means of systemd, it's because of a mechanized attempt to satisfy
declared dependency of some such corosync's client that is about
to be started under the service manager realms (directly or, by
induction, through the same triggering mechanism indirectly).
Hence, when there's no such client around anymore (unless
this dependant is being restarted at the moment, see below)
corosync shall rather shutdown as well.

In the past, there was an issue with systemd regarding said
inflicted restart of the dependant/client, but that's resolved
as of v236:
https://github.com/systemd/systemd/commit/
deb4e7080db9dcd2a1d51ccf7c357f88ea863e54

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2019-01-11 09:49:35 +01:00
Jan Friesse
4e77f108c8 init: Fix init script to work with containers
Previously init scripts were not using pid file so pidof was used. This
is usually not a problem, but when containers are used it may result to
killing improper instance when issued on host.

Solution is to always use pidfile.

Also try to use LSB complaint status codes.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-11-15 17:32:04 +01:00
Jan Pokorný
c34208ad40 systemd: prevent redundancy in journal
Originating from a dual sink (stderr and syslog).

Annotated example from "journalctl -b --no-hostname -u corosync":

Aug 14 00:27:45 corosync[5203]:  [MAIN  ] Corosync Cluster
Engine ('2.99.3'): started and ready to provide service.
  ^ from syslog source
Aug 14 00:27:45 corosync[5203]: notice  [MAIN  ] Corosync Cluster
Engine ('2.99.3'): started and ready to provide service.
  ^ from stderr source

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2018-08-14 13:03:32 +02:00
Jan Friesse
fc45968223 init: Use existing env variable from sysconf
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-07-02 08:08:23 +02:00
Jan Friesse
0031822c68 upstart: Remove notifyd upstart unit
Hopefully this is last upstart bit.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-07-02 08:07:15 +02:00
Jan Friesse
e72b4fee62 init: Quote subshell result properly
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-03-02 17:29:11 +01:00
Jan Friesse
59bd5f0fa6 build: Remove support for upstart
Upstart files were already mostly removed but not from spec file and
configure.ac.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-01-25 16:08:11 +01:00
Jan Friesse
e35a419b1d qdevice: Remove qdevices
corosync-qdevice and corosync-qnetd now has a new home
https://github.com/corosync/corosync-qdevice

This will allow us to better react on actual needs of quite independent
projects.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-01-25 16:08:01 +01:00
Ferenc Wágner
e469bd8c6c systemd: corosync-qdevice can not run without corosync
Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-11-10 15:05:28 +01:00
Ferenc Wágner
9292c79e05 configure: kill off INITWRAPPERSDIR
When configured for systemd, don't install the SysV init scripts at all.

Signed-off-by: Ferenc Wágner <wferi@debian.org>
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-11-09 09:51:41 +01:00
Ferenc Wágner
800f762ee9 corosync-qdevice: send startup notification to systemd
Signed-off-by: Ferenc Wágner <wferi@debian.org>
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-11-09 09:51:04 +01:00
Ferenc Wágner
bccfbae62b corosync-qnetd: send startup notification to systemd
Signed-off-by: Ferenc Wágner <wferi@debian.org>
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-11-09 09:50:48 +01:00
Ferenc Wágner
188f9bdb1e Send corosync-notifyd startup notification to systemd
Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-11-09 09:50:32 +01:00
Ferenc Wágner
63601197ed Make systemd stop corosync-notifyd if corosync is stopped
Otherwise is just exits successfully (which should probably be fixed
eventually), leading to confusion.

Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-11-09 09:49:42 +01:00
Ferenc Wágner
09b0123d58 Send corosync startup notification to systemd
This enables starting the daemon directly in the service file, because
dependent units won't be started until initialization is complete.

Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-11-09 09:49:18 +01:00
Ferenc Wágner
c733e9417e Use RuntimeDirectory instead of tmpfiles.d
This reverts part of commit 32123f6bb2.

A simple directive is a much lighter solution to the same problem, and
automatically follows the specified User.  I copied the 0770 modes from
the corresponding init scripts; they could use a little documentation.

Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-10-31 16:20:32 +01:00
Ferenc Wágner
87a803ab94 Use static case blocks to determine distro flavor
This is a configure-time decision, avoid live filesystem checks.

Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-10-30 13:14:35 +01:00
Ferenc Wágner
d7208e8837 configure: add --with-initconfigdir option
Default value is /etc/sysconfig and resulting
INITCONFIGDIR is used to reduce duplication in init system
integration code.

Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-10-30 13:12:43 +01:00
yuusuke
1d05569fa9 upstart: Add softdog module loading example
Signed-off-by: yuusuke <yusk.iida@gmail.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-12-05 09:46:17 +01:00
Ferenc Wágner
8a940f9a18 init: Add doc URIs to the systemd service files
These are used by systemctl help.

Signed-off-by: Ferenc Wágner <wferi@niif.hu>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-11-28 09:58:09 +01:00
yuusuke
818b2682c5 systemd: Delete unnecessary soft_margin
Signed-off-by: yuusuke <yusk.iida@gmail.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-11-21 18:04:53 +01:00
Ferenc Wágner
aab840256d init: corosync and cman aren't system facilities
Signed-off-by: Ferenc Wágner <wferi@niif.hu>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-09-02 11:16:00 +02:00
Jan Friesse
a3dba5dea8 Qdevices: Include required files in tarball
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-30 17:18:15 +02:00
Jan Friesse
32123f6bb2 Qdevice: Handle /var/run on tmpfs
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:43 +02:00
Jan Friesse
b415634f95 Qdevice: Add sysconfig example
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:43 +02:00
Jan Friesse
7d3979fdba Qnetd: Execute qnetd as non root user
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:43 +02:00
Jan Friesse
8f079affa9 Make sure all qdevice files are packaged
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:42 +02:00
Jan Friesse
c37d0cc143 qdevice: Add qdevice service scripts
Also fix qnetd systemd service.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:40 +02:00
Jan Friesse
1561dce437 qnetd: Add init script
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:39 +02:00
Jan Friesse
b627844f3d init: Don't wait for ipc if corosync doesn't start
Init script now checks return code of executing corosync command. If it
fails, ipc_wait section is skipped, resulting in much faster failure of
init script.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2014-10-08 13:29:57 +02:00
Kazunori INOUE
f6d6a9b0a0 systemd: Config example for corosync wd service
Signed-off-by: Kazunori INOUE <kazunori.inoue3@gmail.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2014-07-01 16:26:28 +02:00
Lidong Zhong
7a6cc6b5a2 init: change return value when starting corosync
When corosync is started by systemd, it would be considered
as failed because it returns a non-zero value, even though it
starts sucessfully.

Signed-off-by: Lidong Zhong <lzhong@suse.com>
Signed-off-by: Xia Li<xli@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2014-06-09 13:29:15 +02:00
Kazunori INOUE
d23ee6a3e0 upstart: Make job conf file configurable
Signed-off-by: Kazunori INOUE <kazunori.inoue3@gmail.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2014-05-09 11:25:58 +02:00
Jan Friesse
1f7e78ab9c init: Make init script configurable
Init script loads /etc/sysconfig/corosync (or /etc/defaults/corosync) by
default, but it didn't existed by default and also no options was
defined.

Patch adds COROSYNC_INIT_TIMEOUT (how many seconds to wait for ipc
initialization) with default value 1 minute (instead of previous 10
seconds, what may be too small value for some productions) and
COROSYNC_OPTIONS (by default empty) containing options directly
passed to corosync executable.

Specfile template is also modified to install example of init file
configuration.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2014-04-11 11:02:18 +02:00
Jan Friesse
6cd1f67f1f systemd unit: Make sure network is really up
Change network.target to network-online.target to make sure network is
really up and running when starting corosync.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2014-01-13 14:40:28 +01:00
Kazunori INOUE
3551dc920b Use restart policy in the corosync-notifyd unit
Signed-off-by: Kazunori INOUE <inouekazu@intellilink.co.jp>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2013-07-08 11:01:41 +02:00
Kazunori INOUE
e425cd5805 systemd: fix typo in unit file
Signed-off-by: Kazunori INOUE <inouekazu@intellilink.co.jp>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2013-07-01 10:34:22 +02:00
Kazunori INOUE
ca389c3c59 Add Upstart job configuration file
Signed-off-by: Kazunori INOUE <inouekazu@intellilink.co.jp>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-04-10 16:52:10 +02:00
Fabio M. Di Nitto
aa3fae50a6 Update .gitignore files
Untracked files:
   (use "git add <file>..." to include in what will be committed)

       compile
       init/corosync
       init/corosync-notifyd
       test/ploadstart

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-11-22 11:13:30 +01:00
Fabio M. Di Nitto
c8a620fd24 build: make path to bash configurable at build time
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-28 15:14:49 +02:00
Fabio M. Di Nitto
3a64fc4382 build: fix usage of sed and drop build-aux/genman
"sed -i" is a GNU specific extention.

Replace with more portable version and drop completely genman
in favour of a make rule.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-28 15:14:49 +02:00
Fabio M. Di Nitto
d7e205d197 init: major cleanup
- rename generic.in and notifyd.in to corosync.in and corosync-notifyd.in
  (makes build simpler)
- fix sysvinit corosync.in sleep time to include a check for when IPC
  are ready and drop cman bits (there is no cman with corosync 2.0)
- corosync-notifyd.service should always start after corosync.service
- corosync.service should always start after network
- corosync.service uses init script wrapper
- install/ship sysvinit as wrappers for systemd in /usr/share/corosync
  when necessary
- change the build system to deal with all of the above

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-05-21 14:55:49 +02:00
Fabio M. Di Nitto
769a69e41f build: improve systemd service file handling
this solves the issue of having to special case before and after usrmove

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-04-10 08:59:40 +02:00
Jan Friesse
8e58459176 Wait for corosync-notifyd exit in init script
Without wait for real exit of corosync-notifyd it can happen, that new
corosync-notifyd is killed. To prevent such condition, stop now wait for
process to die, before exit of stop function.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2012-02-02 09:30:49 +01:00
Angus Salkeld
6fa114ac8d Add systemd unit files for corosync and corosync-notifyd
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-08-09 08:21:02 +10:00
Angus Salkeld
2a568d6e79 Add dbus and snmp notifier
This is to send dbus events on major cluster events:
 - membership changes
 - application connect/dissconnet from corosync
 - quorum changes

dbus events can then be converted into snmp traps by foghorn or
corosync-notifyd can be run to directly send snmp traps.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Signed-off-by: Lon Hohberger <lhh@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Reviewed-by: Russell Bryant <russell@russellbryant.net>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2011-02-04 09:47:35 -07:00
Jan Friesse
fbbb3f01cb Handle "nocluster" kernel parameter in init script
Init script checks kernel parameters and refuses to start corosync if
nocluster parameter exist on boot time. The init script will
continue to work as expected from console/tty after boot.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-01-31 14:27:36 +01:00