Sun Cluster 3.0 Data Services Developers' Guide

RMAPI Callback Methods

Callback methods are the key elements provided by the API for implementing a resource type. Callback methods enable the RGM to control resources in the cluster in the event of a change in cluster membership, such as a node boot or crash.


Note -

The callback methods are executed by the RGM with root permissions because the client programs control HA services on the cluster system. Install and administer these methods with restrictive file ownership and permissions. Specifically, give them a privileged owner, such as bin or root, and do not make them writable.


This section describes callback method arguments and exit codes and lists and describes callback methods in the following categories:


Note -

Although this section provides brief descriptions of the callback methods, including the point at which the method is invoked and the expected effect on the resource, the rt_callbacks(1HA) man page is the definitive reference for the callback methods.


Method Arguments

The RGM invokes callback methods as follows:

method -R resource-name -T type-name -G group-name

The method is the path name of the program that is registered as the START, STOP, or other callback. The callback methods of a resource type are declared in its registration file.

All callback method arguments are passed as flagged values, with -R indicating the name of the resource instance, -T indicating the type of the resource, and -G indicating the group into which the resource is configured. Use the arguments with access functions to retrieve information about the resource.

The VALIDATE method is called with additional arguments (the property values of the resource and resource group on which it is called).

See rt_callbacks(1HA) for more information.

Exit Codes

All callback methods have the same exit codes defined to specify the effect of the method invocation on the resource state. The scha_calls(3HA) man page describes all these exit codes. The exit codes are:

The RGM also handles abnormal failures of callback method execution, such as time outs and core dumps.

Method implementations must output failure information using syslog(3) on each node. Output written to stdout or stderr is not guaranteed to be delivered to the user (though it currently is displayed on the console of the local node).

Control and Initialization Callback Methods

The primary control and initialization callback methods start and stop a resource. Other methods execute initialization and termination code on a resource.


Note -

Failure of the INIT, FINI, or BOOT methods causes the syslog(3) function to generate an error message but does not otherwise affect RGM management of the resource.


Administrative Support Methods

Administrative actions on resources include setting and changing resource properties. The VALIDATE and UPDATE callback methods enable a resource type implementation to hook into these administrative actions.

Net-Relative Callback Methods

Services that use network address resources might require that start or stop steps be done in a certain order relative to the network address configuration. The following optional callback methods, PRENET_START and POSTNET_STOP, enable a resource type implementation to do special startup and shutdown actions before and after a related network address is configured or unconfigured.

Monitor Control Callback Methods

A resource type implementation optionally can include a program to monitor the performance of a resource, report on its status, or take action on resource failure. The MONITOR_START, MONITOR_STOP, and MONITOR_CHECK methods support the implementation of a resource monitor in a resource type implementation.