Product SiteDocumentation Site

9.5. Effettuare il reload dei servizi dopo una variazione della definizione

The cluster automatically detects changes to the definition of services it manages. However, 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.
Per trarre beneficio da questa abilità il proprio resource agent dovrà
  1. Accept the reload operation and perform any required actions. The steps required here depend completely on your application!

    Esempio 9.10. The DRBD Agent’s Control logic for Supporting the reload Operation

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

  2. Promuovere l'operazione di reload nella sezione actions dei metadata

    Esempio 9.11. La logica di controllo dell'operazione di reload implementata dall'agente DRBD

    <?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. Promuove uno o più paramtri che vengono attivati utilizzando reload.
    Any parameter with the unique set to 0 is eligible to be used in this way.

    Esempio 9.12. Paramtro modificabile utilizzando 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 fields changes.

Nota

I metadata vengono nuovamente letti quando la risorsa viene avviata. Questo potrebbe significare che la risorsa verrà riavviata la prima volta, anche se è stato modificato un parametro con unique=0

Nota

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