Product SiteDocumentation Site

9.6. Reloading Services After a Definition Change

The cluster automatically detects changes to the definition of services it manages. The normal response is to stop the service (using the old definition) and start it again (with the new definition). This works well, but some services are smarter and can be told to use a new set of options without restarting.
To take advantage of this capability, the resource agent must:
  1. Accept the reload operation and perform any required actions. The actions here depend completely on your application!

    Example 9.8. The DRBD agent’s logic for supporting reload

    case $1 in
        start)
            drbd_start
            ;;
        stop)
            drbd_stop
            ;;
        reload)
            drbd_reload
            ;;
        monitor)
            drbd_monitor
            ;;
        *)
            drbd_usage
            exit $OCF_ERR_UNIMPLEMENTED
            ;;
    esac
    exit $?

  2. Advertise the reload operation in the actions section of its metadata

    Example 9.9. The DRBD Agent Advertising Support for the reload Operation

    <?xml version="1.0"?>
      <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
      <resource-agent name="drbd">
        <version>1.1</version>
    
        <longdesc>
          Master/Slave OCF Resource Agent for DRBD
        </longdesc>
    
        ...
    
        <actions>
          <action name="start"   timeout="240" />
          <action name="reload"  timeout="240" />
          <action name="promote" timeout="90" />
          <action name="demote"  timeout="90" />
          <action name="notify"  timeout="90" />
          <action name="stop"    timeout="100" />
          <action name="meta-data"    timeout="5" />
          <action name="validate-all" timeout="30" />
        </actions>
      </resource-agent>

  3. Advertise one or more parameters that can take effect using reload.
    Any parameter with the unique set to 0 is eligible to be used in this way.

    Example 9.10. Parameter that can be changed using reload

    <parameter name="drbdconf" unique="0">
        <longdesc>Full path to the drbd.conf file.</longdesc>
        <shortdesc>Path to drbd.conf</shortdesc>
        <content type="string" default="${OCF_RESKEY_drbdconf_default}"/>
    </parameter>

Once these requirements are satisfied, the cluster will automatically know to reload the resource (instead of restarting) when a non-unique field changes.

Note

Metadata will not be re-read unless the resource needs to be started. This may mean that the resource will be restarted the first time, even though you changed a parameter with unique=0.

Note

If both a unique and non-unique field are changed simultaneously, the resource will still be restarted.