Product SiteDocumentation Site

8.2.2. Actions

All OCF resource agents are required to implement the following actions.

Table 8.1. Required Actions for OCF Agents

ActionDescriptionInstructions
start
Start the resource
Return 0 on success and an appropriate error code otherwise. Must not report success until the resource is fully active.
stop
Stop the resource
Return 0 on success and an appropriate error code otherwise. Must not report success until the resource is fully stopped.
monitor
Check the resource’s state
Exit 0 if the resource is running, 7 if it is stopped, and anything else if it is failed.
NOTE: The monitor script should test the state of the resource on the local machine only.
meta-data
Describe the resource
Provide information about this resource as an XML snippet. Exit with 0.
NOTE: This is not performed as root.
validate-all
Verify the supplied parameters
Return 0 if parameters are valid, 2 if not valid, and 6 if resource is not configured.
Additional requirements (not part of the OCF specification) are placed on agents that will be used for advanced concepts such as clone resources.

Table 8.2. Optional Actions for OCF Resource Agents

ActionDescriptionInstructions
promote
Promote the local instance of a promotable clone resource to the master (primary) state.
Return 0 on success
demote
Demote the local instance of a promotable clone resource to the slave (secondary) state.
Return 0 on success
notify
Used by the cluster to send the agent pre- and post-notification events telling the resource what has happened and will happen.
Must not fail. Must exit with 0
One action specified in the OCF specs, recover, is not currently used by the cluster. It is intended to be a variant of the start action that tries to recover a resource locally.

Important

If you create a new OCF resource agent, use ocf-tester to verify that the agent complies with the OCF standard properly.