Implement high-availability solutions with HP Instant Capacity - easily and effectively

35
# cat gicap_start.sh
PATH=$PATH:/usr/sbin
HOSTNAME=`/usr/bin/hostname`
GM=gmpkg02.xxx.hp.com
# The number of cores needed to run the package
NUM=8
case $HOSTNAME in
db1) OTHER_HOST=oa2.bbb.hp.com
OTHER=db2;;
db2) OTHER_HOST=oa1.bbn.hp.com
OTHER=db1;;
esac
# check the OS status of the other node in the cluster
STATUS=`cimviewcl -f line -n $OTHER | grep '^status=' | cut -f 2 -d=`
if [[ $STATUS != "up" ]]
then
#
Our failover/failback node is down, this is a failover startup.
#
Seize core usage rights from the failed node.
echo $OTHER is not up. On $GM, executing icapmanage -x $OTHER_HOST
remsh $GM -l root -n "/usr/sbin/icapmanage -x $OTHER_HOST"
fi
# Activate cores needed to run the package
echo Executing /usr/sbin/icapmanage -s $NUM >&2
/usr/sbin/icapmodify -s $NUM
return 0
In this example, the shutdown script for the member simply releases the resources:
# cat gicap_stop.sh
#! /usr/bin/sh
# Package is shutting down, deactivate cores
echo Executing /usr/sbin/icapmodify -s 2 >&2
/usr/sbin/icapmodify -s 2
return 0