Implement high-availability solutions with HP Instant Capacity - easily and effectively
32
Scripts for member failover in an nPartition environment
These scripts correspond to the “Automated (Serviceguard) member failover from a partial outage with nPartitions”
subsection. This example is based on a Serviceguard cluster that includes the partitions Db1 and Db2. The failover
package is defined to run normally on Db1 and with AUTO_RUN enabled so that failover will occur to Db2. There is no
standby Group Manager, so no Group Manager fails over. For this example, assume the package workload needs a
minimum of 16 processor cores to be activated. The gicap_start startup subroutine is invoked from external_pre_script
of the package control script. It will run on the partition where Serviceguard starts the package (either a normal startup
or a failover startup) or when the cmrunpkg command is invoked. Here, the seizure is automatically handled by the OA.
We just need to add the newly available rights to the partition that the package failed over to.
Gicap_start (){
#! /usr/bin/sh
PATH=$PATH:/usr/sbin
#Always activate 12 additional cores in order to run the package
#Sleeping for 3 minutes as a buffer to let the failed partition go down and
#release rights. This isn’t required if we use the –t option
sleep 180
/usr/sbin/icapmodify -a [-t] 12 > &2
return 0
}
The gicap_stop shutdown subroutine is invoked from the external_pre_script function of the package control script.
It provides cleanup and is useful in making the processing of the scripts generic because it can always simply deactivate
the processor cores needed to run the package. This script is only invoked when the package is stopped cleanly, for
example during reboot, or whenever the cmhaltpkg command is run. It is not run during a failure situation.
Note: For more details on how to set up scripts and subroutines for Serviceguard, refer to the example scripts located at
/etc/cmcluster/examples/external_script.template.
gicap_stop() {
#! /usr/bin/sh
#Package is shutting down, deactivate cores
echo Executing/usr/sbin/icapmodify -d
/usr/sbin/icapmodify -d 12
return 0
}