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 120 (instead of previous 20, 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 <[email protected]>
---
 corosync.spec.in                |    4 ++++
 init/Makefile.am                |    4 +++-
 init/corosync.in                |    7 +++++--
 init/corosync.sysconfig.example |   10 ++++++++++
 4 files changed, 22 insertions(+), 3 deletions(-)
 create mode 100644 init/corosync.sysconfig.example

diff --git a/corosync.spec.in b/corosync.spec.in
index 7b2413c..3ca75b7 100644
--- a/corosync.spec.in
+++ b/corosync.spec.in
@@ -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
diff --git a/init/Makefile.am b/init/Makefile.am
index 18cf2bb..5af1bf6 100644
--- a/init/Makefile.am
+++ b/init/Makefile.am
@@ -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)
diff --git a/init/corosync.in b/init/corosync.in
index cfd51f2..4bc6041 100755
--- a/init/corosync.in
+++ b/init/corosync.in
@@ -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
index 0000000..b0050e3
--- /dev/null
+++ b/init/corosync.sysconfig.example
@@ -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=""
-- 
1.7.1

_______________________________________________
discuss mailing list
[email protected]
http://lists.corosync.org/mailman/listinfo/discuss

Reply via email to