[Ocfs2-tools-commits] smushran commits r989 - trunk/vendor/common
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Jul 13 19:30:42 CDT 2005
Author: smushran
Date: 2005-07-13 19:30:41 -0500 (Wed, 13 Jul 2005)
New Revision: 989
Modified:
trunk/vendor/common/o2cb.init
Log:
fix for bug516 o2cb.init does not handle clustername as argument
Modified: trunk/vendor/common/o2cb.init
===================================================================
--- trunk/vendor/common/o2cb.init 2005-07-11 23:43:27 UTC (rev 988)
+++ trunk/vendor/common/o2cb.init 2005-07-14 00:30:41 UTC (rev 989)
@@ -255,17 +255,20 @@
fi
CLUSTER="$1"
- for i in "/config/cluster/${CLUSTER}/heartbeat/"*
- do
- HBUUID="`echo $i | cut -f6 -d/`"
- if [ "${HBUUID}" = "*" ]
+ RC=0
+ if [ -d "/config/cluster/${CLUSTER}/heartbeat/" ]
+ then
+ ls -1 "/config/cluster/${CLUSTER}/heartbeat/" | while read HBUUID
+ do
+ return 2;
+ done;
+ if [ $? = 2 ]
then
- break;
- else
- return 2;
+ RC=2
fi
- done
- return 0
+ fi
+
+ return $RC
}
#
@@ -283,13 +286,14 @@
echo -n "Cleaning heartbeat on ${CLUSTER}: "
- for i in "/config/cluster/${CLUSTER}/heartbeat/"*
+ if [ ! -d "/config/cluster/${CLUSTER}/heartbeat/" ]
+ then
+ echo "OK"
+ return
+ fi
+
+ ls -1 "/config/cluster/${CLUSTER}/heartbeat/" | while read HBUUID
do
- HBUUID="`echo $i | cut -f6 -d/`"
- if [ "${HBUUID}" = "*" ]
- then
- break;
- fi
OUTPUT="`ocfs2_hb_ctl -I -u ${HBUUID} 2>&1`"
if [ $? != 0 ]
then
@@ -308,6 +312,10 @@
OUTPUT="`ocfs2_hb_ctl -K -u ${HBUUID} 2>&1`"
fi
done
+ if [ $? = 1 ]
+ then
+ exit 1
+ fi
echo "OK"
}
@@ -487,6 +495,7 @@
CLUSTER="${1:-${O2CB_BOOTCLUSTER}}"
if [ -z "$CLUSTER" ]
then
+ echo "Cluster not known"
return
fi
@@ -527,20 +536,23 @@
fi
CLUSTER="$1"
- for i in "/config/cluster/${CLUSTER}/node/"*
- do
- NODE="`echo $i | cut -f6 -d/`"
- if [ "${NODE}" = "*" ]
+ RC=0
+ if [ -d "/config/cluster/${CLUSTER}/node/" ]
+ then
+ ls -1 "/config/cluster/${CLUSTER}/node/" | while read NODE
+ do
+ LOCAL="`cat \"/config/cluster/${CLUSTER}/node/${NODE}/local\"`"
+ if [ $LOCAL = 1 ]
+ then
+ return 2
+ fi
+ done
+ if [ $? = 2 ]
then
- return 0
+ RC=2
fi
- LOCAL="`cat \"/config/cluster/${CLUSTER}/node/${NODE}/local\"`"
- if [ $LOCAL = 1 ]
- then
- return 2
- fi
- done
- return 0
+ fi
+ return $RC
}
offline()
@@ -581,11 +593,24 @@
fi
load
- online "$2"
+ online "$1"
}
unload()
{
+ if [ -d "/config/cluster/" ]
+ then
+ ls -1 /config/cluster/ | while read CLUSTER
+ do
+ echo "Unable to unload modules as Cluster ${CLUSTER} is still online" >&2
+ exit 1
+ done
+ if [ $? = 1 ]
+ then
+ exit 1
+ fi
+ fi
+
for i in $(seq $((${#LOAD_ACTIONS[*]} - 1)) -1 0); do
eval "un${LOAD_ACTIONS[i]}"
if_fail "$?"
@@ -594,7 +619,7 @@
stop()
{
- offline "$2"
+ offline "$1"
unload
}
@@ -688,25 +713,25 @@
case "$1" in
start)
- start
+ start "$2"
;;
status)
- status $2
+ status "$2"
;;
stop)
- stop
+ stop "$2"
;;
restart)
- stop
- start
+ stop "$2"
+ start "$2"
;;
force-reload)
- stop
- start
+ stop "$2"
+ start "$2"
;;
load)
More information about the Ocfs2-tools-commits
mailing list