Product SiteDocumentation Site

5.6. Instance Attributes

The scripts of some resource classes (LSB not being one of them) can be given parameters which determine how they behave and which instance of a service they control.
If your resource agent supports parameters, you can add them with the crm_resource command. For instance
crm_resource --resource Public-IP --set-parameter ip --property-value
would create an entry in the resource like this
Example 5.5. An example OCF resource with instance attributes

  <primitive id="Public-IP" class="ocf" type="IPaddr" provider="heartbeat">
    <instance_attributes id="params-public-ip">
       <nvpair id="public-ip-addr" name="ip" value=""/>

For an OCF resource, the result would be an environment variable called OCF_RESKEY_ip with a value of
The list of instance attributes supported by an OCF script can be found by calling the resource script with the meta-data command. The output contains an XML description of all the supported attributes, their purpose and default values.
Example 5.6. Displaying the metadata for the Dummy resource agent template
    export OCF_ROOT=/usr/lib/ocf; $OCF_ROOT/resource.d/pacemaker/Dummy meta-data

  <?xml version="1.0"?>
  <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
  <resource-agent name="Dummy" version="0.9">
    <longdesc lang="en-US">
      This is a Dummy Resource Agent. It does absolutely nothing except 
      keep track of whether its running or not.
      Its purpose in life is for testing and to serve as a template for RA writers.
    <shortdesc lang="en-US">Dummy resource agent</shortdesc>
      <parameter name="state" unique="1">
        <longdesc lang="en-US">
          Location to store the resource state in.
        <shortdesc lang="en-US">State file</shortdesc>
        <content type="string" default="/var/run//Dummy-{OCF_RESOURCE_INSTANCE}.state" />
      <parameter name="dummy" unique="0">
        <longdesc lang="en-US"> 
          Dummy attribute that can be changed to cause a reload
        <shortdesc lang="en-US">Dummy attribute that can be changed to cause a reload</shortdesc>
        <content type="string" default="blah" />
      <action name="start"        timeout="90" />
      <action name="stop"         timeout="100" />
      <action name="monitor"      timeout="20" interval="10" depth="0" start-delay="0" />
      <action name="reload"       timeout="90" />
      <action name="migrate_to"   timeout="100" />
      <action name="migrate_from" timeout="90" />
      <action name="meta-data"    timeout="5" />
      <action name="validate-all" timeout="30" />