diff options
author | Alexys Jacob <ultrabug@gentoo.org> | 2011-09-14 10:41:18 +0000 |
---|---|---|
committer | Alexys Jacob <ultrabug@gentoo.org> | 2011-09-14 10:41:18 +0000 |
commit | a29fe33a82f14dd91e2a0af55a18ca942e02dd50 (patch) | |
tree | 058c69e38270b2f2f603868fcc6b19fd4bfc7566 /sys-cluster/cman | |
parent | Restrict tests since they require network access (bug #351015). (diff) | |
download | gentoo-2-a29fe33a82f14dd91e2a0af55a18ca942e02dd50.tar.gz gentoo-2-a29fe33a82f14dd91e2a0af55a18ca942e02dd50.tar.bz2 gentoo-2-a29fe33a82f14dd91e2a0af55a18ca942e02dd50.zip |
Initial import
(Portage version: 2.1.10.14/cvs/Linux x86_64)
Diffstat (limited to 'sys-cluster/cman')
-rw-r--r-- | sys-cluster/cman/ChangeLog | 10 | ||||
-rw-r--r-- | sys-cluster/cman/cman-3.1.5.ebuild | 101 | ||||
-rw-r--r-- | sys-cluster/cman/files/cman.confd | 67 | ||||
-rw-r--r-- | sys-cluster/cman/files/cman.initd | 319 | ||||
-rw-r--r-- | sys-cluster/cman/files/qdiskd.initd | 21 | ||||
-rw-r--r-- | sys-cluster/cman/metadata.xml | 6 |
6 files changed, 524 insertions, 0 deletions
diff --git a/sys-cluster/cman/ChangeLog b/sys-cluster/cman/ChangeLog new file mode 100644 index 000000000000..d4a9a73f7609 --- /dev/null +++ b/sys-cluster/cman/ChangeLog @@ -0,0 +1,10 @@ +# ChangeLog for sys-cluster/cman +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/cman/ChangeLog,v 1.47 2011/09/14 10:41:18 ultrabug Exp $ + +*cman-3.1.5 (14 Sep 2011) + + 14 Sep 2011; Ultrabug <ultrabug@gentoo.org> +cman-3.1.5.ebuild, + +files/cman.confd, +files/cman.initd, +files/qdiskd.initd, +metadata.xml: + Initial import + diff --git a/sys-cluster/cman/cman-3.1.5.ebuild b/sys-cluster/cman/cman-3.1.5.ebuild new file mode 100644 index 000000000000..aa9b6238131d --- /dev/null +++ b/sys-cluster/cman/cman-3.1.5.ebuild @@ -0,0 +1,101 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/cman/cman-3.1.5.ebuild,v 1.1 2011/09/14 10:41:18 ultrabug Exp $ + +EAPI=4 + +inherit linux-info multilib toolchain-funcs versionator + +CLUSTER_RELEASE="${PV}" +MY_P="cluster-${CLUSTER_RELEASE}" + +MAJ_PV="$(get_major_version)" +MIN_PV="$(get_version_component_range 2-3)" + +DESCRIPTION="Cluster Manager" +HOMEPAGE="https://fedorahosted.org/cluster/wiki/HomePage" +SRC_URI="https://fedorahosted.org/releases/c/l/cluster/${MY_P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="dbus ldap" + +RDEPEND="dev-libs/libxml2 + dev-libs/libxslt + dbus? ( sys-apps/dbus ) + ldap? ( net-nds/openldap ) + sys-cluster/corosync + sys-cluster/openais + ~sys-cluster/libccs-${PV} + ~sys-cluster/libfence-${PV} + ~sys-cluster/libcman-${PV} + ~sys-cluster/libdlm-${PV} + ~sys-cluster/liblogthread-${PV} + !sys-cluster/dlm +" +DEPEND="${RDEPEND} + >=sys-kernel/linux-headers-2.6.24" + +S="${WORKDIR}/${MY_P}" + +# TODO: +# * Gentoo'ise the init script + +src_configure() { + # cluster libs have their own separate packages + sed -i -e 's|lib||' "${S}/cman/Makefile" || die + sed -i -e 's|liblogthread||' "${S}/common/Makefile" || die + sed -i -e 's|libs||' "${S}/config/Makefile" || die + sed -i -e 's|libdlm libdlmcontrol||' "${S}/dlm/Makefile" || die + sed -i -e 's|libfence libfenced||' "${S}/fence/Makefile" || die + sed -i -e 's|fence/libfenced||' "${S}/Makefile" || die + + sed -i \ + -e 's|\(^all:.*\)depends |\1|' \ + config/tools/ccs_tool/Makefile \ + fence/fence{d,_node,_tool}/Makefile \ + cman/{cman_tool,daemon,tests,qdisk,notifyd}/Makefile \ + dlm/{tool,tests/usertest}/Makefile \ + || die "sed failed" + + if ! use ldap ; then + sed -i -e 's|ldap||' config/plugins/Makefile || die "sed failed" + fi + local myopts="" + use dbus || myopts="--disable_dbus" + ./configure \ + --cc=$(tc-getCC) \ + --cflags="-Wall" \ + --libdir=/usr/$(get_libdir) \ + --disable_kernel_check \ + --kernel_src=${KERNEL_DIR} \ + --somajor="$MAJ_PV" \ + --sominor="$MIN_PV" \ + --without_rgmanager \ + --without_bindings \ + ${myopts} \ + || die "configure problem" +} + +src_install() { + emake DESTDIR="${D}" install + + # we have to create it in the init.d script anyway + rmdir "${D}"/var/run/{cluster,} + + keepdir /var/{lib,log}/cluster + keepdir /etc/cluster/cman-notify.d + + rm -rf "${D}/usr/share/doc" + dodoc \ + doc/{usage.txt,cman_notify_template.sh} \ + config/plugins/ldap/*.ldif + dohtml doc/*.html + + # lib-specific man pages are provided by the corresponding packages + rm "${D}/usr/share/man/man3/libdlm.3" + + newinitd "${FILESDIR}/${PN}.initd" "${PN}" + newconfd "${FILESDIR}/${PN}.confd" "${PN}" +} diff --git a/sys-cluster/cman/files/cman.confd b/sys-cluster/cman/files/cman.confd new file mode 100644 index 000000000000..14b7ea791614 --- /dev/null +++ b/sys-cluster/cman/files/cman.confd @@ -0,0 +1,67 @@ +CCSD_OPTS= + +# CMAN_CLUSTER_TIMEOUT -- amount of time to wait for joinging a cluster +# before giving up. If CMAN_CLUSTER_TIMEOUT is positive, then we will +# wait CMAN_CLUSTER_TIMEOUT seconds before giving up and failing when +# a cluster is not joined. If CMAN_CLUSTER_TIMEOUT is zero, then +# wait indefinately for a cluster join. If CMAN_CLUSTER_TIMEOUT is +# negative, do not check to see that the cluster has been joined +CMAN_CLUSTER_TIMEOUT=120 + +# CMAN_QUORUM_TIMEOUT -- amount of time to wait for a quorate cluster on +# startup quorum is needed by many other applications, so we may as +# well wait here. If CMAN_QUORUM_TIMEOUT is less than 1, quorum will +# be ignored. +CMAN_QUORUM_TIMEOUT=300 + +# CMAN_SHUTDOWN_TIMEOUT -- amount of time to wait for cman to become a +# cluster member before calling cman_tool leave during shutdown. +# default is 60 seconds +CMAN_SHUTDOWN_TIMEOUT=60 + +# CMAN_JOIN_OPTIONS +#CMAN_JOIN_OPTS="-c ...." + +# CMAN_LEAVE_OPTIONS +#CMAN_LEAVE_OPTS="" + + +# ex: FENCED_OPTS="-w -t 300" +FENCED_OPTS="" + + +# TODO ? +# CMAN_NOTIFYD_START - control the startup behaviour for cmannotifyd +# the variable can take 3 values: +# yes | will always start cmannotifyd +# no | will never start cmannotifyd +# conditional (default) | will start cmannotifyd only if scriptlets +# are found in @NOTIFYDDIR@ +[ -z "$CMAN_NOTIFYD_START" ] && CMAN_NOTIFYD_START=conditional + +# CMAN_SSHD_START - control sshd startup behaviour +# the variable can take 2 values: +# yes | cman will start sshd as early as possible +# no (default) | cman will not start sshd +[ -z "$CMAN_SSHD_START" ] && CMAN_SSHD_START=no + +# FENCE_JOIN_TIMEOUT -- seconds to wait for fence domain join to +# complete. If the join hasn't completed in this time, fence_tool join +# exits with an error, and this script exits with an error. To wait +# indefinitely set the value to -1. +[ -z "$FENCE_JOIN_TIMEOUT" ] && FENCE_JOIN_TIMEOUT=20 + +# FENCED_MEMBER_DELAY -- amount of time to delay fence_tool join to allow +# all nodes in cluster.conf to become cluster members. In seconds. +[ -z "$FENCED_MEMBER_DELAY" ] && FENCED_MEMBER_DELAY=45 + +# FENCE_JOIN -- boolean value used to control whether or not this node +# should join the fence domain. If FENCE_JOIN is set to "no", then +# the script will not attempt to the fence domain. If FENCE_JOIN is +# set to "yes", then the script will attempt to join the fence domain. +# If FENCE_JOIN is set to any other value, the default behavior is +# to join the fence domain (equivalent to "yes"). +[ -z "$FENCE_JOIN" ] && FENCE_JOIN="yes" + +# FENCED_OPTS -- allow extra options to be passed to fence daemon. +[ -z "$FENCED_OPTS" ] && FENCED_OPTS=""
\ No newline at end of file diff --git a/sys-cluster/cman/files/cman.initd b/sys-cluster/cman/files/cman.initd new file mode 100644 index 000000000000..2b39262594c5 --- /dev/null +++ b/sys-cluster/cman/files/cman.initd @@ -0,0 +1,319 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/cman/files/cman.initd,v 1.1 2011/09/14 10:41:18 ultrabug Exp $ + +CMAN_TOOL="/usr/sbin/cman_tool" +FENCE_TOOL="/usr/sbin/fence_tool" +GFS_CONTROLD="/usr/sbin/gfs_controld" +DLM_CONTROLD="/usr/sbin/dlm_controld" +GROUPD="/usr/sbin/groupd" +FENCED="/usr/sbin/fenced" +CCSD="/usr/sbin/ccsd" + +[ -z "$CCSD_OPTS" ] && CCSD_OPTS="" +[ -z "$CMAN_CLUSTER_TIMEOUT" ] && CMAN_CLUSTER_TIMEOUT=120 +[ -z "$CMAN_QUORUM_TIMEOUT" ] && CMAN_QUORUM_TIMEOUT=0 +[ -z "$CMAN_SHUTDOWN_TIMEOUT" ] && CMAN_SHUTDOWN_TIMEOUT=60 +[ -z "$FENCED_START_TIMEOUT" ] && FENCED_START_TIMEOUT=300 +[ -z "$FENCED_MEMBER_DELAY" ] && FENCED_MEMBER_DELAY=300 + +depend() { + use net + after xend + after xendomains + provide cman +} + +load_modules() { + local module modules + modules=$1 + + for module in ${modules}; do + ebegin "Loading ${module} kernel module" + modprobe ${module} > /dev/null + eend $? "Failed to load ${module} kernel module" + done +} + +unload_modules() { + local module modules + modules=$1 + + for module in ${modules}; do + ebegin "Unloading ${module} kernel module" + modprobe -r ${module} > /dev/null + eend $? "Failed to unload ${module} kernel module" + done +} + +check_configfs() { + awk '{ print $2 }' /etc/mtab | grep "/sys/kernel/config" &> /dev/null\ + && awk '{ print $3 }' /etc/mtab | grep "configfs" &> /dev/null + + if [ $? -ne 0 ]; then + ewarn "Please add the following line to /etc/fstab:" + ewarn "none configfs /sys/kernel/config defaults 0 0" + eend 1 "configfs not mounted at /sys/kernel/config" + fi +} + +mount_configfs() +{ + local module=$(awk '$2 == "configfs" { print $2 }' /proc/filesystems) + + if [ -z "${module}" ]; then + load_modules "configfs" + sleep 1s + fi + + # configfs + awk '{ print $2 }' /etc/mtab | grep "/sys/kernel/config" &> /dev/null \ + && awk '{ print $3 }' /etc/mtab | grep "configfs" &> /dev/null + + if [ $? -ne 0 ] + then + ebegin "Mounting ConfigFS" + /bin/mount -t configfs none /sys/kernel/config 2>&1 + eend $? + fi + return 0 +} + +umount_configfs() { + local sig retry + local entry entries + + entries="$(awk '$3 == "configfs" { print $2 }' /proc/mounts | sort -r)" + + for entry in $entries; do + ebegin "Unmounting ConfigFS" + umount $entry &>/dev/null + eend $? + done + + local module=$(awk '$1 == "configfs" { print $1 }' /proc/modules) + + if [ ! -z "${module}" ]; then + unload_modules "configfs" + sleep 1s + fi +} + +umount_gfs_filesystems() { + local sig retry + local remaining="$(awk '$3 == "gfs" || $3 == "gfs2" { print $2 }' /proc/mounts | sort -r)" + + if [ -n "${remaining}" ] + then + sig= + retry=3 + while [ -n "${remaining}" -a "${retry}" -gt 0 ] + do + if [ "${retry}" -lt 3 ] + then + ebegin "Unmounting GFS filesystems (retry)" + umount ${remaining} &>/dev/null + eend $? "Failed to unmount GFS filesystems this retry" + else + ebegin "Unmounting GFS filesystems" + umount ${remaining} &>/dev/null + eend $? "Failed to unmount GFS filesystems" + fi + remaining="$(awk '$3 == "gfs" || $3 == "gfs2" { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" + [ -z "${remaining}" ] && break + /bin/fuser -k -m ${sig} ${remaining} &>/dev/null + sleep 5 + retry=$((${retry} -1)) + sig=-9 + done + fi +} + +unload_allmodules() { + local modules + + modules=$(awk '$1 == "lock_gulm" || \ + $1 == "lock_dlm" || $1 == "dlm" || \ + $1 == "lock_harness" || $1 == "gfs2" || \ + $1 == "gfs" { print $1 }' /proc/modules) + + #modules=$(awk '$1 == "lock_harness" || \ + # $1 == "gfs" { print $1 }' /proc/modules) + + unload_modules "${modules}" +} + +start_ccsd() { + ebegin "Starting ccsd" + start-stop-daemon --start --quiet --exec ${CCSD} -- ${CCSD_OPTS} + eend $? +} + +stop_ccsd() { + ebegin "Stopping ccsd" + start-stop-daemon --stop --quiet -s 9 --exec ${CCSD} + eend $? +} + +start_cman() { + ${CMAN_TOOL} status &> /dev/null + if [ $? -ne 0 ] + then + ebegin "Starting cman" + ${CMAN_TOOL} -t ${CMAN_CLUSTER_TIMEOUT} \ + -w join ${CMAN_JOIN_OPTS} &> /dev/null + + if [ "$?" -ne 0 ] + then + eend 1 "Failed to start cman" + else + eend 0 + + # make sure that we are quorate? + if [ ${CMAN_QUORUM_TIMEOUT} -gt 0 ] + then + ebegin "Waiting for quorum (${CMAN_QUORUM_TIMEOUT} secs)" + ${CMAN_TOOL} -t ${CMAN_QUORUM_TIMEOUT} -q wait + eend $? + fi + fi + else + einfo "cman already running" + fi +} + +stop_cman() { + ebegin "Stopping cman" + local stat=0 + ${CMAN_TOOL} status > /dev/null 2>&1 + if [ $? -eq 0 ]; then + retry=3 + stat=1 + while [ "${stat}" -eq 1 -a "${retry}" -gt 0 ] + do + #sleep 2 + #${CMAN_TOOL} -w -t ${CMAN_SHUTDOWN_TIMEOUT} \ + # leave remove ${CMAN_LEAVE_OPTS} > /dev/null + ${CMAN_TOOL} leave -t ${CMAN_SHUTDOWN_TIMEOUT} ${CMAN_LEAVE_OPTS} \ + remove &> /dev/null + stat=$? + retry=$((${retry} -1)) + done + fi + eend ${stat} +} + +start_groupd() { + ebegin "Starting groupd" + start-stop-daemon --start --exec ${GROUPD} --name groupd + eend $? +} + +stop_groupd() { + ebegin "Stopping groupd" + start-stop-daemon --stop --exec ${GROUPD} --name groupd + eend $? +} + +start_fenced() { + ebegin "Starting fenced" + start-stop-daemon --start --exec ${FENCED} --name fenced + eend $? + + ${CMAN_TOOL} status | grep Flags | grep 2node &> /dev/null + local errmsg=$? + + ebegin "Joining fence domain" + if [ "${errmsg}" -ne 0 ] + then + ${FENCE_TOOL} join -t $FENCED_START_TIMEOUT &> /dev/null + [ $? -eq 0 ] && errmsg=$? || errmsg=1 + else + ${FENCE_TOOL} join -m $FENCED_MEMBER_DELAY &> /dev/null + [ $? -eq 0 ] && errmsg=$? || errmsg=1 + fi + eend $errmsg +} + +stop_fenced() { + # fenced services +# local fence_status="$( ${CMAN_TOOL} services | awk '$1 ~ /fence/ { print $3 }')" +# if [ -n "${fence_status}" ]; then +# if [ -x ${FENCE_TOOL} ]; then +# ebegin "Leaving fence domain" +# ${FENCE_TOOL} leave > /dev/null 2>&1 +# eend $? +# fi +# fi + + if [ -x ${FENCE_TOOL} ]; then + if ${FENCE_TOOL} ls >/dev/null 2>&1; then + ebegin "Leaving fence domain" + ${FENCE_TOOL} leave > /dev/null 2>&1 + eend $? + fi + fi + + ebegin "Stopping fenced" + start-stop-daemon --stop --exec ${FENCED} --name fenced + eend $? +} + +start_gfs_controld() { + ebegin "Starting gfs_controld" + start-stop-daemon --start --exec ${GFS_CONTROLD} --name gfs_controld + eend $? +} + +stop_gfs_controld() { + ebegin "Stopping gfs_controld" + start-stop-daemon --stop --exec ${GFS_CONTROLD} --name gfs_controld + eend $? +} + +start_dlm_controld() { + ebegin "Starting dlm_controld" + start-stop-daemon --start --exec ${DLM_CONTROLD} --name dlm_controld + eend $? +} + +stop_dlm_controld() { + ebegin "Stopping dlm_controld" + start-stop-daemon --stop --exec ${DLM_CONTROLD} --name dlm_controld + eend $? +} + +start() { + load_modules "dlm" + + mkdir -p /var/run/cluster + + mount_configfs +# start_ccsd + start_cman + start_fenced + start_groupd + start_dlm_controld +# start_gfs_controld +} + +stop() { + +# umount GFS filesystems +# umount_gfs_filesystems + + stop_dlm_controld + stop_groupd + stop_fenced + stop_cman + + #stop_gfs_controld + #stop_dlm_controld + #stop_groupd + + unload_modules "dlm" +# stop_ccsd +# unload_allmodules + umount_configfs +} diff --git a/sys-cluster/cman/files/qdiskd.initd b/sys-cluster/cman/files/qdiskd.initd new file mode 100644 index 000000000000..e86ed730b365 --- /dev/null +++ b/sys-cluster/cman/files/qdiskd.initd @@ -0,0 +1,21 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/cman/files/qdiskd.initd,v 1.1 2011/09/14 10:41:18 ultrabug Exp $ + +depend() { + use net + need cman +} + +start() { + ebegin "Starting the Quorum Disk Daemon" + start-stop-daemon --start --quiet --exec /usr/sbin/qdiskd -- -Q + eend $? "Failed to start qdiskd" +} + +stop() { + ebegin "Stopping the Quorum Disk Daemon" + start-stop-daemon --stop --pidfile /var/run/qdiskd.pid + eend $? "Failed to stop qdiskd" +} diff --git a/sys-cluster/cman/metadata.xml b/sys-cluster/cman/metadata.xml new file mode 100644 index 000000000000..13ca99f343a2 --- /dev/null +++ b/sys-cluster/cman/metadata.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>cluster</herd> + <longdescription>Cluster Manager</longdescription> +</pkgmetadata> |