Cost-Effective High-Availability Solutions with HP Instant Capacity on HP-UX
44
# check the OS status of the other node in the cluster
STATUS=`cmviewcl -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 >&2
remsh $GM -l root -n "/usr/sbin/icapmanage -x $OTHER_HOST"
fi
# Activate cores needed to run the package
echo Executing /usr/sbin/icapmodify -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
Additional Serviceguard scripting considerations
When developing Serviceguard scripts, consider the following:
• Remember that if temporary capacity is being used in the group, it may be necessary to specify -t
on the failover activation command (icapmodify -a or icapmodify -s commands).
• The status of errors should be checked and commands may need to be retried. In particular,
concurrent activations within virtual partitions of the same nPartition may cause “GroupB” write
errors or timeout errors. Rights seizure is idempotent, so it is safe to retry that operation.
• It is also a good idea to check if usage rights have been made available even after an attempted
rights seizure returns an error such as a timeout error. The rights seizure could have timed out while
the manager was waiting for a response from a target member, and does not necessarily mean that
the rights seizure did not complete independently.
• If multiple virtual partition scripts are coded to try for concurrent rights seizure or restore operations,
remember that only one of those operations will succeed for the nPartition. (In those cases, you
might choose to ignore errors.) It would be best to code in such a way as to avoid redundant nPar
operations like this, and in general to avoid concurrent activations/deactivations if possible. For
example, one technique might be to try to activate cores on the failover node first, and only if that
fails, try doing a usage rights seizure. (This is based on the assumption that another virtual partition
has executed first and successfully completed the rights seizure.) Another technique for virtual
partitions might be to designate master/slave virtual partitions on the failover nodes and have only
the “master” virtual partition try the rights seizure command. When it succeeds, the master can use
vparmodify commands to activate cores in the other virtual partitions.