Product SiteDocumentation Site

10.3.9. Requirements for Multi-state Resource Agents

Since multi-state resources are an extension of cloned resources, all the requirements for resource agents that support clones are also requirements for resource agents that support multi-state resources.
Additionally, multi-state resources require two extra actions, demote and promote, which are responsible for changing the state of the resource. Like start and stop, they should return ${OCF_SUCCESS} if they completed successfully or a relevant error code if they did not.
The states can mean whatever you wish, but when the resource is started, it must come up in the mode called slave. From there the cluster will decide which instances to promote to master.
In addition to the clone requirements for monitor actions, agents must also accurately report which state they are in. The cluster relies on the agent to report its status (including role) accurately and does not indicate to the agent what role it currently believes it to be in.

Table 10.10. Role implications of OCF return codes

Monitor Return Code Description
OCF_NOT_RUNNING
Stopped
OCF_SUCCESS
Running (Slave)
OCF_RUNNING_MASTER
Running (Master)
OCF_FAILED_MASTER
Failed (Master)
Other
Failed (Slave)

10.3.9.1. Multi-state Notifications

Like clones, supporting notifications requires the notify action to be implemented. If supported, the notify action will be passed a number of extra variables which, when combined with additional context, can be used to calculate the current state of the cluster and what is about to happen to it.

Table 10.11. Environment variables supplied with multi-state notify actions [a]

Variable Description
OCF_RESKEY_CRM_meta_notify_type
Allowed values: pre, post
OCF_RESKEY_CRM_meta_notify_operation
Allowed values: start, stop
OCF_RESKEY_CRM_meta_notify_active_resource
Resources that are running
OCF_RESKEY_CRM_meta_notify_inactive_resource
Resources that are not running
OCF_RESKEY_CRM_meta_notify_master_resource
Resources that are running in Master mode
OCF_RESKEY_CRM_meta_notify_slave_resource
Resources that are running in Slave mode
OCF_RESKEY_CRM_meta_notify_start_resource
Resources to be started
OCF_RESKEY_CRM_meta_notify_stop_resource
Resources to be stopped
OCF_RESKEY_CRM_meta_notify_promote_resource
Resources to be promoted
OCF_RESKEY_CRM_meta_notify_demote_resource
Resources to be demoted
OCF_RESKEY_CRM_meta_notify_start_uname
Nodes on which resources will be started
OCF_RESKEY_CRM_meta_notify_stop_uname
Nodes on which resources will be stopped
OCF_RESKEY_CRM_meta_notify_promote_uname
Nodes on which resources will be promoted
OCF_RESKEY_CRM_meta_notify_demote_uname
Nodes on which resources will be demoted
OCF_RESKEY_CRM_meta_notify_active_uname
Nodes on which resources are running
OCF_RESKEY_CRM_meta_notify_master_uname
Nodes on which resources are running in Master mode
OCF_RESKEY_CRM_meta_notify_slave_uname
Nodes on which resources are running in Slave mode