summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Zoffoli <xmerlin@gentoo.org>2005-03-25 02:14:00 +0000
committerChristian Zoffoli <xmerlin@gentoo.org>2005-03-25 02:14:00 +0000
commitb52de235aa27c83d3027a977edb2d61ebb78a443 (patch)
treecb9e913d08593c0800b3fdcef14d3e36f68837db /sys-cluster
parentVersion bump. (diff)
downloadgentoo-2-b52de235aa27c83d3027a977edb2d61ebb78a443.tar.gz
gentoo-2-b52de235aa27c83d3027a977edb2d61ebb78a443.tar.bz2
gentoo-2-b52de235aa27c83d3027a977edb2d61ebb78a443.zip
improved init script
(Portage version: 2.0.51.19)
Diffstat (limited to 'sys-cluster')
-rw-r--r--sys-cluster/ccs/ChangeLog5
-rwxr-xr-xsys-cluster/ccs/files/ccsd.rc2
-rw-r--r--sys-cluster/cman/ChangeLog5
-rwxr-xr-xsys-cluster/cman/files/cman.rc134
-rw-r--r--sys-cluster/dlm/ChangeLog5
-rwxr-xr-xsys-cluster/dlm/files/dlm.rc44
6 files changed, 163 insertions, 32 deletions
diff --git a/sys-cluster/ccs/ChangeLog b/sys-cluster/ccs/ChangeLog
index 622cc0d3f79d..609f1afadf04 100644
--- a/sys-cluster/ccs/ChangeLog
+++ b/sys-cluster/ccs/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for sys-cluster/ccs
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/ccs/ChangeLog,v 1.10 2005/03/23 02:07:13 xmerlin Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/ccs/ChangeLog,v 1.11 2005/03/25 02:12:26 xmerlin Exp $
+
+ 25 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/ccsd.rc:
+ improved init script
23 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/ccsd.rc:
added better process handling in init (now ccsd stops without problems)
diff --git a/sys-cluster/ccs/files/ccsd.rc b/sys-cluster/ccs/files/ccsd.rc
index d736326b84c6..4429aa5acc81 100755
--- a/sys-cluster/ccs/files/ccsd.rc
+++ b/sys-cluster/ccs/files/ccsd.rc
@@ -1,7 +1,7 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/ccs/files/ccsd.rc,v 1.4 2005/03/23 02:07:13 xmerlin Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/ccs/files/ccsd.rc,v 1.5 2005/03/25 02:12:26 xmerlin Exp $
depend() {
use net
diff --git a/sys-cluster/cman/ChangeLog b/sys-cluster/cman/ChangeLog
index 72467001234c..68bdcc658dad 100644
--- a/sys-cluster/cman/ChangeLog
+++ b/sys-cluster/cman/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for sys-cluster/cman
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/cman/ChangeLog,v 1.11 2005/03/23 02:37:10 xmerlin Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/cman/ChangeLog,v 1.12 2005/03/25 02:11:08 xmerlin Exp $
+
+ 25 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/cman.rc:
+ improved init script
23 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> cman-1.0_pre31.ebuild:
ebuild cleanup
diff --git a/sys-cluster/cman/files/cman.rc b/sys-cluster/cman/files/cman.rc
index f696f5b830a4..f9e9f39bbbad 100755
--- a/sys-cluster/cman/files/cman.rc
+++ b/sys-cluster/cman/files/cman.rc
@@ -1,7 +1,7 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/cman/files/cman.rc,v 1.4 2005/03/22 13:54:16 xmerlin Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/cman/files/cman.rc,v 1.5 2005/03/25 02:11:08 xmerlin Exp $
depend() {
use net
@@ -9,6 +9,72 @@ depend() {
provide cluster-manager
}
+umount_gfs_filesystems() {
+ local sig retry
+ local remaining="$(awk '$3 ~ /gfs/ { 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/ { 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
+}
+
+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
+}
+
+unload_gfs_modules() {
+ if [ -f /proc/fs/gfs ]; then
+ modules="gfs lock_harness"
+ fi
+ if [ -d /proc/cluster/lock_dlm ]; then
+ modules="${modules} lock_dlm"
+ fi
+ if [ -d /proc/cluster/lock_gulm ]; then
+ modules="${modules} lock_gulm"
+ fi
+ unload_modules ${modules}
+}
+
+
start() {
if grep -qE "<[[:space:]]*gulm([[:space:]]|[>]|$)" /etc/cluster/cluster.conf
then
@@ -16,9 +82,7 @@ start() {
fi
if [ ! -d /proc/cluster/config/cman ]; then
- ebegin "Loading cman module"
- modprobe cman
- eend $?
+ load_modules cman
fi
ebegin "Starting cman"
@@ -40,19 +104,67 @@ start() {
}
stop() {
+
+ # umount GFS filesystems
+ umount_gfs_filesystems
+
+ # shutdown clvm, fenced services
+ # need to be fixed (clvm missing)
+ local fence_status="$(cman_tool services | awk '$1 ~ /Fence/ { print $3 }')"
+ if [ -n "${fence_status}" ]; then
+ if [ -x /sbin/fence_tool ]; then
+ ebegin "Stopping fence domain"
+ /sbin/fence_tool leave > /dev/null 2>&1
+ eend $?
+ fi
+ fi
+
+ # shutdown dlm, gfs
+ unload_gfs_modules
+
ebegin "Stopping cman"
- /sbin/cman_tool -t ${CMAN_SHUTDOWN_TIMEOUT} \
- -w leave ${CMAN_LEAVE_OPTS} > /dev/null
+ local retry stat
+ local cman_status
+ cman_status="$(cman_tool status | awk '$1 ~ /Membership/ { print $3 }')"
+ if [ "${cman_status}" != "Not-in-Cluster" -a -d /proc/cluster/config/cman ]; then
+ retry=2
+ stat=1
+ while [ "${stat}" -eq 1 -a "${retry}" -gt 0 ]
+ do
+ /sbin/cman_tool -w -t ${CMAN_SHUTDOWN_TIMEOUT} \
+ leave ${CMAN_LEAVE_OPTS} > /dev/null
+
+ stat=$?
+ retry=$((${retry} -1))
+ done
+
+ #if [ "${stat}" -ne 0 ]; then
+ # /sbin/cman_tool -w -t 2 leave force > /dev/null
+ #fi
+
+ #if [ "$?" -ne 0 ]
+ #then
+ # ewend 1 "Failed to stop cman"
+ #else
+ # eend 0
+ #fi
+ else
+ eend 0
+ fi
+ eend $?
+
+ sleep 1s
+
+ local module="cman"
+ ebegin "Unloading ${module} kernel module"
+ modprobe -r ${module} &> /dev/null || return 0
if [ "$?" -ne 0 ]
then
- ewend 1 "Failed to stop cman"
+ ewend 1 "Failed to unload ${module} kernel module"
else
eend 0
- ebegin "Unloading cman kernel module"
- modprobe -r cman
- eend $?
fi
-
+ #unload_modules cman || return 0
}
diff --git a/sys-cluster/dlm/ChangeLog b/sys-cluster/dlm/ChangeLog
index dd6d01018327..15ec76d5f709 100644
--- a/sys-cluster/dlm/ChangeLog
+++ b/sys-cluster/dlm/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for sys-cluster/dlm
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/dlm/ChangeLog,v 1.9 2005/03/23 14:39:02 xmerlin Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/dlm/ChangeLog,v 1.10 2005/03/25 02:14:00 xmerlin Exp $
+
+ 25 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/dlm.rc:
+ improved init script
23 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/dlm.rc:
added lock_dlm module unload in init
diff --git a/sys-cluster/dlm/files/dlm.rc b/sys-cluster/dlm/files/dlm.rc
index c40a3f886af4..36f4750c9d49 100755
--- a/sys-cluster/dlm/files/dlm.rc
+++ b/sys-cluster/dlm/files/dlm.rc
@@ -1,7 +1,7 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/dlm/files/dlm.rc,v 1.2 2005/03/23 14:39:02 xmerlin Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/dlm/files/dlm.rc,v 1.3 2005/03/25 02:14:00 xmerlin Exp $
depend() {
use net
@@ -9,35 +9,45 @@ depend() {
provide cluster-locking-manager
}
+load_modules() {
+ local module modules
+ modules=$1
+
+ for module in ${modules}; do
+ ebegin "Loading ${module} kernel module"
+ modprobe ${module}
+ 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}
+ eend $? "Failed to unload ${module} kernel module"
+ done
+}
+
start() {
ebegin "Loading dlm module"
- modprobe dlm
+ load_modules dlm
eend $?
}
stop() {
- local module modules
+ local modules
if [ -d /proc/cluster/lock_dlm ]; then
modules="${modules} lock_dlm"
fi
- if [ -d /proc/cluster/dlm_dir ]; then
+ if [ -d /proc/cluster/config/dlm ]; then
modules="${modules} dlm"
fi
-
- local module
- for module in ${modules}; do
- ebegin "Unloading ${module} kernel module"
- modprobe -r ${module}
-
- if [ "$?" -ne 0 ]
- then
- ewend 1 "Failed to unload ${module} kernel module"
- else
- eend 0
- fi
- done
+ unload_modules ${modules}
}