The RGM executes the Fini method to clean up after a resource when that resource is no longer managed by the RGM. The Fini method usually undoes any initializations that were performed by the Init method.
The RGM executes Fini on the node or zone where the resource becomes unmanaged when the following situations arise:
The resource group that contains the resource is switched to an unmanaged state. In this case, the RGM executes the Fini method on all nodes and zones in the node list.
The resource is deleted from a managed resource group. In this case, the RGM executes the Fini method on all nodes and zones in the node list.
A node or zone is deleted from the node list of the resource group that contains the resource. In this case, the RGM executes the Fini method on only the deleted node or zone.
A “node list” is either the resource group's Nodelist or the resource type's Installed_nodes list. Whether “node list” refers to the resource group's Nodelist or the resource type's Installed_nodes list depends on the setting of the resource type's Init_nodes property. The Init_nodes property can be set to RG_nodelist or RT_installed_nodes. For most resource types, Init_nodes is set to RG_nodelist, the default. In this case, both the Init and Fini methods are executed on the nodes and zones that are specified in the resource group's Nodelist.
The type of initialization that the Init method performs defines the type of cleanup that the Fini method that you implement needs to perform, as follows:
Cleanup of node-specific configuration.
Cleanup of cluster-wide configuration.
The Fini method that you implement needs to determine whether to perform only cleanup of node-specific configuration or cleanup of both node-specific and cluster-wide configuration.
When a resource becomes unmanaged on only a particular node or zone, the Fini method can clean up local, node-specific configuration. However, the Fini method must not clean up global, cluster-wide configuration, because the resource remains managed on other nodes. If the resource becomes unmanaged cluster-wide, the Fini method can perform cleanup of both node-specific and global configuration. Your Fini method code can distinguish these two cases by determining whether the resource group's node list contains the local node or zone on which your Fini method is executing.
If the local node or zone appears in the resource group's node list, the resource is being deleted or is moving to an unmanaged state. The resource is no longer active on any node or zone. In this case, your Fini method needs to clean up any node-specific configuration on the local node as well as cluster-wide configuration.
If the local node or zone does not appear in the resource group's node list, your Fini method can clean up node-specific configuration on the local node or zone. However, your Fini method must not clean up cluster-wide configuration. In this case, the resource remains active on other nodes or zones.
You must also code the Fini method so that it is idempotent. In other words, even if the Fini method has cleaned up a resource during a previous execution, subsequent calls to the Fini method exit successfully.