[packages/corosync/corosync-1_4] - systemd unit files added - corosync-notifyd init script updated - typos and 'sysconfig' file forma

draenog draenog at pld-linux.org
Thu Jul 5 02:41:07 CEST 2012


commit ef24531f55ea5dbe70c1f5d4d0b26eb5b9a73fd5
Author: Jacek Konieczny <jajcus at pld-linux.org>
Date:   Wed Jul 4 19:36:25 2012 +0000

    - systemd unit files added
    - corosync-notifyd init script updated - typos and 'sysconfig' file format
      compatible with systemd service
    - Release: 2.2
    
    Changed files:
        corosync-notifyd.init -> 1.1.2.1
        corosync-notifyd.service -> 1.1.2.1
        corosync-notifyd.sysconfig -> 1.1.2.1
        corosync.service -> 1.1.2.1
        corosync.spec -> 1.18.2.4
        corosync.target -> 1.1.2.1

 corosync-notifyd.init      | 29 +++++++----------------------
 corosync-notifyd.service   | 16 ++++++++++++++++
 corosync-notifyd.sysconfig | 19 ++++++++-----------
 corosync.service           | 25 +++++++++++++++++++++++++
 corosync.spec              | 19 +++++++++++++++----
 corosync.target            |  5 +++++
 6 files changed, 76 insertions(+), 37 deletions(-)
---
diff --git a/corosync-notifyd.init b/corosync-notifyd.init
index ff08b48..43c1eb9 100644
--- a/corosync-notifyd.init
+++ b/corosync-notifyd.init
@@ -2,14 +2,14 @@
 #
 # corosync-notifyd	Corosync Dbus and snmp notifier
 #
-# chkconfig: 2345 23 77
+# chkconfig: 2345 22 78
 # description: Corosync Dbus and snmp notifier
-# processname: corosync-notifyd-notifyd
+# processname: corosync-notifyd
 #
 ### BEGIN INIT INFO
-# Provides:		corosync-notifyd-notifyd
-# Required-Start:	$corosync-notifyd $cman
-# Required-Stop:	$corosync-notifyd $cman
+# Provides:		corosync-notifyd
+# Required-Start:	$corosync $cman
+# Required-Stop:	$corosync $cman
 # Default-Start:
 # Default-Stop:
 # Short-Description:	Starts and stops Corosync Notifier.
@@ -19,9 +19,7 @@
 # Source function library
 . /etc/rc.d/init.d/functions
 
-SEND_SNMP_TRAPS=no
-SEND_DBUS_SIGNALS=yes
-LOG_ALL_EVENTS=no
+COROSYNC_NOTIFYD_OPTS="-d"
 
 [ -f /etc/sysconfig/corosync-notifyd ] && . /etc/sysconfig/corosync-notifyd
 
@@ -41,21 +39,8 @@ start() {
 		return
 	fi
 
-	local options=""
-	if is_yes "$SEND_SNMP_TRAPS" ; then
-		options="$options -s"
-	fi
-	if [ -n "$SNMP_MANAGER" ] ; then
-		options="$options -m $SNMP_MANAGER"
-	fi
-	if is_yes "$SEND_DBUS_SIGNALS" ; then
-		options="$options -d"
-	fi
-	if is_yes "$LOG_ALL_EVENTS" ; then
-		options="$options -l"
-	fi
 	msg_starting "Corosync Notifier"
-	daemon /usr/sbin/corosync-notifyd "$options"
+	daemon /usr/sbin/corosync-notifyd $COROSYNC_NOTIFYD_OPTS
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/corosync-notifyd
 }
diff --git a/corosync-notifyd.service b/corosync-notifyd.service
new file mode 100644
index 0000000..8869aee
--- /dev/null
+++ b/corosync-notifyd.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Corosync Dbus and SNMP notifier
+After=openais.service
+After=corosync.service
+
+[Install]
+WantedBy=corosync.target
+
+[Service]
+Type=simple
+KillMode=process
+SysVStartPriority=22
+Environment=COROSYNC_NOTIFYD_OPTS=-d
+EnvironmentFile=-/etc/sysconfig/corosync-notifyd
+ExecStart=/usr/sbin/corosync-notifyd -f $COROSYNC_NOTIFYD_OPTS
+Restart=on-failure
diff --git a/corosync-notifyd.sysconfig b/corosync-notifyd.sysconfig
index c40c6df..a4d4223 100644
--- a/corosync-notifyd.sysconfig
+++ b/corosync-notifyd.sysconfig
@@ -1,12 +1,9 @@
 
-# Send SNMP traps on all events.
-SEND_SNMP_TRAPS=no
-
-# SNMP Manager IP address (defaults to localhost).
-#SNMP_MANAGER=
-
-# Send DBUS signals on all events.
-SEND_DBUS_SIGNALS=yes
-
-# Log all events.
-LOG_ALL_EVENTS=no
+# corosync-notifyd options
+# 
+# -l     : Log all events.
+# -s     : Send SNMP traps on all events.
+# -m     : SNMP Manager IP address (defaults to localhost).
+# -d     : Send DBUS signals on all events.
+#
+COROSYNC_NOTIFYD_OPTS="-d"
diff --git a/corosync.service b/corosync.service
new file mode 100644
index 0000000..0b20105
--- /dev/null
+++ b/corosync.service
@@ -0,0 +1,25 @@
+[Unit]
+Description=Corosync Cluster Engine
+ConditionKernelCommandLine=!nocluster
+Requires=network.target
+After=network.target
+Names=corosync-stack.service
+Conflicts=openais.service
+
+[Install]
+WantedBy=corosync.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/corosync.pid
+KillMode=process
+SysVStartPriority=21
+EnvironmentFile=-/etc/sysconfig/corosync
+ExecStart=/usr/sbin/corosync
+
+# Pacemaker can only exit after all managed services have shut down
+# A HA database could conceivably take even longer than this 
+TimeoutSec=30min
+
+# Restart options include: no, on-success, on-failure, on-abort or always
+Restart=on-failure
diff --git a/corosync.spec b/corosync.spec
index 0940660..4149f2a 100644
--- a/corosync.spec
+++ b/corosync.spec
@@ -9,7 +9,7 @@ Summary:	Corosync - OSI Certified implementation of a complete cluster engine
 Summary(pl.UTF-8):	Corosync - implementacja silnika klastrowego certyfikowana przez OSI
 Name:		corosync
 Version:	1.4.3
-Release:	2.1
+Release:	2.2
 License:	BSD
 Group:		Base
 Source0:	ftp://ftp:downloads@corosync.org/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz
@@ -17,6 +17,9 @@ Source0:	ftp://ftp:downloads@corosync.org/downloads/%{name}-%{version}/%{name}-%
 Source1:	%{name}.init
 Source2:	%{name}-notifyd.init
 Source3:	%{name}-notifyd.sysconfig
+Source4:	%{name}.service
+Source5:	%{name}-notifyd.service
+Source6:	%{name}.target
 Patch0:		%{name}-makefile.patch
 URL:		http://www.corosync.org/
 BuildRequires:	autoconf >= 2.61
@@ -120,7 +123,7 @@ Dane SNMP MIB dla Corosync.
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,/etc/sysconfig}
+install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,/etc/sysconfig,%{systemdunitdir}}
 
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
@@ -131,11 +134,14 @@ sed -e 's/^/#/' $RPM_BUILD_ROOT%{_sysconfdir}/corosync/corosync.conf.example \
 	>$RPM_BUILD_ROOT%{_sysconfdir}/corosync/corosync.conf
 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/corosync/corosync.conf.example*
 
+%{?with_apidocs:install doc/api/man/man3/* $RPM_BUILD_ROOT%{_mandir}/man3}
+
 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-notifyd
 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-notifyd
-
-%{?with_apidocs:install doc/api/man/man3/* $RPM_BUILD_ROOT%{_mandir}/man3}
+install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
+install %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}-notifyd.service
+install %{SOURCE6} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.target
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -147,6 +153,7 @@ rm -rf $RPM_BUILD_ROOT
 %service %{name}-notifyd restart
 %systemd_post %{name}.service
 %systemd_post %{name}-notifyd.service
+%systemd_post %{name}.target
 
 %preun
 if [ "$1" = "0" ]; then
@@ -157,6 +164,7 @@ if [ "$1" = "0" ]; then
 fi
 %systemd_preun %{name}.service
 %systemd_preun %{name}-notifyd.service
+%systemd_preun %{name}.target
 
 %postun
 %systemd_reload
@@ -169,6 +177,9 @@ fi
 %doc AUTHORS ChangeLog LICENSE README.devmap README.recovery SECURITY TODO conf/corosync.conf.example*
 %attr(754,root,root) /etc/rc.d/init.d/corosync
 %attr(754,root,root) /etc/rc.d/init.d/corosync-notifyd
+%{systemdunitdir}/%{name}.service
+%{systemdunitdir}/%{name}-notifyd.service
+%{systemdunitdir}/%{name}.target
 %verify(not md5 mtime size) %config(noreplace) /etc/sysconfig/%{name}-notifyd
 %dir %{_sysconfdir}/corosync
 %verify(not md5 mtime size) %config(noreplace) %{_sysconfdir}/corosync/corosync.conf
diff --git a/corosync.target b/corosync.target
new file mode 100644
index 0000000..8728736
--- /dev/null
+++ b/corosync.target
@@ -0,0 +1,5 @@
+[Unit]
+Description=Corosync Stack (bare or OpenAIS)
+
+[Install]
+WantedBy=multi-user.target


More information about the test mailing list