5.10. notify action

With notifications, instances of clones (and of master/slave resources, which are an extended kind of clones) can inform each other about their state. When notifications are enabled, any action on any instance of a clone carries a pre and post notification. Then, the cluster manager invokes the notify operation on all clone instances. For notify operations, additional environment variables are passed into the resource agent during execution:

Notifications come in particularly handy for master/slave resources using a "pull" scheme, where the master is a publisher and the slave a subscriber. Since the master is obviously only available as such when a promotion has occurred, the slaves can use a "pre-promote" notification to configure themselves to subscribe to the right publisher.

Likewise, the subscribers may want to unsubscribe from the publisher after it has relinquished its master status, and a "post-demote" notification can be used for that purpose.

Consider the example below to illustrate the concept.

foobar_notify() {
    local type_op

    ocf_log debug "Received $type_op notification."
    case "$type_op" in
            ocf_run frobnicate --slave-mode \
                               --master=$OCF_RESKEY_CRM_meta_notify_promote_uname \
                               || exit $OCF_ERR_GENERIC
            ocf_run frobnicate --unset-slave-mode || exit $OCF_ERR_GENERIC

    return $OCF_SUCCESS

A master/slave resource agent may support a multi-master configuration, where there is possibly more than one master at any given time. If that is the case, then the $OCF_RESKEY_CRM_meta_notify_*_uname variables may each contain a space-separated lists of hostnames, rather than a single host name as shown in the example. Under those circumstances the resource agent would have to properly iterate over this list.