[oe-commits] Roman I Khimov : corosync: add new recipe

git version control git at git.openembedded.org
Mon Mar 29 19:08:23 UTC 2010


Module: openembedded.git
Branch: shr/unstable
Commit: 5595df3516313bc8b3ffde448ce0c6abb086a1fc
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=5595df3516313bc8b3ffde448ce0c6abb086a1fc

Author: Roman I Khimov <khimov at altell.ru>
Date:   Mon Mar 22 22:37:58 2010 +0300

corosync: add new recipe

The Corosync Cluster Engine is an OSI Certified implementation
of a complete cluster engine.

Signed-off-by: Roman I Khimov <khimov at altell.ru>

---

 recipes/corosync/corosync_1.2.0.bb             |   35 ++++++
 recipes/corosync/files/corosync.conf           |   52 ++++++++
 recipes/corosync/files/fix-lcrso-linkage.patch |   43 +++++++
 recipes/corosync/files/init                    |  152 ++++++++++++++++++++++++
 recipes/corosync/files/volatiles               |    2 +
 5 files changed, 284 insertions(+), 0 deletions(-)

diff --git a/recipes/corosync/corosync_1.2.0.bb b/recipes/corosync/corosync_1.2.0.bb
new file mode 100644
index 0000000..758f455
--- /dev/null
+++ b/recipes/corosync/corosync_1.2.0.bb
@@ -0,0 +1,35 @@
+DESCRIPTION = "OSI Certified implementation of a complete cluster engine"
+LICENSE = "BSD"
+
+SRC_URI = " \
+	ftp://ftp@corosync.org/downloads/corosync-${PV}/corosync-${PV}.tar.gz;name=tar \
+	file://fix-lcrso-linkage.patch;patch=1 \
+	file://init \
+	file://corosync.conf \
+	file://volatiles \
+	"
+SRC_URI[tar.md5sum] = "789bea831a97977e56900477c3022cc1"
+SRC_URI[tar.sha256sum] = "3cee3be9f747c7031da9eafdffa5e3009513f4ac93ce021a49574e3de1fd93f0"
+
+inherit autotools_stage update-rc.d
+
+INITSCRIPT_NAME = "corosync-daemon"
+
+EXTRA_OECONF = "--disable-nss"
+
+FILES_${PN}-dbg += "${libexecdir}/lcrso/.debug"
+
+do_install_append() {
+	install -d ${D}/${sysconfdir}/init.d
+	install -d ${D}${sysconfdir}/default/volatiles
+	install -m 0755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/corosync-daemon
+	install -m 0644 ${WORKDIR}/corosync.conf ${D}/${sysconfdir}/corosync/corosync.conf.example
+	install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/05_corosync
+}
+
+pkg_postinst_${PN} () {
+	set -e
+	grep haclient /etc/group || addgroup haclient
+	grep hacluster /etc/passwd || adduser --disabled-password --home=/var/lib/heartbeat --ingroup haclient -g "HA cluster" hacluster
+	/etc/init.d/populate-volatile.sh update
+}
diff --git a/recipes/corosync/files/corosync.conf b/recipes/corosync/files/corosync.conf
new file mode 100644
index 0000000..4caea96
--- /dev/null
+++ b/recipes/corosync/files/corosync.conf
@@ -0,0 +1,52 @@
+# Starting point for cluster with pacemaker/openais
+compatibility: none
+
+corosync {
+	 user:  root
+	 group: root
+}
+
+aisexec {
+	with Pacemaker
+	user:  root
+	group: root
+}
+
+service {
+	name: pacemaker
+	ver: 0
+}
+
+totem {
+	version: 2
+	secauth: off
+	threads: 0
+	interface {
+		ringnumber: 0
+		# Cluster network address
+		bindnetaddr: 192.168.10.0
+		# Should be fine in most cases, don't forget to allow
+		# packets for this address/port in netfilter if there
+		# is restrictive policy set for cluster network
+		mcastaddr: 226.94.1.1
+		mcastport: 5405
+	}
+}
+
+logging {
+	fileline: off
+	to_stderr: yes
+	to_logfile: yes
+	to_syslog: yes
+	logfile: /var/log/corosync.log
+	debug: off
+	timestamp: on
+	logger_subsys {
+		subsys: AMF
+		debug: off
+	}
+}
+
+amf {
+	mode: disabled
+}
diff --git a/recipes/corosync/files/fix-lcrso-linkage.patch b/recipes/corosync/files/fix-lcrso-linkage.patch
new file mode 100644
index 0000000..18334a9
--- /dev/null
+++ b/recipes/corosync/files/fix-lcrso-linkage.patch
@@ -0,0 +1,43 @@
+Index: corosync-1.2.0/exec/Makefile.am
+===================================================================
+--- corosync-1.2.0.orig/exec/Makefile.am	2010-03-22 22:25:00.000000000 +0300
++++ corosync-1.2.0/exec/Makefile.am	2010-03-22 22:25:40.000000000 +0300
+@@ -122,7 +122,7 @@
+ else
+ 
+ %.lcrso: %.o
+-	$(CC) $(CFLAGS) -shared -Wl,-soname=$@ $^ -o $@
++	$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname=$@ $^ -o $@
+ 
+ libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
+ 	$(CC) -shared -o $@ \
+Index: corosync-1.2.0/lcr/Makefile.am
+===================================================================
+--- corosync-1.2.0.orig/lcr/Makefile.am	2010-03-22 22:25:10.000000000 +0300
++++ corosync-1.2.0/lcr/Makefile.am	2010-03-22 22:26:02.000000000 +0300
+@@ -62,7 +62,7 @@
+ else
+ 
+ %.lcrso: %.o
+-	$(CC) $(CFLAGS) -shared -Wl,-soname,$@ $^ -o $@
++	$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,$@ $^ -o $@
+ 
+ endif
+ 
+Index: corosync-1.2.0/services/Makefile.am
+===================================================================
+--- corosync-1.2.0.orig/services/Makefile.am	2010-03-22 22:25:15.000000000 +0300
++++ corosync-1.2.0/services/Makefile.am	2010-03-22 22:26:32.000000000 +0300
+@@ -68,10 +68,10 @@
+ 
+ else
+ quorum_%.lcrso: %.o
+-	$(CC) $(CFLAGS) -shared -Wl,-soname=$@ $^ -o $@
++	$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname=$@ $^ -o $@
+ 
+ service_%.lcrso: %.o
+-	$(CC) $(CFLAGS) -shared -Wl,-soname=$@ $^ -o $@
++	$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname=$@ $^ -o $@
+ endif
+ 
+ endif
diff --git a/recipes/corosync/files/init b/recipes/corosync/files/init
new file mode 100644
index 0000000..fc45f43
--- /dev/null
+++ b/recipes/corosync/files/init
@@ -0,0 +1,152 @@
+#!/bin/sh
+#
+# corosync       Start the Corosync Cluster Engine
+#
+# Author:       Andrew Beekhof <abeekhof at suse.de>
+# License:      Revised BSD
+#
+# chkconfig: - 20 20
+# processname:  corosync
+# description:  Corosync Cluster Engine
+#
+### BEGIN INIT INFO
+# Description: corosync....
+#
+# Short-Description: Corosync Cluster Engine.
+# Provides: corosync
+# Required-Start: $network
+# Should-Start: $syslog
+# Required-Stop: $network
+# Default-Start: 3 5
+# Default-Stop: 0 6
+### END INIT INFO
+
+do_force=0
+prog="corosync"
+lockfile="/var/lock/subsys/$prog"
+configfile="/etc/corosync/corosync.conf"
+
+if [ ! -f "$configfile" ]; then
+	echo "Error: corosync is not configured ($configfile missing)"
+	exit 1
+fi
+
+internal_status() {
+    killall -0 corosync > /dev/null 2>&1
+    return $?
+}
+
+status() {
+    if
+	! internal_status
+    then
+	echo "Stopped"
+	return 7
+    fi
+
+    echo "Running"
+    return 0
+}
+
+start() {
+    echo -n $"Starting Corosync Cluster Engine ($prog): "
+    if
+	! internal_status
+    then
+	echo -n "starting... "
+	$prog 2>&1 > /dev/null 2>&1
+	echo -n "rc=$?: "
+    fi
+
+    sleep 2 # give it time to fail... $? isn't definitive
+
+    if
+	internal_status
+    then
+	echo "OK"
+	return 0
+    fi
+
+    echo "Failed"
+    return 1
+}
+
+do_force=1
+do_forever=0
+
+stop() {
+    echo -n $"Stopping Corosync Cluster Engine ($prog): "
+
+    killall -QUIT corosync
+
+    if [ $do_forever = 0 ]; then
+	for i in 1 2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20; do
+	    if
+		internal_status
+	    then
+		sleep 2
+		echo -n "."
+	    else
+		rm -f "$lockfile"
+		echo "OK"
+		return 0
+	    fi
+	done
+
+	if [ $do_force = 1 ]; then
+	    echo -n "Escalating... "
+	    killall -KILL corosync
+	    ps | grep /usr/lib/heartbeat | sed "s,^ *,," | cut -f 1 -d ' ' | xargs kill -9
+	    sleep 5
+
+	    if
+		! internal_status
+	    then
+		rm -f "$lockfile"
+		echo "OK"
+		return 0
+	    fi
+	fi
+
+	echo "Failed"
+	return 1
+    fi
+
+    while
+        internal_status
+    do
+	sleep 1
+	echo -n "."
+    done
+
+    rm -f "$lockfile"
+    echo "OK"
+    return 0
+}
+
+restart() {
+    stop
+    start
+}
+
+case "$1" in
+    start|stop|restart)
+        $1
+        ;;
+    force-stop)
+	do_force=1
+        stop
+        ;;
+    reload|force-reload)
+        restart
+        ;;
+    condrestart|try-restart)
+        [ ! -f "$lockfile" ] || restart
+        ;;
+    status)
+        status $prog
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|restart|try-restart|condrestart|reload|force-reload|force-stop|status}"
+        exit 2
+esac
diff --git a/recipes/corosync/files/volatiles b/recipes/corosync/files/volatiles
new file mode 100644
index 0000000..d778fe1
--- /dev/null
+++ b/recipes/corosync/files/volatiles
@@ -0,0 +1,2 @@
+d hacluster haclient 0755 /var/lib/corosync none
+





More information about the Openembedded-commits mailing list