Product SiteDocumentation Site

5.4.3. Resource Instance Attributes

The resource agents of some resource classes (lsb, systemd and upstart not among 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 example,
# crm_resource --resource Public-IP --set-parameter ip --parameter-value
would create an entry in the resource like this:

Example 5.4. 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 resource agent can be found by calling the resource agent with the meta-data command. The output contains an XML description of all the supported attributes, their purpose and default values.

Example 5.5. 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="1.0">

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.

NB: Please pay attention to the timeouts specified in the actions
section below. They should be meaningful for the kind of resource
the agent manages. They should be the minimum advised timeouts,
but they shouldn't/cannot cover _all_ possible resource
instances. So, try to be neither overly generous nor too stingy,
but moderate. The minimum timeouts should never be below 10 seconds.
<shortdesc>Example stateless resource agent</shortdesc>

<parameter name="state" unique="1">
Location to store the resource state in.
<shortdesc>State file</shortdesc>
<content type="string" default="/var/run/Dummy-default.state" />

<parameter name="fake" unique="0">
Fake attribute that can be changed to cause a reload
<shortdesc>Fake attribute that can be changed to cause a reload</shortdesc>
<content type="string" default="dummy" />

<parameter name="op_sleep" unique="1">
Number of seconds to sleep during operations.  This can be used to test how
the cluster reacts to operation timeouts.
<shortdesc>Operation sleep duration in seconds.</shortdesc>
<content type="string" default="0" />


<action name="start"        timeout="20" />
<action name="stop"         timeout="20" />
<action name="monitor"      timeout="20" interval="10" depth="0"/>
<action name="reload"       timeout="20" />
<action name="migrate_to"   timeout="20" />
<action name="migrate_from" timeout="20" />
<action name="validate-all" timeout="20" />
<action name="meta-data"    timeout="5" />