summaryrefslogtreecommitdiff
path: root/sys-cluster/cman/files
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-cluster/cman/files
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.xz
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-cluster/cman/files')
-rw-r--r--sys-cluster/cman/files/cman.confd67
-rw-r--r--sys-cluster/cman/files/cman.initd319
-rw-r--r--sys-cluster/cman/files/cman.initd-3.1.5-r1350
-rw-r--r--sys-cluster/cman/files/qdiskd.initd21
4 files changed, 757 insertions, 0 deletions
diff --git a/sys-cluster/cman/files/cman.confd b/sys-cluster/cman/files/cman.confd
new file mode 100644
index 00000000000..14b7ea79161
--- /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 00000000000..4aa4592e082
--- /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
+# $Id$
+
+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/cman.initd-3.1.5-r1 b/sys-cluster/cman/files/cman.initd-3.1.5-r1
new file mode 100644
index 00000000000..c8be27f575d
--- /dev/null
+++ b/sys-cluster/cman/files/cman.initd-3.1.5-r1
@@ -0,0 +1,350 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+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
+
+ rcS=0 # catch the first error here
+ [ -f /proc/modules ] && for module in ${modules}; do
+ ebegin "Loading ${module} kernel module"
+ modprobe -q ${module}
+ rc=$? # error for this modprobe call
+ eend $rc "Failed to load ${module} kernel module"
+ [ $rc -ne 0 ] && rcS=$rc
+ done
+ return $rcS
+}
+
+unload_modules() {
+ local module modules
+ modules=$1
+
+ [ -f /proc/modules ] && 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 }' /proc/mounts | grep -sq "/sys/kernel/config" \
+ && awk '{ print $3 }' /proc/mounts | grep -sq "configfs"
+
+ 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"
+ rc=$?
+ sleep 1s
+ [ $rc -ne 0 ] && return 1
+ fi
+
+ # configfs
+ awk '{ print $2 }' /proc/mounts | grep -sq "/sys/kernel/config" \
+ && awk '{ print $3 }' /proc/mounts | grep -sq "configfs"
+ rc=$?
+
+ if [ $rc -ne 0 ]
+ then
+ ebegin "Mounting ConfigFS"
+ /bin/mount -t configfs none /sys/kernel/config 2>&1
+ rc=$?
+ eend $rc
+ fi
+
+ return $rc
+}
+
+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 2>&1
+ 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 2>&1
+ eend $? "Failed to unmount GFS filesystems this retry"
+ else
+ ebegin "Unmounting GFS filesystems"
+ umount ${remaining} >/dev/null 2>&1
+ 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 2>&1
+ 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 2>&1
+ if [ $? -ne 0 ]
+ then
+ ebegin "Starting cman"
+ ${CMAN_TOOL} -t ${CMAN_CLUSTER_TIMEOUT} \
+ -w join ${CMAN_JOIN_OPTS} >/dev/null 2>&1
+
+ if [ "$?" -ne 0 ]
+ then
+ eend 1 "Failed to start cman"
+ return 1
+ 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
+ rc=$?
+ eend $rc
+ return $rc
+ 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 2>&1
+ 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 2>&1
+ local errmsg=$?
+
+ ebegin "Joining fence domain"
+ if [ "${errmsg}" -ne 0 ]
+ then
+ ${FENCE_TOOL} join -t $FENCED_START_TIMEOUT >/dev/null 2>&1
+ [ $? -eq 0 ] && errmsg=$? || errmsg=1
+ else
+ ${FENCE_TOOL} join -m $FENCED_MEMBER_DELAY >/dev/null 2>&1
+ [ $? -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() {
+ if ! mount_configfs ; then
+ eerror "ConfigFS & DLM are required to use cman"
+ return 1
+ fi
+
+ [ -e /sys/module/dlm ] || [ -e /sys/kernel/dlm ] || load_modules "dlm"
+ if [ ! -e /sys/kernel/dlm ]; then
+ eerror "ConfigFS & DLM are required to use cman"
+ return 1
+ fi
+ mkdir -p /var/run/cluster
+
+# start_ccsd
+ if ! start_cman ; then
+ eerror "Failed to start cman"
+ return 1
+ fi
+ if ! start_fenced; then
+ eerror "Failed to start fenced"
+ return 1
+ fi
+ if ! start_groupd; then
+ eerror "Failed to start groupd"
+ return 1
+ fi
+ if ! start_dlm_controld; then
+ eerror "Failed to start dlm_controld"
+ return 1
+ fi
+# 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 00000000000..0a01281a566
--- /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
+# $Id$
+
+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"
+}