Product SiteDocumentation Site

B.2. Actions

All OCF Resource Agents are required to implement the following actions

Table B.1. Required Actions for OCF Agents

Action Description Instructions
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
Exit with 0 if parameters are valid, 2 if not valid, 6 if resource is not configured.

Additional requirements (not part of the OCF specs) are placed on agents that will be used for advanced concepts like clones and multi-state resources.

Table B.2. Optional Actions for OCF Agents

Action Description Instructions
promote
Promote the local instance of a multi-state resource to the master/primary state.
Return 0 on success
demote
Demote the local instance of a multi-state 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 is not currently used by the cluster:
Remember to use ocf-tester to verify that your new agent complies with the OCF standard properly.