diff options
-rw-r--r-- | sys-cluster/fence/ChangeLog | 5 | ||||
-rwxr-xr-x | sys-cluster/fence/files/fenced.rc | 19 | ||||
-rw-r--r-- | sys-cluster/gnbd/ChangeLog | 6 | ||||
-rwxr-xr-x | sys-cluster/gnbd/files/gnbd-client.rc | 44 | ||||
-rwxr-xr-x | sys-cluster/gnbd/files/gnbd-srv.rc | 2 | ||||
-rw-r--r-- | sys-fs/gfs/ChangeLog | 5 | ||||
-rwxr-xr-x | sys-fs/gfs/files/gfs.rc | 179 |
7 files changed, 167 insertions, 93 deletions
diff --git a/sys-cluster/fence/ChangeLog b/sys-cluster/fence/ChangeLog index ff6616a867ce..f837858af998 100644 --- a/sys-cluster/fence/ChangeLog +++ b/sys-cluster/fence/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for sys-cluster/fence # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/fence/ChangeLog,v 1.10 2005/03/23 14:37:33 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/fence/ChangeLog,v 1.11 2005/03/25 02:15:31 xmerlin Exp $ + + 25 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/fenced.rc: + improved init script 23 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/fenced.rc: added gfs filesystems umount support in init (fs mounted by hand) diff --git a/sys-cluster/fence/files/fenced.rc b/sys-cluster/fence/files/fenced.rc index dafb351da0b4..68c7b6abbe09 100755 --- a/sys-cluster/fence/files/fenced.rc +++ b/sys-cluster/fence/files/fenced.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/fence/files/fenced.rc,v 1.3 2005/03/23 14:37:33 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/fence/files/fenced.rc,v 1.4 2005/03/25 02:15:31 xmerlin Exp $ depend() { use net @@ -14,17 +14,12 @@ start() { eend $? } -stop() { - - # umount manually mounted gfs filesystems +umount_gfs_filesystems() { local sig retry - local remaining="$(awk '$3 ~ /gfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" + local remaining="$(awk '$3 ~ /gfs/ { print $2 }' /proc/mounts | sort -r)" - if [ -z "${remaining}" ] + if [ -n "${remaining}" ] then - ebegin "Unmounting GFS filesystems" - eend 0 - else sig= retry=3 while [ -n "${remaining}" -a "${retry}" -gt 0 ] @@ -47,7 +42,13 @@ stop() { sig=-9 done fi +} + +stop() { + # umount GFS filesystems + umount_gfs_filesystems + ebegin "Stopping fence domain" /sbin/fence_tool leave > /dev/null 2>&1 eend $? diff --git a/sys-cluster/gnbd/ChangeLog b/sys-cluster/gnbd/ChangeLog index e7d6c79e95d2..300f80274c77 100644 --- a/sys-cluster/gnbd/ChangeLog +++ b/sys-cluster/gnbd/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for sys-cluster/gnbd # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/ChangeLog,v 1.3 2005/03/23 14:40:35 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/ChangeLog,v 1.4 2005/03/25 02:17:29 xmerlin Exp $ + + 25 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/gnbd-client.rc, + files/gnbd-srv.rc: + improved init script 23 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/gnbd-client.rc: added gfs filesystems (imported GNBSs) umount in init diff --git a/sys-cluster/gnbd/files/gnbd-client.rc b/sys-cluster/gnbd/files/gnbd-client.rc index 6af0a4463a46..042c0fefa606 100755 --- a/sys-cluster/gnbd/files/gnbd-client.rc +++ b/sys-cluster/gnbd/files/gnbd-client.rc @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/files/gnbd-client.rc,v 1.3 2005/03/23 14:40:35 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/files/gnbd-client.rc,v 1.4 2005/03/25 02:17:29 xmerlin Exp $ depend() { use dns logger @@ -9,6 +9,29 @@ depend() { need fenced } +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() { if [ ! -f /etc/gnbdtab ] ; then eerror "Please create /etc/gnbdtab" @@ -16,9 +39,7 @@ start() { return 1 fi - ebegin "Loading needed kernel modules for gnbd" - modprobe gnbd - eend $? "Failed to load needed kernel modules for gnbd" + load_modules gnbd GNBD=`cat /etc/gnbdtab | egrep '^import'` if [ -n "$GNBD" ] ; then @@ -31,12 +52,13 @@ start() { stop() { + # umount manually mounted gfs filesystems local sig retry - local remaining="$(awk '$3 ~ /gfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" + local remaining="$(awk '$3 ~ /gfs/ && $1 ~ /\/dev\/gnbd\// { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" if [ -z "${remaining}" ] then - ebegin "Unmounting GFS filesystems" + ebegin "Unmounting GFS filesystems (GNBDs imported devices)" eend 0 else sig= @@ -53,7 +75,7 @@ stop() { umount ${remaining} &>/dev/null eend $? "Failed to unmount GFS filesystems" fi - remaining="$(awk '$3 ~ /gfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" + remaining="$(awk '$3 ~ /gfs/ && $1 ~ /\/dev\/gnbd\// { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" [ -z "${remaining}" ] && break /bin/fuser -k -m ${sig} ${remaining} &>/dev/null sleep 5 @@ -62,8 +84,6 @@ stop() { done fi - - local GNBD_MONITOR_PROC ebegin "Unimporting all GNBDs devices" @@ -76,8 +96,6 @@ stop() { killall gnbd_monitor &> /dev/null eend $? fi - - ebegin "Unloading gnbd kernel module" - modprobe -r gnbd - eend $? "Failed to unload gnbd kernel module" + + unload_modules gnbd } diff --git a/sys-cluster/gnbd/files/gnbd-srv.rc b/sys-cluster/gnbd/files/gnbd-srv.rc index 9c0b9d074312..f5dbfff356b9 100755 --- a/sys-cluster/gnbd/files/gnbd-srv.rc +++ b/sys-cluster/gnbd/files/gnbd-srv.rc @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/files/gnbd-srv.rc,v 1.2 2005/03/23 02:50:37 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/files/gnbd-srv.rc,v 1.3 2005/03/25 02:17:29 xmerlin Exp $ depend() { use dns logger diff --git a/sys-fs/gfs/ChangeLog b/sys-fs/gfs/ChangeLog index e4861ca2732c..70cc1ccf11bd 100644 --- a/sys-fs/gfs/ChangeLog +++ b/sys-fs/gfs/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for sys-fs/gfs # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/gfs/ChangeLog,v 1.6 2005/03/23 14:35:55 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/gfs/ChangeLog,v 1.7 2005/03/25 02:19:14 xmerlin Exp $ + + 25 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/gfs.rc: + improved init script 23 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/gfs.rc: added lock_harness module remove in init diff --git a/sys-fs/gfs/files/gfs.rc b/sys-fs/gfs/files/gfs.rc index 7dc350e0f4c6..07130d2b3531 100755 --- a/sys-fs/gfs/files/gfs.rc +++ b/sys-fs/gfs/files/gfs.rc @@ -1,77 +1,71 @@ #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/sys-fs/gfs/files/gfs.rc,v 1.3 2005/03/23 14:35:55 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/gfs/files/gfs.rc,v 1.4 2005/03/25 02:19:14 xmerlin Exp $ + +opts="${opts} mountall" depend() { use dns logger use net + after gnbd-client clvmd need cluster-manager cluster-locking-manager fenced provide cluster } -start() { - einfo "Starting gfs cluster:" - - if [ ! -f /etc/ntp.conf ] ; then - eerror "Please create /etc/ntp.conf" - eerror "Sample conf: /usr/share/ntp/ntp.conf" - eend 1 - fi +mount_gfs_filesystems() { + local remaining="" + remaining="$(awk '!/^#/ && $3 ~ /gfs/ { if ($4 !~ "noauto") print $1 }' /etc/fstab)" - local module - - # detect cluster/locking manager cman+dlm or gulm ? - if [ -d /proc/cluster/config/cman ]; then - if [ ! -d /proc/cluster/lock_dlm ]; then - modules="${modules} lock_dlm" - fi - else - if [ ! -d /proc/cluster/lock_gulm ]; then - modules="${modules} lock_gulm" - fi - fi - - if [ ! -f /proc/fs/gfs ]; then - modules="${modules} gfs" - fi + if [ -n "${remaining}" ]; then - for module in ${modules}; do - ebegin "Loading ${module} kernel module" - modprobe ${module} + local device="" + local remaining_verified="" - if [ "$?" -ne 0 ] - then - ewend 1 "Failed to load ${module} kernel module" + for device in ${remaining}; do + if [ -b ${device} ]; then + remaining_verified="${remaining_verified} ${device}" + else + if [ $(echo "${device}" | awk '$1 ~ /\/dev\/gnbd/') ]; then + ewarn "Please start /etc/init.d/gnbd-client before trying to mount GNBDs devices" + else + if [ $(echo "${device}" | awk '$1 ~ /\/dev\/vg/') ]; then + ewarn "Please start /etc/init.d/clvmd before trying to mount LVM volumes" + fi + fi + fi + done + + if [ -n "${remaining_verified}" ]; then + einfo "Mounting GFS filesystems" + device="" + for device in ${remaining_verified}; do + local target="$(awk '!/^#/ && $3 ~ /gfs/ { if ("$1" -eq "${device}" ) print $2 }' /etc/fstab)" + local mounted="$(awk '$3 ~ /gfs/ { if ("$1" -eq "${device}" ) print $2 }' /proc/mounts)" + + # mount only filesystems not already mounted + if [ -z "${mounted}" ]; then + ebegin "--> mounting ${device} on ${target}" + mount -t gfs ${device} ${target} >/dev/null + eend $? + else + einfo "--> ${device} already mounted on ${target}" + eend 0 + fi + done else - eend 0 + einfo "No GFS filesystems to automount" fi - done - - ebegin "Mounting GFS filesystems" - mount -at gfs >/dev/null - - if [ "$?" -ne 0 ] - then - ewend 1 "Could not mount all GFS filesystems!" - else - eend 0 fi - - return 0 } -stop() { - einfo "Stopping gfs cluster:" - + +umount_gfs_filesystems() { local sig retry - local remaining="$(awk '$3 ~ /gfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" + local remaining="$(awk '$3 ~ /gfs/ { print $2 }' /proc/mounts | sort -r)" - if [ -z "${remaining}" ] + if [ -n "${remaining}" ] then - ebegin "Unmounting GFS filesystems" - eend 0 - else sig= retry=3 while [ -n "${remaining}" -a "${retry}" -gt 0 ] @@ -94,12 +88,52 @@ stop() { sig=-9 done fi +} + +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 +} + +load_gfs_modules() { + local modules + # detect cluster/locking manager cman+dlm or gulm ? + if [ -d /proc/cluster/config/cman ]; then + if [ ! -d /proc/cluster/lock_dlm ]; then + modules="${modules} lock_dlm" + fi + else + if [ ! -d /proc/cluster/lock_gulm ]; then + modules="${modules} lock_gulm" + fi + fi + if [ ! -f /proc/fs/gfs ]; then + modules="${modules} gfs" + fi + load_modules ${modules} +} + +unload_gfs_modules() { if [ -f /proc/fs/gfs ]; then - modules="gfs" - modules="${modules} lock_harness" + modules="gfs lock_harness" fi if [ -d /proc/cluster/lock_dlm ]; then modules="${modules} lock_dlm" @@ -107,19 +141,30 @@ stop() { if [ -d /proc/cluster/lock_gulm ]; then modules="${modules} lock_gulm" fi + unload_modules ${modules} +} + +mountall() { + mount_gfs_filesystems +} + +start() { + einfo "Starting gfs cluster:" - 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 + if [ ! -f /etc/ntp.conf ] ; then + eerror "Please create /etc/ntp.conf" + eerror "Sample conf: /usr/share/ntp/ntp.conf" + eend 1 + fi - return 0 + load_gfs_modules + mount_gfs_filesystems } + +stop() { + einfo "Stopping gfs cluster:" + + umount_gfs_filesystems + unload_gfs_modules +} + |