Sun Cluster 3.0 Data Services Developers' Guide

Controlling an Application

Callback methods enable the RGM to take control of the underlying resource (application) whenever nodes are in the process of joining or leaving the cluster.

Starting and Stopping a Resource

A resource type implementation requires, at a minimum, a START method and a STOP method. The RGM calls a resource type's method functions or programs at appropriate times and on the appropriate nodes for bringing resource groups offline and online. For example, after the crash of a cluster node, the RGM moves any resource groups mastered by that node onto a new node. You must implement a START method to provide the RGM with a way of restarting each resource on the surviving host node.

A START method must not return until the resource has been started and is available on the local node. Be certain that resource types requiring a long initialization period have sufficiently long timeouts set on their START methods (set default and minimum values for the Start_timeout property in the resource type registration file).

You must implement a STOP method for situations in which the RGM takes a resource group offline. For example, suppose a resource group is taken offline on Node1 and back online on Node2. While taking the resource group offline, the RGM calls the STOP method on resources in the group to stop all activity on Node1. After the STOP methods for all resources have completed on Node1, the RGM brings the resource group back online on Node2.

A STOP method must not return until the resource has completely stopped all its activity on the local node and has completely shut down. The safest implementation of a STOP method would terminate all processes on the local node related to the resource. Resource types requiring a long time to shut down should have sufficiently long timeouts set on their STOP methods. Set the Stop_timeout property in the resource type registration file.

Failure or timeout of a STOP method causes the resource group to enter an error state that requires operator intervention. To avoid this state, the STOP and MONITOR_STOP method implementations should attempt to recover from all possible error conditions. Ideally, these methods should exit with 0 (success) error status, having successfully stopped all activity of the resource and its monitor on the local node.

Initializing and Terminating a Resource

Three optional methods, INIT, FINI, and BOOT, allow the RGM to execute initialization and termination code on a resource. The RGM invokes the INIT method to perform a one-time initialization of the resource when the resource becomes managed--either when the resource group it is in is switched from an unmanaged to a managed state, or when it is created in a resource group that is already managed.

The RGM invokes the FINI method to clean up after the resource when the resource becomes unmanaged--either when the resource group it is in is switched to an unmanaged state or when it is deleted from a managed resource group. The clean up must be idempotent, that is, if the clean up has already been done, FINI exits 0 (success).

The RGM invokes the BOOT method on nodes that have newly joined the cluster, that is, have been booted or rebooted.

The BOOT method normally performs the same initialization as INIT. This initialization must be idempotent, that is, if the resource has already been initialized on the local node, BOOT and INIT exit 0 (success).