]> git.proxmox.com Git - mirror_corosync.git/commitdiff
init: Make init script configurable
authorJan Friesse <jfriesse@redhat.com>
Wed, 26 Mar 2014 15:16:38 +0000 (16:16 +0100)
committerJan Friesse <jfriesse@redhat.com>
Fri, 11 Apr 2014 09:02:18 +0000 (11:02 +0200)
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>
corosync.spec.in
init/Makefile.am
init/corosync.in
init/corosync.sysconfig.example [new file with mode: 0644]

index 7b2413c324e8d8f13f3c5d137df44f920e6f1335..3ca75b757f7f0bfa2659fa38baab258f73762cb4 100644 (file)
@@ -135,6 +135,9 @@ rm -rf %{buildroot}%{_docdir}/*
 mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
 install -m 644 tools/corosync-notifyd.sysconfig.example \
    %{buildroot}%{_sysconfdir}/sysconfig/corosync-notifyd
+# /etc/sysconfig/corosync
+install -m 644 init/corosync.sysconfig.example \
+   %{buildroot}%{_sysconfdir}/sysconfig/corosync
 
 %clean
 rm -rf %{buildroot}
@@ -191,6 +194,7 @@ fi
 %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example
 %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu
 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-notifyd
+%config(noreplace) %{_sysconfdir}/sysconfig/corosync
 %if %{with dbus}
 %{_sysconfdir}/dbus-1/system.d/corosync-signals.conf
 %endif
index 18cf2bb5ae220a11a2792e3b86e059cbc76e77f5..5af1bf6f94b5cb6471239a6e1038487d02368b01 100644 (file)
@@ -34,7 +34,9 @@
 
 MAINTAINERCLEANFILES   = Makefile.in
 
-EXTRA_DIST             = corosync.in corosync-notifyd.in corosync.service.in corosync-notifyd.service.in corosync.conf.in corosync-notifyd.conf.in
+EXTRA_DIST             = corosync.in corosync-notifyd.in corosync.service.in \
+                          corosync-notifyd.service.in corosync.conf.in corosync-notifyd.conf.in \
+                          corosync.sysconfig.example
 
 if INSTALL_SYSTEMD
 systemdconfdir    = $(SYSTEMDDIR)
index cfd51f2bbf3febafd61b825bcf635a253df26d1b..4bc604104677b506811396ea80fad924b9d46291 100755 (executable)
@@ -84,7 +84,10 @@ cluster_disabled_at_boot()
 wait_for_ipc()
 {
        try=0
-       while [ "$try" -le "20" ]; do
+       max_try=$((COROSYNC_INIT_TIMEOUT*2-1))
+       [ "$max_try" -le "0" ] && max_try=120
+
+       while [ "$try" -le "$max_try" ]; do
                if corosync-cfgtool -s > /dev/null 2>&1; then
                        return 0
                fi
@@ -110,7 +113,7 @@ start()
        if status $prog > /dev/null 2>&1; then
                success
        else
-               $prog > /dev/null 2>&1
+               $prog $COROSYNC_OPTIONS > /dev/null 2>&1
 
                if ! wait_for_ipc; then
                        failure
diff --git a/init/corosync.sysconfig.example b/init/corosync.sysconfig.example
new file mode 100644 (file)
index 0000000..b0050e3
--- /dev/null
@@ -0,0 +1,10 @@
+# Corosync init script configuration file
+
+# COROSYNC_INIT_TIMEOUT specifies number of seconds to wait for corosync
+# initialization (default is one minute).
+COROSYNC_INIT_TIMEOUT=60
+
+# COROSYNC_OPTIONS specifies options passed to corosync command
+# (default is no options).
+# See "man corosync" for detailed descriptions of the options.
+COROSYNC_OPTIONS=""