Quellcode durchsuchen

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>
Jan Friesse vor 12 Jahren
Ursprung
Commit
1f7e78ab9c
4 geänderte Dateien mit 22 neuen und 3 gelöschten Zeilen
  1. 4 0
      corosync.spec.in
  2. 3 1
      init/Makefile.am
  3. 5 2
      init/corosync.in
  4. 10 0
      init/corosync.sysconfig.example

+ 4 - 0
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

+ 3 - 1
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)

+ 5 - 2
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

+ 10 - 0
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=""