[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-ha
Subject: Re: [Linux-HA] Stonith with Sun x4200 ?
From: Peter Clapham <pc7 () sanger ! ac ! uk>
Date: 2006-10-26 16:22:57
Message-ID: 4540E0E1.7010408 () sanger ! ac ! uk
[Download RAW message or body]
Hi,
The former script has been updated to perform a little more checking and
following a recent "event", the reset option is now implimented in a
more harsh fashion. Oh.. and Wellcome is now spelt correctly :-)
See attached
Pete
["x-4200-ilo.2" (text/plain)]
#!/bin/bash
# External STONITH module for Sun X4200 power
# management
#
# Produced by Peter Clapham and released under GPL
# courtesy of the Wellcome Trust, Sanger Institute.
#
# NB hostlist is a list of the hosts that are
# being monitored and ilname are the ilo devices
# being used to bring the hosts up/down.
#
# This script is using ipmitools as the ilo cli
# has proven unreliable. The X4200's are IPMI 2.0
# compliant.
# For heartbeat we need:
#
# gethosts (hostlist defined), on (bring up ilo)
# off (bring down ilo), reset (reset ilo), status
# (are host, ilo and ilo functionaility alive ?!)
# getconfignames (required script parameters),
# getinfo-foo (generic info, limited use)
. /usr/lib/heartbeat/ocf-shellfuncs
# IPMI communication variables
IPMITOOL="/usr/bin/ipmitool"
IPMIPASS="********"
IPMIUSER="********"
case $1 in
gethosts)
for h in $hostlist ; do
echo $h
done
exit $OCF_SUCCESS
;;
on)
/usr/bin/logger -p syslog.info Sun X4200 IPMI STONITH powering on $iloname
$IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power on > /dev/null 2>&1
sleep 3
IPMITEST=$($IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power status|awk '{print $4}')
if [ $IPMITEST = "on" ] ; then
exit $OCF_SUCCESS
else
exit $OCF_ERR_GENERIC
fi
;;
off)
/usr/bin/logger -p syslog.info Sun X4200 IPMI STONITH powering off $iloname
$IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power off > /dev/null 2>&1
sleep 3
IPMITEST=$($IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power status|awk '{print $4}')
if [ $IPMITEST = "off" ] ; then
exit $OCF_SUCCESS
else
exit $OCF_ERR_GENERIC
fi
;;
reset)
# restart is apparently far to kind ! A SYS nuke
# may be required if system has hit a high load
# and has hung !
#
# Numerous checks to ensure things actually do
# as they are supposed to do... sleep entries
# allow chance for effects to be reported to
# heartbeat in a sane way
/usr/bin/logger -p syslog.info Sun X4200 IPMI STONITH restarting $iloname
IPMITEST=$($IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power status|awk '{print $4}')
if [ $IPMITEST = "on" ] ; then
$IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power off > /dev/null 2>&1
sleep 3
IPMITEST2=$($IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power status|awk '{print $4}')
if [ $IPMITEST2 = "off" ] ; then
$IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power on > /dev/null 2>&1
sleep 3
IPMITEST3=$($IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power status|awk '{print $4}')
if [ $IPMITEST3 = "on" ] ; then
exit $OCF_SUCCESS
else
exit $OCF_ERR_GENERIC
fi
else
exit $OCF_ERR_GENERIC
fi
else
$IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power on > /dev/null 2>&1
IPMITEST2=$($IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power status|awk '{print $4}')
if [ $IPMITEST2 = "on" ] ; then
exit $OCF_SUCCESS
else
exit $OCF_ERR_GENERIC
fi
fi
;;
status)
IPMITEST=$($IPMITOOL -H $iloname -U $IPMIUSER -P $IPMIPASS chassis power status|awk '{print $4}')
if [ $IPMITEST = "on" ] ; then
exit $OCF_SUCCESS
else
exit $OCF_ERR_GENERIC
fi
;;
getconfignames)
echo "hostlist"
echo "iloname"
exit $OCF_SUCCESS
;;
getinfo-devid)
echo "Sun X4200 IPMI STONITH device"
exit $OCF_SUCCESS
;;
getinfo-devname)
echo "IPMI STONITH external device"
exit $OCF_SUCCESS
;;
getinfo-devdescr)
echo "IPMI-based host power ctrl"
echo "May not even be fine for testing !"
exit $OCF_SUCCESS
;;
getinfo-devurl)
echo "http://www.openipmi.org/"
exit $OCF_SUCCESS
;;
getinfo-xml)
cat << IPMIXML
<parameters>
<parameter name="hostlist" unique="1">
<content type="string" />
<shortdesc lang="en">
Hostlist
</shortdesc>
<longdesc lang="en">
The list of hosts that the STONITH device controls
</longdesc>
</parameter>
<parameter name="iloname" unique="1">
<content type="string" />
<shortdesc>
iloname
</shortdesc>
<longdesc lang="en">
The ilo devices STONITH is to operate with
</longdesc>
</parameter>
</parameters>
IPMIXML
exit $OCF_SUCCESS
;;
*)
exit $OCF_ERR_GENERIC
;;
esac
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic