diff --git a/doc/Pacemaker_Explained/en-US/Ch-Resources.txt b/doc/Pacemaker_Explained/en-US/Ch-Resources.txt
index 7b49af0433..9453954d8e 100644
--- a/doc/Pacemaker_Explained/en-US/Ch-Resources.txt
+++ b/doc/Pacemaker_Explained/en-US/Ch-Resources.txt
@@ -1,835 +1,835 @@
 = Cluster Resources =
 
 == What is a Cluster Resource? ==
 
 indexterm:[Resource]
 
 A resource is a service made highly available by a cluster.
 The simplest type of resource, a 'primitive' resource, is described
 in this chapter. More complex forms, such as groups and clones,
 are described in later chapters.
 
 Every primitive resource has a 'resource agent'. A resource agent is an
 external program that abstracts the service it provides and present a
 consistent view to the cluster.
 
 This allows the cluster to be agnostic about the resources it manages.
 The cluster doesn't need to understand how the resource works because
 it relies on the resource agent to do the right thing when given a
 `start`, `stop` or `monitor` command. For this reason, it is crucial that
 resource agents are well-tested.
 
 Typically, resource agents come in the form of shell scripts. However,
 they can be written using any technology (such as C, Python or Perl)
 that the author is comfortable with.
 
 [[s-resource-supported]]
 == Resource Classes ==
 
 indexterm:[Resource,class]
 
 Pacemaker supports several classes of agents:
 
 * OCF
 * LSB
 * Upstart
 * Systemd
 * Service
 * Fencing
 * Nagios Plugins
 
 === Open Cluster Framework ===
 
 indexterm:[Resource,OCF]
 indexterm:[OCF,Resources]
 indexterm:[Open Cluster Framework,Resources]
 
 The OCF standard
 footnote:[See
 http://www.opencf.org/cgi-bin/viewcvs.cgi/specs/ra/resource-agent-api.txt?rev=HEAD
  -- at least as it relates to resource agents.  The Pacemaker implementation has
 been somewhat extended from the OCF specs, but none of those changes are
 incompatible with the original OCF specification.]
 is basically an extension of the Linux Standard Base conventions for
 init scripts to:
 
 * support parameters,
 * make them self-describing, and
 * make them extensible
 
 OCF specs have strict definitions of the exit codes that actions must return.
 footnote:[
 The resource-agents source code includes the `ocf-tester` script, which
 can be useful in this regard.
 ]
 
 The cluster follows these specifications exactly, and giving the wrong
 exit code will cause the cluster to behave in ways you will likely
 find puzzling and annoying.  In particular, the cluster needs to
 distinguish a completely stopped resource from one which is in some
 erroneous and indeterminate state.
 
 Parameters are passed to the resource agent as environment variables, with the
 special prefix +OCF_RESKEY_+.  So, a parameter which the user thinks
 of as +ip+ will be passed to the resource agent as +OCF_RESKEY_ip+.  The
 number and purpose of the parameters is left to the resource agent; however,
 the resource agent should use the `meta-data` command to advertise any that it
 supports.
 
 The OCF class is the most preferred as it is an industry standard,
 highly flexible (allowing parameters to be passed to agents in a
 non-positional manner) and self-describing.
 
 For more information, see the
 http://www.linux-ha.org/wiki/OCF_Resource_Agents[reference] and
 <<ap-ocf>>.
 
 === Linux Standard Base ===
 indexterm:[Resource,LSB]
 indexterm:[LSB,Resources]
 indexterm:[Linux Standard Base,Resources]
 
 LSB resource agents are those found in +/etc/init.d+.
 
 Generally, they are provided by the OS distribution and, in order to be used
 with the cluster, they must conform to the LSB Spec.
 footnote:[
 See
 http://refspecs.linux-foundation.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
 for the LSB Spec as it relates to init scripts.
 ]
 
 [WARNING]
 ====
 Many distributions claim LSB compliance but ship with broken init
 scripts.  For details on how to check whether your init script is
 LSB-compatible, see <<ap-lsb>>. Common problematic violations of
 the LSB standard include:
 
 * Not implementing the status operation at all
 * Not observing the correct exit status codes for `start/stop/status` actions
 * Starting a started resource returns an error
 * Stopping a stopped resource returns an error
 ====
 
 [IMPORTANT]
 ====
 Remember to make sure the computer is _not_ configured to start any
 services at boot time -- that should be controlled by the cluster.
 ====
 
 === Systemd ===
 indexterm:[Resource,Systemd]
 indexterm:[Systemd,Resources]
 
 Some newer distributions have replaced the old
 http://en.wikipedia.org/wiki/Init#SysV-style["SysV"] style of
 initialization daemons and scripts with an alternative called
 http://www.freedesktop.org/wiki/Software/systemd[Systemd].
 
 Pacemaker is able to manage these services _if they are present_.
 
 Instead of init scripts, systemd has 'unit files'.  Generally, the
 services (unit files) are provided by the OS distribution, but there
 are online guides for converting from init scripts.
 footnote:[For example,
 http://0pointer.de/blog/projects/systemd-for-admins-3.html]
 
 [IMPORTANT]
 ====
 Remember to make sure the computer is _not_ configured to start any
 services at boot time -- that should be controlled by the cluster.
 ====
 
 === Upstart ===
 indexterm:[Resource,Upstart]
 indexterm:[Upstart,Resources]
 
 Some newer distributions have replaced the old
 http://en.wikipedia.org/wiki/Init#SysV-style["SysV"] style of
 initialization daemons (and scripts) with an alternative called
 http://upstart.ubuntu.com/[Upstart].
 
 Pacemaker is able to manage these services _if they are present_.
 
 Instead of init scripts, upstart has 'jobs'.  Generally, the
 services (jobs) are provided by the OS distribution.
 
 [IMPORTANT]
 ====
 Remember to make sure the computer is _not_ configured to start any
 services at boot time -- that should be controlled by the cluster.
 ====
 
 === System Services ===
 indexterm:[Resource,System Services]
 indexterm:[System Service,Resources]
 
 Since there are various types of system services (+systemd+,
 +upstart+, and +lsb+), Pacemaker supports a special +service+ alias which
 intelligently figures out which one applies to a given cluster node.
 
 This is particularly useful when the cluster contains a mix of
 +systemd+, +upstart+, and +lsb+.
 
 In order, Pacemaker will try to find the named service as:
 
 . an LSB init script
 . a Systemd unit file
 . an Upstart job
 
 === STONITH ===
 indexterm:[Resource,STONITH]
 indexterm:[STONITH,Resources]
 
 The STONITH class is used exclusively for fencing-related resources.  This is
 discussed later in <<ch-stonith>>.
 
 === Nagios Plugins ===
 indexterm:[Resource,Nagios Plugins]
 indexterm:[Nagios Plugins,Resources]
 
 Nagios Plugins
 footnote:[The project has two independent forks, hosted at
 https://www.nagios-plugins.org/ and https://www.monitoring-plugins.org/. Output
 from both projects' plugins is similar, so plugins from either project can be
 used with pacemaker.]
 allow us to monitor services on remote hosts.
 
 Pacemaker is able to do remote monitoring with the plugins _if they are
 present_.
 
 A common use case is to configure them as resources belonging to a resource
 container (usually a virtual machine), and the container will be restarted
 if any of them has failed. Another use is to configure them as ordinary
 resources to be used for monitoring hosts or services via the network.
 
 The supported parameters are same as the long options of the plugin.
 
 [[primitive-resource]]
 == Resource Properties ==
 
 These values tell the cluster which resource agent to use for the resource,
 where to find that resource agent and what standards it conforms to.
 
 .Properties of a Primitive Resource
 [width="95%",cols="1m,6<",options="header",align="center"]
 |=========================================================
 
 |Field
 |Description
 
 |id
 |Your name for the resource
  indexterm:[id,Resource]
  indexterm:[Resource,Property,id]
 
 |class
 
 |The standard the resource agent conforms to. Allowed values:
 +lsb+, +nagios+, +ocf+, +service+, +stonith+, +systemd+, +upstart+
  indexterm:[class,Resource]
  indexterm:[Resource,Property,class]
 
 |type
 |The name of the Resource Agent you wish to use. E.g. +IPaddr+ or +Filesystem+
  indexterm:[type,Resource]
  indexterm:[Resource,Property,type]
 
 |provider
 |The OCF spec allows multiple vendors to supply the same
  resource agent. To use the OCF resource agents supplied by
  the Heartbeat project, you would specify +heartbeat+ here.
  indexterm:[provider,Resource]
  indexterm:[Resource,Property,provider]
 
 |=========================================================
 
 The XML definition of a resource can be queried with the `crm_resource` tool.
 For example:
 
 ----
 # crm_resource --resource Email --query-xml
 ----
 
 might produce:
 
 .A system resource definition
 =====
 [source,XML]
 <primitive id="Email" class="service" type="exim"/>
 =====
 
 [NOTE]
 =====
 One of the main drawbacks to system services (LSB, systemd or
 Upstart) resources is that they do not allow any parameters!
 =====
 
 ////
 See https://tools.ietf.org/html/rfc5737 for choice of example IP address
 ////
 
 .An OCF resource definition
 =====
 [source,XML]
 -------
 <primitive id="Public-IP" class="ocf" type="IPaddr" provider="heartbeat">
    <instance_attributes id="Public-IP-params">
       <nvpair id="Public-IP-ip" name="ip" value="192.0.2.2"/>
    </instance_attributes>
 </primitive>
 -------
 =====
 
 [[s-resource-options]]
 == Resource Options ==
 
 Resources have two types of options: 'meta-attributes' and 'instance attributes'.
 Meta-attributes apply to any type of resource, while instance attributes
 are specific to each resource agent.
 
 === Resource Meta-Attributes ===
 
 Meta-attributes are used by the cluster to decide how a resource should
 behave and can be easily set using the `--meta` option of the
 `crm_resource` command.
 
 .Meta-attributes of a Primitive Resource
 [width="95%",cols="2m,2,5<a",options="header",align="center"]
 |=========================================================
 
 |Field
 |Default
 |Description
 
 |priority
 |0
 |If not all resources can be active, the cluster will stop lower
 priority resources in order to keep higher priority ones active.
 indexterm:[priority,Resource Option]
 indexterm:[Resource,Option,priority]
 
 |target-role
 |started
 |What state should the cluster attempt to keep this resource in? Allowed values:
 
 * +stopped:+ Force the resource to be stopped
 * +started:+ Allow the resource to be started (In the case of
   <<s-resource-multistate,multi-state>> resources, they will not be promoted to
   master)
 * +master:+ Allow the resource to be started and, if appropriate, promoted
 indexterm:[target-role,Resource Option]
 indexterm:[Resource,Option,target-role]
 
 |is-managed
 |TRUE
 |Is the cluster allowed to start and stop the resource?  Allowed
  values: +true+, +false+
  indexterm:[is-managed,Resource Option]
  indexterm:[Resource,Option,is-managed]
 
 |resource-stickiness
 |value of +resource-stickiness+ in the +rsc_defaults+ section
 |How much does the resource prefer to stay where it is?
  indexterm:[resource-stickiness,Resource Option]
  indexterm:[Resource,Option,resource-stickiness]
 
 |requires
 |fencing (unless +stonith-enabled+ is +false+ or +class+ is
 +stonith+, in which case it defaults to quorum)
 |Conditions under which the resource can be started ('Since 1.1.8')
 Allowed values:
 
 * +nothing:+ can always be started
 * +quorum:+ The cluster can only start this resource if a majority of
   the configured nodes are active
 * +fencing:+ The cluster can only start this resource if a majority
   of the configured nodes are active _and_ any failed or unknown nodes
   have been powered off
 * +unfencing:+ The cluster can only start this resource if a majority
   of the configured nodes are active _and_ any failed or unknown nodes
   have been powered off _and_ only on nodes that have been 'unfenced'
 
 indexterm:[requires,Resource Option]
 indexterm:[Resource,Option,requires]
 
 |migration-threshold
 |INFINITY
 |How many failures may occur for this resource on a node, before this
  node is marked ineligible to host this resource. A value of INFINITY
  indicates that this feature is disabled.
  indexterm:[migration-threshold,Resource Option]
  indexterm:[Resource,Option,migration-threshold]
 
 |failure-timeout
 |0
 |How many seconds to wait before acting as if the failure had not
  occurred, and potentially allowing the resource back to the node on
  which it failed. A value of 0 indicates that this feature is disabled.
  indexterm:[failure-timeout,Resource Option]
  indexterm:[Resource,Option,failure-timeout]
 
 |multiple-active
 |stop_start
 |What should the cluster do if it ever finds the resource active on
  more than one node? Allowed values:
 
 * +block:+ mark the resource as unmanaged
 * +stop_only:+ stop all active instances and leave them that way
 * +stop_start:+ stop all active instances and start the resource in
   one location only
 
 indexterm:[multiple-active,Resource Option]
 indexterm:[Resource,Option,multiple-active]
 
 |remote-node
 |
 |The name of the remote-node this resource defines.  This both enables the
 resource as a remote-node and defines the unique name used to identify the
 remote-node. If no other parameters are set, this value will also be assumed as
 the hostname to connect to at the port specified by +remote-port+. +WARNING:+
 This value cannot overlap with any resource or node IDs. If not specified,
 this feature is disabled.
 
 |remote-port
 |3121
 |Port to use for the guest connection to pacemaker_remote
 
 |remote-addr
 |value of +remote-node+
 |The IP address or hostname to connect to if remote-node's name is not the
 hostname of the guest.
 
 |+remote-connect-timeout+
 |60s
 |How long before a pending guest connection will time out.
 
 |=========================================================
 
 [NOTE]
 ====
 Support for remote nodes was added in pacemaker 1.1.10. If you are using an
 earlier version, options related to remote nodes will not be available.
 ====
 
 As an example of setting resource options, if you performed the following
 commands on an LSB Email resource:
 
 -------
 # crm_resource --meta --resource Email --set-parameter priority --parameter-value 100
 # crm_resource -m -r Email -p multiple-active -v block
 -------
 
 the resulting resource definition might be:
 
 .An LSB resource with cluster options
 =====
 [source,XML]
 -------
 <primitive id="Email" class="lsb" type="exim">
   <meta_attributes id="Email-meta_attributes">
     <nvpair id="Email-meta_attributes-priority" name="priority" value="100"/>
     <nvpair id="Email-meta_attributes-multiple-active" name="multiple-active" value="block"/>
   </meta_attributes>
 </primitive>
 -------
 =====
 
 [[s-resource-defaults]]
 === Setting Global Defaults for Resource Meta-Attributes ===
 
 To set a default value for a resource option, add it to the
 +rsc_defaults+ section with `crm_attribute`. For example,
 
 ----
 # crm_attribute --type rsc_defaults --name is-managed --update false
 ----
 
 would prevent the cluster from starting or stopping any of the
 resources in the configuration (unless of course the individual
 resources were specifically enabled by having their +is-managed+ set to
 +true+).
 
 === 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 192.0.2.2
 ----
 
 would create an entry in the resource like this:
 
 .An example OCF resource with instance attributes
 =====
 [source,XML]
 -------
 <primitive id="Public-IP" class="ocf" type="IPaddr" provider="heartbeat">
    <instance_attributes id="params-public-ip">
       <nvpair id="public-ip-addr" name="ip" value="192.0.2.2"/>
    </instance_attributes>
 </primitive>
 -------
 =====
 
 For an OCF resource, the result would be an environment variable
 called +OCF_RESKEY_ip+ with a value of +192.0.2.2+.
 
 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.
 
 .Displaying the metadata for the Dummy resource agent template
 =====
 ----
 # export OCF_ROOT=/usr/lib/ocf
 # $OCF_ROOT/resource.d/pacemaker/Dummy meta-data
 ----
 [source,XML]
 -------
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
 <resource-agent name="Dummy" version="1.0">
 <version>1.0</version>
 
 <longdesc lang="en">
 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.
 </longdesc>
 <shortdesc lang="en">Example stateless resource agent</shortdesc>
 
 <parameters>
 <parameter name="state" unique="1">
 <longdesc lang="en">
 Location to store the resource state in.
 </longdesc>
 <shortdesc lang="en">State file</shortdesc>
-<content type="string" default="/var/run//Dummy-default.state" />
+<content type="string" default="/var/run/Dummy-default.state" />
 </parameter>
 
 <parameter name="fake" unique="0">
 <longdesc lang="en">
 Fake attribute that can be changed to cause a reload
 </longdesc>
 <shortdesc lang="en">Fake attribute that can be changed to cause a reload</shortdesc>
 <content type="string" default="dummy" />
 </parameter>
 
 <parameter name="op_sleep" unique="1">
 <longdesc lang="en">
 Number of seconds to sleep during operations.  This can be used to test how
 the cluster reacts to operation timeouts.
 </longdesc>
 <shortdesc lang="en">Operation sleep duration in seconds.</shortdesc>
 <content type="string" default="0" />
 </parameter>
 
 </parameters>
 
 <actions>
 <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" />
 </actions>
 </resource-agent>
 -------
 =====
 
 == Resource Operations ==
 
 indexterm:[Resource,Action]
 
 'Operations' are actions the cluster can perform on a resource by calling the
 resource agent. Resource agents must support certain common operations such as
 start, stop and monitor, and may implement any others.
 
 Some operations are generated by the cluster itself, for example, stopping and
 starting resources as needed.
 
 You can configure operations in the cluster configuration. As an example, by
 default the cluster will 'not' ensure your resources stay healthy once they are
 started. footnote:[Currently, anyway. Automatic monitoring operations may be
 added in a future version of Pacemaker.] To instruct the cluster to do this,
 you need to add a +monitor+ operation to the resource's definition.
 
 .An OCF resource with a recurring health check
 =====
 [source,XML]
 -------
 <primitive id="Public-IP" class="ocf" type="IPaddr" provider="heartbeat">
   <operations>
      <op id="public-ip-check" name="monitor" interval="60s"/>
   </operations>
   <instance_attributes id="params-public-ip">
      <nvpair id="public-ip-addr" name="ip" value="192.0.2.2"/>
   </instance_attributes>
 </primitive>
 -------
 =====
 
 .Properties of an Operation
 [width="95%",cols="2m,3,6<a",options="header",align="center"]
 |=========================================================
 
 |Field
 |Default
 |Description
 
 |id
 |
 |A unique name for the operation.
  indexterm:[id,Action Property]
  indexterm:[Action,Property,id]
 
 |name
 |
 |The action to perform. This can be any action supported by the agent; common
  values include +monitor+, +start+, and +stop+.
  indexterm:[name,Action Property]
  indexterm:[Action,Property,name]
 
 |interval
 |0
 |How frequently (in seconds) to perform the operation. A value of 0 means never.
  A positive value defines a 'recurring action', which is typically used with
  <<s-resource-monitoring,monitor>>.
  indexterm:[interval,Action Property]
  indexterm:[Action,Property,interval]
 
 |timeout
 |
 |How long to wait before declaring the action has failed
  indexterm:[timeout,Action Property]
  indexterm:[Action,Property,timeout]
 
 |on-fail
 |restart '(except for stop operations, which default to' fence 'when
  STONITH is enabled and' block 'otherwise)'
 |The action to take if this action ever fails. Allowed values:
 
 * +ignore:+ Pretend the resource did not fail.
 * +block:+ Don't perform any further operations on the resource.
 * +stop:+ Stop the resource and do not start it elsewhere.
 * +restart:+ Stop the resource and start it again (possibly on a different node).
 * +fence:+ STONITH the node on which the resource failed.
 * +standby:+ Move _all_ resources away from the node on which the resource failed.
 
 indexterm:[on-fail,Action Property]
 indexterm:[Action,Property,on-fail]
 
 |enabled
 |TRUE
 |If +false+, ignore this operation definition.  This is typically used to pause
  a particular recurring monitor operation;  for instance, it can complement
  the respective resource being unmanaged (+is-managed=false+), as this alone
  will <<s-monitoring-unmanaged,not block any configured monitoring>>.
  Disabling the operation does not suppress all actions of the given type.
  Allowed values: +true+, +false+.
  indexterm:[enabled,Action Property]
  indexterm:[Action,Property,enabled]
 
 |record-pending
 |
 |If +true+, the intention to perform the operation is recorded so that
  GUIs and CLI tools can indicate that an operation is in progress.
  This is best set as an 'operation default' (see next section).
  Allowed values: +true+, +false+.
  indexterm:[enabled,Action Property]
  indexterm:[Action,Property,enabled]
 
 |role
 |
 |Run the operation only on node(s) that the cluster thinks should be in
  the specified role. This only makes sense for recurring monitor operations.
  Allowed (case-sensitive) values: +Stopped+, +Started+, and in the
  case of <<s-resource-multistate,multi-state>> resources, +Slave+ and +Master+.
  indexterm:[role,Action Property]
  indexterm:[Action,Property,role]
 
 |=========================================================
 
 [[s-resource-monitoring]]
 === Monitoring Resources for Failure ===
 
 When Pacemaker first starts a resource, it runs one-time monitor operations
 (referred to as 'probes') to ensure the resource is running where it's
 supposed to be, and not running where it's not supposed to be. (This behavior
 can be affected by the +resource-discovery+ location constraint property.)
 
 Other than those initial probes, Pacemaker will not (by default) check that
 the resource continues to stay healthy. As in the example above, you must
 configure monitor operations explicitly to perform these checks.
 
 By default, a monitor operation will ensure that the resource is running
 where it is supposed to. The +target-role+ property can be used for further
 checking.
 
 For example, if a resource has one monitor operation with
 +interval=10 role=Started+ and a second monitor operation with
 +interval=11 role=Stopped+, the cluster will run the first monitor on any nodes
 it thinks 'should' be running the resource, and the second monitor on any nodes
 that it thinks 'should not' be running the resource (for the truly paranoid,
 who want to know when an administrator manually starts a service by mistake).
 
 [[s-monitoring-unmanaged]]
 === Monitoring Resources When Administration is Disabled ===
 
 Recurring monitor operations behave differently under various administrative
 settings:
 
 * When a resource is unmanaged (by setting +is-managed=false+): No monitors
   will be stopped.
 +
 If the unmanaged resource is stopped on a node where the cluster thinks it
 should be running, the cluster will detect and report that it is not, but it
 will not consider the monitor failed, and will not try to start the resource
 until it is managed again.
 +
 Starting the unmanaged resource on a different node is strongly discouraged
 and will at least cause the cluster to consider the resource failed, and
 may require the resource's +target-role+ to be set to +Stopped+ then +Started+
 to be recovered.
 
 * When a node is put into standby: All resources will be moved away from the
   node, and all monitor operations will be stopped on the node, except those
   with +role=Stopped+. Monitor operations with +role=Stopped+ will be started
   on the node if appropriate.
 
 * When the cluster is put into maintenance mode: All resources will be marked
   as unmanaged. All monitor operations will be stopped, except those with
   +role=Stopped+. As with single unmanaged resources, starting a resource
   on a node other than where the cluster expects it to be will cause problems.
 
 [[s-operation-defaults]]
 === Setting Global Defaults for Operations ===
 
 You can change the global default values for operation properties
 in a given cluster. These are defined in an +op_defaults+ section 
 of the CIB's +configuration+ section, and can be set with `crm_attribute`.
 For example,
 
 ----
 # crm_attribute --type op_defaults --name timeout --update 20s
 ----
 
 would default each operation's +timeout+ to 20 seconds.  If an
 operation's definition also includes a value for +timeout+, then that
 value would be used for that operation instead.
 
 === When Implicit Operations Take a Long Time ===
 
 The cluster will always perform a number of implicit operations: +start+,
 +stop+ and a non-recurring +monitor+ operation used at startup to check
 whether the resource is already active.  If one of these is taking too long,
 then you can create an entry for them and specify a longer timeout.
 
 .An OCF resource with custom timeouts for its implicit actions
 =====
 [source,XML]
 -------
 <primitive id="Public-IP" class="ocf" type="IPaddr" provider="heartbeat">
   <operations>
      <op id="public-ip-startup" name="monitor" interval="0" timeout="90s"/>
      <op id="public-ip-start" name="start" interval="0" timeout="180s"/>
      <op id="public-ip-stop" name="stop" interval="0" timeout="15min"/>
   </operations>
   <instance_attributes id="params-public-ip">
      <nvpair id="public-ip-addr" name="ip" value="192.0.2.2"/>
   </instance_attributes>
 </primitive>
 -------
 =====
 
 === Multiple Monitor Operations ===
 
 Provided no two operations (for a single resource) have the same name
 and interval, you can have as many monitor operations as you like.  In
 this way, you can do a superficial health check every minute and
 progressively more intense ones at higher intervals.
 
 To tell the resource agent what kind of check to perform, you need to
 provide each monitor with a different value for a common parameter.
 The OCF standard creates a special parameter called +OCF_CHECK_LEVEL+
 for this purpose and dictates that it is "made available to the
 resource agent without the normal +OCF_RESKEY+ prefix".
 
 Whatever name you choose, you can specify it by adding an
 +instance_attributes+ block to the +op+ tag. It is up to each
 resource agent to look for the parameter and decide how to use it.
 
 .An OCF resource with two recurring health checks, performing different levels of checks specified via +OCF_CHECK_LEVEL+.
 =====
 [source,XML]
 -------
 <primitive id="Public-IP" class="ocf" type="IPaddr" provider="heartbeat">
    <operations>
       <op id="public-ip-health-60" name="monitor" interval="60">
          <instance_attributes id="params-public-ip-depth-60">
             <nvpair id="public-ip-depth-60" name="OCF_CHECK_LEVEL" value="10"/>
          </instance_attributes>
       </op>
       <op id="public-ip-health-300" name="monitor" interval="300">
          <instance_attributes id="params-public-ip-depth-300">
             <nvpair id="public-ip-depth-300" name="OCF_CHECK_LEVEL" value="20"/>
        </instance_attributes>
      </op>
    </operations>
    <instance_attributes id="params-public-ip">
        <nvpair id="public-ip-level" name="ip" value="192.0.2.2"/>
    </instance_attributes>
 </primitive>
 -------
 =====
 
 === Disabling a Monitor Operation ===
 
 The easiest way to stop a recurring monitor is to just delete it.
 However, there can be times when you only want to disable it
 temporarily.  In such cases, simply add +enabled="false"+ to the
 operation's definition.
 
 .Example of an OCF resource with a disabled health check
 =====
 [source,XML]
 -------
 <primitive id="Public-IP" class="ocf" type="IPaddr" provider="heartbeat">
    <operations>
       <op id="public-ip-check" name="monitor" interval="60s" enabled="false"/>
    </operations>
    <instance_attributes id="params-public-ip">
       <nvpair id="public-ip-addr" name="ip" value="192.0.2.2"/>
    </instance_attributes>
 </primitive>
 -------
 =====
 
 This can be achieved from the command line by executing:
 
 ----
 # cibadmin --modify --xml-text '<op id="public-ip-check" enabled="false"/>'
 ----
 
 Once you've done whatever you needed to do, you can then re-enable it with
 ----
 # cibadmin --modify --xml-text '<op id="public-ip-check" enabled="true"/>'
 ----
diff --git a/extra/resources/ClusterMon b/extra/resources/ClusterMon
index 884910fac5..8efdf1beae 100644
--- a/extra/resources/ClusterMon
+++ b/extra/resources/ClusterMon
@@ -1,267 +1,267 @@
-#!/bin/sh
+#!/bin/bash
 #
 #
 #	ClusterMon OCF RA.
 #	Starts crm_mon in background which logs cluster status as
 #	html to the specified file.
 #
 # Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Br�e
 #                    All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of version 2 of the GNU General Public License as
 # published by the Free Software Foundation.
 #
 # This program is distributed in the hope that it would be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
 # Further, this software is distributed without any warranty that it is
 # free of the rightful claim of any third person regarding infringement
 # or the like.  Any license provided herein, whether implied or
 # otherwise, applies only to this software file.  Patent licenses, if
 # any, provided herein do not apply to combinations of this program with
 # other software, or any other product whatsoever.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write the Free Software Foundation,
 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 #
 # OCF instance parameters:
 #	OCF_RESKEY_user
 #	OCF_RESKEY_pidfile
 #	OCF_RESKEY_update
 #	OCF_RESKEY_extra_options
 #	OCF_RESKEY_htmlfile
 
 #######################################################################
 # Initialization:
 : ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
 : ${__OCF_ACTION=$1}
 
 #######################################################################
 
 meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
 <resource-agent name="ClusterMon">
 <version>1.0</version>
 
 <longdesc lang="en">
 This is a ClusterMon Resource Agent.
 It outputs current cluster status to the html.
 </longdesc>
 <shortdesc lang="en">Runs crm_mon in the background, recording the cluster status to an HTML file</shortdesc>
 
 <parameters>
 
 <parameter name="user" unique="0">
 <longdesc lang="en">
 The user we want to run crm_mon as
 </longdesc>
 <shortdesc lang="en">The user we want to run crm_mon as</shortdesc>
 <content type="string" default="root" />
 </parameter>
 
 <parameter name="update" unique="0">
 <longdesc lang="en">
 How frequently should we update the cluster status
 </longdesc>
 <shortdesc lang="en">Update interval</shortdesc>
 <content type="integer" default="15" />
 </parameter>
 
 <parameter name="extra_options" unique="0">
 <longdesc lang="en">
 Additional options to pass to crm_mon.  Eg. -n -r
 </longdesc>
 <shortdesc lang="en">Extra options</shortdesc>
 <content type="string" default="" />
 </parameter>
 
 <parameter name="pidfile" unique="1">
 <longdesc lang="en">
 PID file location to ensure only one instance is running
 </longdesc>
 <shortdesc lang="en">PID file</shortdesc>
 <content type="string" default="/tmp/ClusterMon_${OCF_RESOURCE_INSTANCE}.pid" />
 </parameter>
 
 <parameter name="htmlfile" unique="1" required="0">
 <longdesc lang="en">
 Location to write HTML output to.
 </longdesc>
 <shortdesc lang="en">HTML output</shortdesc>
 <content type="string" default="/tmp/ClusterMon_${OCF_RESOURCE_INSTANCE}.html" />
 </parameter>
 </parameters>
 
 <actions>
 <action name="start"   timeout="20" />
 <action name="stop"    timeout="20" />
 <action name="monitor" depth="0"  timeout="20" interval="10" />
 <action name="meta-data"  timeout="5" />
 <action name="validate-all"  timeout="30" />
 </actions>
 </resource-agent>
 END
 }
 
 #######################################################################
 
 ClusterMon_usage() {
 	cat <<END
 usage: $0 {start|stop|monitor|validate-all|meta-data}
 
 Expects to have a fully populated OCF RA-compliant environment set.
 END
 }
 
 ClusterMon_exit() {
 	if [ $1 != 0 ]; then
 		exit $OCF_ERR_GENERIC
 	else
 		exit $OCF_SUCCESS
 	fi
 }
 
 ClusterMon_start() {
     cmd_prefix=""
     cmd_suffix=""
     if [ ! -z $OCF_RESKEY_user ]; then
 	su - $OCF_RESKEY_user -c "${HA_SBIN_DIR}/crm_mon -p $OCF_RESKEY_pidfile -d -i $OCF_RESKEY_update $OCF_RESKEY_extra_options -h $OCF_RESKEY_htmlfile"
     else
 	${HA_SBIN_DIR}/crm_mon -p $OCF_RESKEY_pidfile -d -i $OCF_RESKEY_update $OCF_RESKEY_extra_options -h $OCF_RESKEY_htmlfile
     fi
     ClusterMon_exit $?
 }
 
 ClusterMon_stop() {
     if [ -f $OCF_RESKEY_pidfile ]; then
 	pid=`cat $OCF_RESKEY_pidfile`
 	if [ ! -z $pid ]; then
 	    kill -s 9 $pid
 	    rm -f $OCF_RESKEY_pidfile
 	fi
     fi
     ClusterMon_exit 0
 }
 
 ClusterMon_monitor() {
     if [ -f $OCF_RESKEY_pidfile ]; then
 	pid=`cat $OCF_RESKEY_pidfile`
 	if [ ! -z $pid ]; then
 	    kill -s 0 $pid >/dev/null 2>&1; rc=$?
 	    case $rc in
 		0) exit $OCF_SUCCESS;;
 		1) exit $OCF_NOT_RUNNING;;
 		*) exit $OCF_ERR_GENERIC;;
 	    esac
 	fi
     fi
     exit $OCF_NOT_RUNNING
 }
 
 CheckOptions() {
 while getopts Vi:nrh:cdp: OPTION
 do
     case $OPTION in
     V|n|r|c|d);;
     i)	ocf_log warn "You should not have specified the -i option, since OCF_RESKEY_update is set already!";;
     h)	ocf_log warn "You should not have specified the -h option, since OCF_RESKEY_htmlfile is set already!";;
     p)	ocf_log warn "You should not have specified the -p option, since OCF_RESKEY_pidfile is set already!";;
     *)  return $OCF_ERR_ARGS;;
     esac
 done		
 
 if [ $? -ne 0 ]; then
     return $OCF_ERR_ARGS
 fi
 
 # We should have eaten all options at this stage
 shift $(($OPTIND -1))
 if [ $# -gt 0 ]; then
     false
 else
     true
 fi
 }
 
 ClusterMon_validate() {
 # Existence of the user
     if [ ! -z $OCF_RESKEY_user ]; then
 	getent passwd "$OCF_RESKEY_user" >/dev/null
 	if [ $? -eq 0 ]; then
 	    : Yes, user exists. We can further check his permission on crm_mon if necessary
 	else
 	    ocf_log err "The user $OCF_RESKEY_user does not exist!"
 	    exit $OCF_ERR_ARGS
 	fi
     fi
 
 # Pidfile better be an absolute path
     case $OCF_RESKEY_pidfile in
 	/*) ;;
 	*) ocf_log warn "You should have pidfile($OCF_RESKEY_pidfile) of absolute path!" ;;
     esac
 
 # Check the update interval
     if ocf_is_decimal "$OCF_RESKEY_update" && [ $OCF_RESKEY_update -gt 0 ]; then
 	:
     else
 	ocf_log err "Invalid update interval $OCF_RESKEY_update. It should be positive integer!"
 	exit $OCF_ERR_ARGS
     fi
 
     if CheckOptions $OCF_RESKEY_extra_options; then
 	:
     else
 	ocf_log err "Invalid options $OCF_RESKEY_extra_options!"
 	exit $OCF_ERR_ARGS
     fi
 
 # Htmlfile better be an absolute path
     case $OCF_RESKEY_htmlfile in
 	/*) ;;
 	*) ocf_log warn "You should have htmlfile($OCF_RESKEY_htmlfile) of absolute path!" ;;
     esac
 
      
     echo "Validate OK"
     return $OCF_SUCCESS
 }
 
 if [ $# -ne 1 ]; then
     ClusterMon_usage
     exit $OCF_ERR_ARGS
 fi
 
 : ${OCF_RESKEY_update:="15000"}
 : ${OCF_RESKEY_pidfile:="/tmp/ClusterMon_${OCF_RESOURCE_INSTANCE}.pid"}
 : ${OCF_RESKEY_htmlfile:="/tmp/ClusterMon_${OCF_RESOURCE_INSTANCE}.html"}
 
 OCF_RESKEY_update=`expr $OCF_RESKEY_update / 1000`
 
 case $__OCF_ACTION in
 meta-data)	meta_data
 		exit $OCF_SUCCESS
 		;;
 start)		ClusterMon_start
 		;;
 stop)		ClusterMon_stop
 		;;
 monitor)	ClusterMon_monitor
 		;;
 validate-all)	ClusterMon_validate
 		;;
 usage|help)	ClusterMon_usage
 		exit $OCF_SUCCESS
 		;;
 *)		ClusterMon_usage
 		exit $OCF_ERR_UNIMPLEMENTED
 		;;
 esac
 
 exit $?
diff --git a/extra/resources/Dummy b/extra/resources/Dummy
index c24e7aa237..5a34ff031d 100644
--- a/extra/resources/Dummy
+++ b/extra/resources/Dummy
@@ -1,228 +1,222 @@
 #!/bin/sh
 #
 #
 #	Dummy OCF RA. Does nothing but wait a few seconds, can be
 #	configured to fail occassionally.
 #
 # Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Br�e
 #                    All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of version 2 of the GNU General Public License as
 # published by the Free Software Foundation.
 #
 # This program is distributed in the hope that it would be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
 # Further, this software is distributed without any warranty that it is
 # free of the rightful claim of any third person regarding infringement
 # or the like.  Any license provided herein, whether implied or
 # otherwise, applies only to this software file.  Patent licenses, if
 # any, provided herein do not apply to combinations of this program with
 # other software, or any other product whatsoever.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write the Free Software Foundation,
 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 #
 
 #######################################################################
 # Initialization:
 
 : ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
 : ${__OCF_ACTION=$1}
 
 #######################################################################
 
 meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
 <resource-agent name="Dummy" version="1.0">
 <version>1.0</version>
 
 <longdesc lang="en">
 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.
 </longdesc>
 <shortdesc lang="en">Example stateless resource agent</shortdesc>
 
 <parameters>
 <parameter name="state" unique="1">
 <longdesc lang="en">
 Location to store the resource state in.
 </longdesc>
 <shortdesc lang="en">State file</shortdesc>
-<content type="string" default="${HA_VARRUN}/Dummy-${OCF_RESOURCE_INSTANCE}.state" />
+<content type="string" default="${HA_VARRUN%%/}/Dummy-${OCF_RESOURCE_INSTANCE}.state" />
 </parameter>
 
 <parameter name="passwd" unique="1">
 <longdesc lang="en">
 Fake password field
 </longdesc>
 <shortdesc lang="en">Password</shortdesc>
 <content type="string" default="" />
 </parameter>
 
 <parameter name="fake" unique="0">
 <longdesc lang="en">
 Fake attribute that can be changed to cause a reload
 </longdesc>
 <shortdesc lang="en">Fake attribute that can be changed to cause a reload</shortdesc>
 <content type="string" default="dummy" />
 </parameter>
 
 <parameter name="op_sleep" unique="1">
 <longdesc lang="en">
 Number of seconds to sleep during operations.  This can be used to test how
 the cluster reacts to operation timeouts.
 </longdesc>
 <shortdesc lang="en">Operation sleep duration in seconds.</shortdesc>
 <content type="string" default="0" />
 </parameter>
 
 </parameters>
 
 <actions>
 <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" />
 </actions>
 </resource-agent>
 END
 }
 
 #######################################################################
 
 # don't exit on TERM, to test that lrmd makes sure that we do exit
 trap sigterm_handler TERM
 sigterm_handler() {
 	ocf_log info "They use TERM to bring us down. No such luck."
 	return
 }
 
 dummy_usage() {
 	cat <<END
 usage: $0 {start|stop|monitor|migrate_to|migrate_from|validate-all|meta-data}
 
 Expects to have a fully populated OCF RA-compliant environment set.
 END
 }
 
 dummy_start() {
     dummy_monitor
-    if [ $? =  $OCF_SUCCESS ]; then
+    if [ $? -eq $OCF_SUCCESS ]; then
 	return $OCF_SUCCESS
     fi
-    touch ${OCF_RESKEY_state}
+    touch "${OCF_RESKEY_state}"
 }
 
 dummy_stop() {
     dummy_monitor
-    if [ $? =  $OCF_SUCCESS ]; then
+    if [ $? -eq $OCF_SUCCESS ]; then
 	rm ${OCF_RESKEY_state}
     fi
-    rm -f ${VERIFY_SERIALIZED_FILE}
+    rm -f "${VERIFY_SERIALIZED_FILE}"
     return $OCF_SUCCESS
 }
 
 dummy_monitor() {
 	# Monitor _MUST!_ differentiate correctly between running
 	# (SUCCESS), failed (ERROR) or _cleanly_ stopped (NOT RUNNING).
 	# That is THREE states, not just yes/no.
 
-	if [ "$OCF_RESKEY_op_sleep" -ne "0" ]; then
-		if [ -f ${VERIFY_SERIALIZED_FILE} ]; then
+	if [ $OCF_RESKEY_op_sleep -ne 0 ]; then
+		if [ -f "${VERIFY_SERIALIZED_FILE}" ]; then
 			# two monitor ops have occurred at the same time.
 			# this is to verify a condition in the lrmd regression tests.
 			ocf_log err "$VERIFY_SERIALIZED_FILE exists already"
 			return $OCF_ERR_GENERIC
 		fi
 
-		touch ${VERIFY_SERIALIZED_FILE}
+		touch "${VERIFY_SERIALIZED_FILE}"
 		sleep ${OCF_RESKEY_op_sleep}
-		rm ${VERIFY_SERIALIZED_FILE}
+		rm "${VERIFY_SERIALIZED_FILE}"
 	fi
 	
-	if [ -f ${OCF_RESKEY_state} ]; then
+	if [ -f "${OCF_RESKEY_state}" ]; then
 		return $OCF_SUCCESS
 	fi
-	if false ; then
-		return $OCF_ERR_GENERIC
-	fi
 	return $OCF_NOT_RUNNING
 }
 
 dummy_validate() {
     
     # Is the state directory writable? 
     state_dir=`dirname "$OCF_RESKEY_state"`
     touch "$state_dir/$$"
-    if [ $? != 0 ]; then
+    if [ $? -ne 0 ]; then
 	return $OCF_ERR_ARGS
     fi
     rm "$state_dir/$$"
 
     return $OCF_SUCCESS
 }
 
 : ${OCF_RESKEY_fake=dummy}
 : ${OCF_RESKEY_op_sleep=0}
 : ${OCF_RESKEY_CRM_meta_interval=0}
-: ${OCF_RESKEY_CRM_meta_globally_unique:="true"}
+: ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
+
+if [ -z "$OCF_RESKEY_state" ]; then
+    OCF_RESKEY_state="${HA_VARRUN%%/}/Dummy-${OCF_RESOURCE_INSTANCE}.state"
 
-if [ "x$OCF_RESKEY_state" = "x" ]; then
     if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then
-	state="${HA_VARRUN}/Dummy-${OCF_RESOURCE_INSTANCE}.state"
-	
-	# Strip off the trailing clone marker
-	OCF_RESKEY_state=`echo $state | sed s/:[0-9][0-9]*\.state/.state/`
-    else 
-	OCF_RESKEY_state="${HA_VARRUN}/Dummy-${OCF_RESOURCE_INSTANCE}.state"
+        # Strip off the trailing clone marker (note + is not portable in sed)
+        OCF_RESKEY_state=`echo $OCF_RESKEY_state | sed s/:[0-9][0-9]*\.state/.state/`
     fi
 fi
 VERIFY_SERIALIZED_FILE="${OCF_RESKEY_state}.serialized"
 
 case $__OCF_ACTION in
 meta-data)	meta_data
 		exit $OCF_SUCCESS
 		;;
 start)		dummy_start;;
 stop)		dummy_stop;;
 monitor)	dummy_monitor;;
 migrate_to)	ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to ${OCF_RESKEY_CRM_meta_migrate_target}."
 	        dummy_stop
 		;;
-migrate_from)	ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to ${OCF_RESKEY_CRM_meta_migrate_source}."
+migrate_from)	ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} from ${OCF_RESKEY_CRM_meta_migrate_source}."
 	        dummy_start
 		;;
 reload)		ocf_log err "Reloading..."
 	        dummy_start
 		;;
 validate-all)	dummy_validate;;
 usage|help)	dummy_usage
 		exit $OCF_SUCCESS
 		;;
 *)		dummy_usage
 		exit $OCF_ERR_UNIMPLEMENTED
 		;;
 esac
 rc=$?
 ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
 exit $rc
-
diff --git a/extra/resources/HealthCPU b/extra/resources/HealthCPU
index f48854fb04..32a10ad3e7 100644
--- a/extra/resources/HealthCPU
+++ b/extra/resources/HealthCPU
@@ -1,222 +1,222 @@
 #!/bin/sh
 #
 #
 #	HealthCPU OCF RA. Measures CPUs idling and writes
 #	#health-cpu status into the CIB
 #
 # Copyright (c) 2009 Michael Schwartzkopff
 #	in collaboration with the Bull company. Merci!
 #
 #                    All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of version 2 of the GNU General Public License as
 # published by the Free Software Foundation.
 #
 # This program is distributed in the hope that it would be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
 # Further, this software is distributed without any warranty that it is
 # free of the rightful claim of any third person regarding infringement
 # or the like.  Any license provided herein, whether implied or
 # otherwise, applies only to this software file.  Patent licenses, if
 # any, provided herein do not apply to combinations of this program with
 # other software, or any other product whatsoever.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write the Free Software Foundation,
 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 #
 ################################
 #
 #	TODO: Enter default values
 #		Error handling in getting uptime
 #
 ##################################
 
 #######################################################################
 # Initialization:
 
 : ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
 : ${__OCF_ACTION=$1}
 
 #######################################################################
 
 meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
 <resource-agent name="HealthCPU" version="0.1">
 <version>0.1</version>
 
 <longdesc lang="en">
 Systhem health agent that measures the CPU idling and updates the #health-cpu attribute.
 </longdesc>
 <shortdesc lang="en">System health CPU usage</shortdesc>
 
 <parameters>
 <parameter name="state" unique="1">
 <longdesc lang="en">
 Location to store the resource state in.
 </longdesc>
 <shortdesc lang="en">State file</shortdesc>
-<content type="string" default="${HA_VARRUN}/health-cpu-${OCF_RESOURCE_INSTANCE}.state" />
+<content type="string" default="${HA_VARRUN%%/}/health-cpu-${OCF_RESOURCE_INSTANCE}.state" />
 </parameter>
 
 <parameter name="yellow_limit" unique="1">
 <longdesc lang="en">
 Lower (!) limit of idle percentage to switch the health attribute to yellow. I.e.
 the #health-cpu will go yellow if the %idle of the CPU falls below 50%.
 </longdesc>
 <shortdesc lang="en">Lower limit for yellow health attribute</shortdesc>
 <content type="string" default="50"/>
 </parameter>
 
 <parameter name="red_limit" unique="1">
 <longdesc lang="en">
 Lower (!) limit of idle percentage to switch the health attribute to red. I.e.
 the #health-cpu will go red if the %idle of the CPU falls below 10%.
 </longdesc>
 <shortdesc lang="en">Lower limit for red health attribute</shortdesc>
 <content type="string" default="10"/>
 </parameter>
 
 </parameters>
 
 <actions>
 <action name="start"        timeout="10" />
 <action name="stop"         timeout="10" />
 <action name="monitor"      timeout="10" interval="10" start-delay="0" />
 <action name="meta-data"    timeout="5" />
 <action name="validate-all"   timeout="10" />
 </actions>
 </resource-agent>
 END
 }
 
 #######################################################################
 
 # don't exit on TERM, to test that lrmd makes sure that we do exit
 trap sigterm_handler TERM
 sigterm_handler() {
 	ocf_log info "They use TERM to bring us down. No such luck."
 	return
 }
 
 dummy_usage() {
 	cat <<END
 usage: $0 {start|stop|monitor|validate-all|meta-data}
 
 Expects to have a fully populated OCF RA-compliant environment set.
 END
 }
 
 dummy_start() {
     dummy_monitor
     if [ $? =  $OCF_SUCCESS ]; then
 	return $OCF_SUCCESS
     fi
     touch ${OCF_RESKEY_state}
 }
 
 dummy_stop() {
     dummy_monitor
     if [ $? =  $OCF_SUCCESS ]; then
 	rm ${OCF_RESKEY_state}
     fi
     return $OCF_SUCCESS
 }
 
 dummy_monitor() {
 	# Monitor _MUST!_ differentiate correctly between running
 	# (SUCCESS), failed (ERROR) or _cleanly_ stopped (NOT RUNNING).
 	# That is THREE states, not just yes/no.
 	
 	if [ -f ${OCF_RESKEY_state} ]; then
 
 	  IDLE=`top -b -n2 | grep Cpu | tail -1 | awk -F",|.[0-9][ %]id" '{ print $4 }'`
 	  # echo "System idle: " $IDLE
 	  # echo "$OCF_RESKEY_red_limit"
 	  # echo $OCF_RESKEY_yellow_limit
 
 	  if [ $IDLE -lt ${OCF_RESKEY_red_limit} ] ; then
 	    # echo "System state RED!"
 	    attrd_updater -n "#health-cpu" -U "red" -d "30s"
 	    return $OCF_SUCCESS
           fi
 
 	  if [ $IDLE -lt ${OCF_RESKEY_yellow_limit} ] ; then
 	    # echo "System state yellow."
             attrd_updater -n "#health-cpu" -U "yellow" -d "30s"
 	  else
 	    # echo "System state green."
 	    attrd_updater -n "#health-cpu" -U "green" -d "30s"
 
           fi
 	
 	  return $OCF_SUCCESS
 	fi
 
 	if false ; then
                 return $OCF_ERR_GENERIC
         fi
         return $OCF_NOT_RUNNING
 
 }
 
 dummy_validate() {
     
     # Is the state directory writable? 
     state_dir=`dirname "$OCF_RESKEY_state"`
     touch "$state_dir/$$"
     if [ $? != 0 ]; then
 	return $OCF_ERR_ARGS
     fi
     rm "$state_dir/$$"
 
     return $OCF_SUCCESS
 }
 
 : ${OCF_RESKEY_CRM_meta_interval=0}
-: ${OCF_RESKEY_CRM_meta_globally_unique:="true"}
+: ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
 
 if [ "x$OCF_RESKEY_state" = "x" ]; then
     if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then
-	state="${HA_VARRUN}/Dummy-${OCF_RESOURCE_INSTANCE}.state"
+	state="${HA_VARRUN%%/}/Dummy-${OCF_RESOURCE_INSTANCE}.state"
 	
 	# Strip off the trailing clone marker
 	OCF_RESKEY_state=`echo $state | sed s/:[0-9][0-9]*\.state/.state/`
     else 
-	OCF_RESKEY_state="${HA_VARRUN}/Dummy-${OCF_RESOURCE_INSTANCE}.state"
+	OCF_RESKEY_state="${HA_VARRUN%%/}/Dummy-${OCF_RESOURCE_INSTANCE}.state"
     fi
 fi
 
 if [ "x${OCF_RESKEY_red_limit}" = "x" ] ; then
   OCF_RESKEY_red_limit=10
 fi
 
 if [ "x${OCF_RESKEY_yellow_limit}" = "x" ] ; then
   OCF_RESKEY_yellow_limit=50
 fi
 
 case $__OCF_ACTION in
 meta-data)	meta_data
 		exit $OCF_SUCCESS
 		;;
 start)		dummy_start;;
 stop)		dummy_stop;;
 monitor)	dummy_monitor;;
 validate-all)	dummy_validate;;
 usage|help)	dummy_usage
 		exit $OCF_SUCCESS
 		;;
 *)		dummy_usage
 		exit $OCF_ERR_UNIMPLEMENTED
 		;;
 esac
 rc=$?
 ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
 exit $rc
 
diff --git a/extra/resources/HealthSMART b/extra/resources/HealthSMART
index 3747bfa25e..9eee059fa1 100644
--- a/extra/resources/HealthSMART
+++ b/extra/resources/HealthSMART
@@ -1,328 +1,328 @@
-#!/bin/sh
+#!/bin/bash
 #
 #
 # HealthSMART OCF RA. Checks the S.M.A.R.T. status of all given
 # drives and writes the #health-smart status into the CIB
 #
 # Copyright (c) 2009 Michael Schwartzkopff, 2010 Matthew Richardson
 #
 #                    All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of version 2 of the GNU General Public License as
 # published by the Free Software Foundation.
 #
 # This program is distributed in the hope that it would be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
 # Further, this software is distributed without any warranty that it is
 # free of the rightful claim of any third person regarding infringement
 # or the like.  Any license provided herein, whether implied or
 # otherwise, applies only to this software file.  Patent licenses, if
 # any, provided herein do not apply to combinations of this program with
 # other software, or any other product whatsoever.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write the Free Software Foundation,
 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 #
 #######################################################################
 
 #######################################################################
 # Initialization:
 
 : ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
 : ${__OCF_ACTION=$1}
 #
 SMARTCTL=/usr/sbin/smartctl
 ATTRDUP=/usr/sbin/attrd_updater
 
 #######################################################################
 
 meta_data() {
     cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
 <resource-agent name="HealthSMART" version="0.1">
 <version>0.1</version>
 
 <longdesc lang="en">
 Systhem health agent that checks the S.M.A.R.T. status of the given drives and
 updates the #health-smart attribute.
 </longdesc>
 <shortdesc lang="en">SMART health status</shortdesc>
 
 <parameters>
 <parameter name="state" unique="1">
 <longdesc lang="en">
 Location to store the resource state in.
 </longdesc>
 <shortdesc lang="en">State file</shortdesc>
-<content type="string" default="${HA_VARRUN}/HealthSMART-{OCF_RESOURCE_INSTANCE}.state" />
+<content type="string" default="${HA_VARRUN%%/}/HealthSMART-${OCF_RESOURCE_INSTANCE}.state" />
 </parameter>
 
 <parameter name="drives" unique="0">
 <longdesc lang="en">
 The drive(s) to check as a SPACE separated list. Enter the full path to the device, e.g. "/dev/sda".
 </longdesc>
 <shortdesc lang="en">Drives to check</shortdesc>
 <content type="string" default="/dev/sda" />
 </parameter>
 
 <parameter name="devices" unique="0">
 <longdesc lang="en">
 The device type(s) to assume for the drive(s) being tested as a SPACE separated list.
 </longdesc>
 <shortdesc lang="en">Device types</shortdesc>
 <content type="string" />
 </parameter>
 
 <parameter name="temp_lower_limit" unique="0">
 <longdesc lang="en">
 Lower limit of the temperature in deg C of the drive(s). Below this limit the status will be red.
 </longdesc>
 <shortdesc lang="en">Lower limit for the red smart attribute</shortdesc>
 <content type="string" default="0"/>
 </parameter>
 
 <parameter name="temp_upper_limit" unique="0">
 <longdesc lang="en">
 Upper limit of the temperature if deg C of the drives(s). If the drive reports
 a temperature higher than this value the status of #health-smart will be red.
 </longdesc>
 <shortdesc lang="en">Upper limit for red smart attribute</shortdesc>
 <content type="string" default="60"/>
 </parameter>
 
 <parameter name="temp_warning" unique="0">
 <longdesc lang="en">
 Number of deg C below/above the upper/lower temp limits at which point the status of #health-smart will change to yellow.
 </longdesc>
 <shortdesc lang="en">Deg C below/above the upper limits for yellow smart attribute</shortdesc>
 <content type="string" default="5"/>
 </parameter>
 
 </parameters>
 
 <actions>
 <action name="start"        timeout="10" />
 <action name="stop"         timeout="10" />
 <action name="monitor"      timeout="10" interval="10" start-delay="0" />
 <action name="meta-data"    timeout="5" />
 <action name="validate-all"   timeout="10" />
 </actions>
 </resource-agent>
 END
 }
 
 #######################################################################
 
 check_temperature() {
     
     if [ $1 -lt ${lower_red_limit} ] ; then
 	ocf_log info "Drive ${DRIVE} ${DEVICE} too cold: ${1} C"
 	$ATTRDUP -n "#health-smart" -U "red" -d "5s"
 	return 1
     fi
 
     if [ $1 -gt ${upper_red_limit} ] ; then
 	ocf_log info "Drive ${DRIVE} ${DEVICE} too hot: ${1} C"
 	$ATTRDUP -n "#health-smart" -U "red" -d "5s"
 	return 1
     fi
     
     if [ $1 -lt ${lower_yellow_limit} ] ; then
 	ocf_log info "Drive ${DRIVE} ${DEVICE} quite cold: ${1} C"
 	$ATTRDUP -n "#health-smart" -U "yellow" -d "5s"
 	return 1
     fi
     
     if [ $1 -gt ${upper_yellow_limit} ] ; then
 	ocf_log info "Drive ${DRIVE} ${DEVICE} quite hot: ${1} C"
 	$ATTRDUP -n "#health-smart" -U "yellow" -d "5s"
 	return 1
     fi
 }
 
 
 init_smart() {
     #Set temperature defaults
     if [ -z ${OCF_RESKEY_temp_warning} ]; then
 	yellow_threshold=5
     else
         yellow_threshold=${OCF_RESKEY_temp_warning}
     fi
 
     if [ -z ${OCF_RESKEY_temp_lower_limit} ] ; then
         lower_red_limit=0
     else
         lower_red_limit=${OCF_RESKEY_temp_lower_limit}
     fi
     lower_yellow_limit=$((${lower_red_limit}+${yellow_threshold}))
 
     if [ -z ${OCF_RESKEY_temp_upper_limit} ] ; then
         upper_red_limit=60
     else
         upper_red_limit=${OCF_RESKEY_temp_upper_limit}
     fi
     upper_yellow_limit=$((${upper_red_limit}-${yellow_threshold}))
 
     #Set disk defaults
     if [ -z "${OCF_RESKEY_drives}" ] ; then
         DRIVES="/dev/sda"
     else
         DRIVES=${OCF_RESKEY_drives}
     fi
 
     #Test for presence of smartctl
     if [ ! -x $SMARTCTL ] ; then
         ocf_log err "${SMARTCTL} not installed."
         exit $OCF_ERR_INSTALLED
     fi
 
     for DRIVE in $DRIVES; do
 	if [ "${OCF_RESKEY_devices}" ]; then
 	    for DEVICE in ${OCF_RESKEY_devices}; do
 		$SMARTCTL -d $DEVICE -i ${DRIVE} | grep -q "SMART support is: Enabled"
 		if [ $? -ne "0" ] ; then
 		    ocf_log err "S.M.A.R.T. not enabled for drive "${DRIVE}
 		    exit $OCF_ERR_INSTALLED
 		fi
 	    done
 	else
 	    $SMARTCTL -i ${DRIVE} | grep -q "SMART support is: Enabled"
 	    if [ $? -ne "0" ] ; then
 		ocf_log err "S.M.A.R.T. not enabled for drive "${DRIVE}
 		exit $OCF_ERR_INSTALLED
 	    fi
 	fi
     done
 }
 
 HealthSMART_usage() {
     cat <<END
 usage: $0 {start|stop|monitor|validate-all|meta-data}
 
 Expects to have a fully populated OCF RA-compliant environment set.
 END
 }
 
 HealthSMART_start() {
     HealthSMART_monitor
     if [ $? =  $OCF_SUCCESS ]; then
         return $OCF_SUCCESS
     fi
     touch ${OCF_RESKEY_state}
 }
 
 HealthSMART_stop() {
     HealthSMART_monitor
     if [ $? =  $OCF_SUCCESS ]; then
         rm ${OCF_RESKEY_state}
     fi
     return $OCF_SUCCESS
 }
 
 HealthSMART_monitor() {
 
     init_smart
 
     # Monitor _MUST!_ differentiate correctly between running
     # (SUCCESS), failed (ERROR) or _cleanly_ stopped (NOT RUNNING).
     # That is THREE states, not just yes/no.
 
     if [ -f ${OCF_RESKEY_state} ]; then
 
         # Check overall S.M.A.R.T. status
         for DRIVE in $DRIVES; do
 	    if [ "${OCF_RESKEY_devices}" ]; then
 		for DEVICE in ${OCF_RESKEY_devices}; do
 		    $SMARTCTL -d $DEVICE -H ${DRIVE} | grep -q "SMART overall-health self-assessment test result: PASSED"
 		    if [ $? -ne "0" ]; then
 			$ATTRDUP -n "#health-smart" -U "red" -d "5s"
 			return $OCF_SUCCESS
 		    fi
 		done
 	    else
 		$SMARTCTL -H ${DRIVE} | grep -q "SMART overall-health self-assessment test result: PASSED"
 		if [ $? -ne "0" ]; then
 		    $ATTRDUP -n "#health-smart" -U "red" -d "5s"
 		    return $OCF_SUCCESS
 		fi
 	    fi
 	    
             # Check drive temperature(s)
 	    if [ "${OCF_RESKEY_devices}" ]; then
 		for DEVICE in ${OCF_RESKEY_devices}; do
 		    check_temperature `$SMARTCTL -d $DEVICE -A ${DRIVE} | awk '/^194/ { print $10 }'`
 		    if [ $? != 0 ]; then
 			return $OCF_SUCCESS
 		    fi
 		done
 	    else
 		check_temperature `$SMARTCTL -A ${DRIVE} | awk '/^194/ { print $10 }'`
 		if [ $? != 0 ]; then
 		    return $OCF_SUCCESS
 		fi
 	    fi
         done
 
         $ATTRDUP -n "#health-smart" -U "green" -d "5s"
         return $OCF_SUCCESS
     fi
 
     return $OCF_NOT_RUNNING
 
 }
 
 HealthSMART_validate() {
 
     init_smart
 
   # Is the state directory writable?
     state_dir=`dirname "$OCF_RESKEY_state"`
     touch "$state_dir/$$"
     if [ $? != 0 ]; then
         return $OCF_ERR_ARGS
     fi
     rm "$state_dir/$$"
 
     return $OCF_SUCCESS
 }
 
 : ${OCF_RESKEY_CRM_meta_interval=0}
 : ${OCF_RESKEY_CRM_meta_globally_unique:="true"}
 
 if [ "x$OCF_RESKEY_state" = "x" ]; then
     if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then
-        state="${HA_VARRUN}/HealthSMART-${OCF_RESOURCE_INSTANCE}.state"
+        state="${HA_VARRUN%%/}/HealthSMART-${OCF_RESOURCE_INSTANCE}.state"
 
   # Strip off the trailing clone marker
         OCF_RESKEY_state=`echo $state | sed s/:[0-9][0-9]*\.state/.state/`
     else
-        OCF_RESKEY_state="${HA_VARRUN}/HealthSMART-${OCF_RESOURCE_INSTANCE}.state"
+        OCF_RESKEY_state="${HA_VARRUN%%/}/HealthSMART-${OCF_RESOURCE_INSTANCE}.state"
     fi
 fi
 
 case $__OCF_ACTION in
     start)	  HealthSMART_start;;
     stop)	  HealthSMART_stop;;
     monitor)	  HealthSMART_monitor;;
     validate-all) HealthSMART_validate;;
     meta-data) 
 	meta_data
 	exit $OCF_SUCCESS
 	;;
     usage|help)
 	HealthSMART_usage
 	exit $OCF_SUCCESS
 	;;
     *)  HealthSMART_usage
 	exit $OCF_ERR_UNIMPLEMENTED
 	;;
 esac
 rc=$?
 ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
 exit $rc
diff --git a/extra/resources/Stateful b/extra/resources/Stateful
index c5184d572d..23526c93fb 100644
--- a/extra/resources/Stateful
+++ b/extra/resources/Stateful
@@ -1,213 +1,213 @@
 #!/bin/sh
 #
 #
 #	Example of a stateful OCF Resource Agent. 
 #
 # Copyright (c) 2006 Andrew Beekhof
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of version 2 of the GNU General Public License as
 # published by the Free Software Foundation.
 #
 # This program is distributed in the hope that it would be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
 # Further, this software is distributed without any warranty that it is
 # free of the rightful claim of any third person regarding infringement
 # or the like.  Any license provided herein, whether implied or
 # otherwise, applies only to this software file.  Patent licenses, if
 # any, provided herein do not apply to combinations of this program with
 # other software, or any other product whatsoever.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write the Free Software Foundation,
 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 #
 
 #######################################################################
 # Initialization:
 
 : ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
 : ${__OCF_ACTION=$1}
 CRM_MASTER="${HA_SBIN_DIR}/crm_master -l reboot"
 
 #######################################################################
 
 meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
 <resource-agent name="Stateful" version="1.0">
 <version>1.0</version>
 
 <longdesc lang="en">
 This is an example resource agent that impliments two states
 </longdesc>
 <shortdesc lang="en">Example stateful resource agent</shortdesc>
 
 <parameters>
 
 <parameter name="state" unique="1">
 <longdesc lang="en">
 Location to store the resource state in
 </longdesc>
 <shortdesc lang="en">State file</shortdesc>
-<content type="string" default="${HA_VARRUN}/Stateful-${OCF_RESOURCE_INSTANCE}.state" />
+<content type="string" default="${HA_VARRUN%%/}/Stateful-${OCF_RESOURCE_INSTANCE}.state" />
 </parameter>
 
 </parameters>
 
 <actions>
 <action name="start"   timeout="20" />
 <action name="stop"    timeout="20" />
 <action name="monitor" depth="0"  timeout="20" interval="10" role="Master"/>
 <action name="monitor" depth="0"  timeout="20" interval="10" role="Slave"/>
 <action name="meta-data"  timeout="5" />
 <action name="validate-all"  timeout="30" />
 </actions>
 </resource-agent>
 END
 	exit $OCF_SUCCESS
 }
 
 #######################################################################
 
 stateful_usage() {
 	cat <<END
 usage: $0 {start|stop|promote|demote|monitor|validate-all|meta-data}
 
 Expects to have a fully populated OCF RA-compliant environment set.
 END
 	exit $1
 }
 
 stateful_update() {
 	echo $1 > ${OCF_RESKEY_state}
 }
 
 stateful_check_state() {
     target=$1
     if [ -f ${OCF_RESKEY_state} ]; then
 	state=`cat ${OCF_RESKEY_state}`
 	if [ "x$target" = "x$state" ]; then
 	    return 0
 	fi
 
     else
 	if [ "x$target" = "x" ]; then
 	    return 0
 	fi
     fi
 
     return 1
 }
 
 stateful_start() {
     stateful_check_state master
     if [ $? = 0 ]; then
        	# CRM Error - Should never happen
 	return $OCF_RUNNING_MASTER
     fi
     stateful_update slave
     $CRM_MASTER -v ${slave_score}
     return 0
 }
 
 stateful_demote() {
     stateful_check_state 
     if [ $? = 0 ]; then
        	# CRM Error - Should never happen
 	return $OCF_NOT_RUNNING
     fi
     stateful_update slave
     $CRM_MASTER -v ${slave_score}
     return 0
 }
 
 stateful_promote() {
     stateful_check_state 
     if [ $? = 0 ]; then
 	return $OCF_NOT_RUNNING
     fi
     stateful_update master
     $CRM_MASTER -v ${master_score}
     return 0
 }
 
 stateful_stop() {
     $CRM_MASTER -D
     stateful_check_state master
     if [ $? = 0 ]; then
        	# CRM Error - Should never happen
 	return $OCF_RUNNING_MASTER
     fi
     if [ -f ${OCF_RESKEY_state} ]; then
 	rm ${OCF_RESKEY_state}
     fi
     return 0
 }
 
 stateful_monitor() {
     stateful_check_state "master"
     if [ $? = 0 ]; then
 	if [ $OCF_RESKEY_CRM_meta_interval = 0 ]; then
 	    # Restore the master setting during probes
 	    $CRM_MASTER -v ${master_score}
 	fi
 	return $OCF_RUNNING_MASTER
     fi
 
     stateful_check_state "slave"
     if [ $? = 0 ]; then
 	if [ $OCF_RESKEY_CRM_meta_interval = 0 ]; then
 	    # Restore the master setting during probes
 	    $CRM_MASTER -v ${slave_score}
 	fi
 	return $OCF_SUCCESS
     fi
 
     if [ -f ${OCF_RESKEY_state} ]; then
 	echo "File '${OCF_RESKEY_state}' exists but contains unexpected contents"
 	cat ${OCF_RESKEY_state}
 	return $OCF_ERR_GENERIC
     fi
     return 7
 }
 
 stateful_validate() {
 	exit $OCF_SUCCESS
 }
 
 : ${slave_score=5}
 : ${master_score=10}
 
 : ${OCF_RESKEY_CRM_meta_interval=0}
-: ${OCF_RESKEY_CRM_meta_globally_unique:="true"}
+: ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
 
 if [ "x$OCF_RESKEY_state" = "x" ]; then
     if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then
-	state="${HA_VARRUN}/Stateful-${OCF_RESOURCE_INSTANCE}.state"
+	state="${HA_VARRUN%%/}/Stateful-${OCF_RESOURCE_INSTANCE}.state"
 	
 	# Strip off the trailing clone marker
 	OCF_RESKEY_state=`echo $state | sed s/:[0-9][0-9]*\.state/.state/`
     else 
-	OCF_RESKEY_state="${HA_VARRUN}/Stateful-${OCF_RESOURCE_INSTANCE}.state"
+	OCF_RESKEY_state="${HA_VARRUN%%/}/Stateful-${OCF_RESOURCE_INSTANCE}.state"
     fi
 fi
 
 case $__OCF_ACTION in
 meta-data)	meta_data;;
 start)		stateful_start;;
 promote)	stateful_promote;;
 demote)		stateful_demote;;
 stop)		stateful_stop;;
 monitor)	stateful_monitor;;
 validate-all)	stateful_validate;;
 usage|help)	stateful_usage $OCF_SUCCESS;;
 *)		stateful_usage $OCF_ERR_UNIMPLEMENTED;;
 esac
 
 exit $?
 
diff --git a/extra/resources/SysInfo b/extra/resources/SysInfo
index 3b35ce66df..33f7139e3c 100644
--- a/extra/resources/SysInfo
+++ b/extra/resources/SysInfo
@@ -1,359 +1,359 @@
-#!/bin/sh
+#!/bin/bash
 #
 #
 #	SysInfo OCF Resource Agent
 #	It records (in the CIB) various attributes of a node
 #
 # Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Br�e
 #                    All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of version 2 of the GNU General Public License as
 # published by the Free Software Foundation.
 #
 # This program is distributed in the hope that it would be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
 # Further, this software is distributed without any warranty that it is
 # free of the rightful claim of any third person regarding infringement
 # or the like.  Any license provided herein, whether implied or
 # otherwise, applies only to this software file.  Patent licenses, if
 # any, provided herein do not apply to combinations of this program with
 # other software, or any other product whatsoever.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write the Free Software Foundation,
 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 #
 #######################################################################
 # Initialization:
 
 : ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
 : ${__OCF_ACTION=$1}
 
 #######################################################################
 
 meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
 <resource-agent name="SysInfo">
 <version>1.0</version>
 
 <longdesc lang="en">
 This is a SysInfo Resource Agent.
 It records (in the CIB) various attributes of a node
 Sample Linux output:
    arch:   i686
    os:     Linux-2.4.26-gentoo-r14
    free_swap:      1999
    cpu_info:       Intel(R) Celeron(R) CPU 2.40GHz
    cpu_speed:      4771.02
    cpu_cores:      1
    cpu_load:       0.00
    ram_total:      513
    ram_free:       117
    root_free:      2.4
 
 Sample Darwin output:
    arch:   i386
    os:     Darwin-8.6.2
    cpu_info:       Intel Core Duo
    cpu_speed:      2.16
    cpu_cores:      2
    cpu_load:       0.18
    ram_total:      2016
    ram_free:       787
    root_free:      13
 
 Units:
    free_swap: Mb
    ram_*:     Mb
    cpu_speed (Linux): bogomips
    cpu_speed (Darwin): Ghz
    *_free:    GB (or user-defined: disk_unit)
 
 </longdesc>
 <shortdesc lang="en">SysInfo resource agent</shortdesc>
 
 <parameters>
 
 <parameter name="pidfile" unique="1">
 <longdesc lang="en">PID file</longdesc>
 <shortdesc lang="en">PID file</shortdesc>
 <content type="string" default="$OCF_RESKEY_pidfile" />
 </parameter>
 
 <parameter name="delay" unique="0">
 <longdesc lang="en">Interval to allow values to stabilize</longdesc>
 <shortdesc lang="en">Dampening Delay</shortdesc>
 <content type="string" default="0s" />
 </parameter>
 
 <parameter name="disks" unique="0">
 <longdesc lang="en">
 Filesystems or Paths to be queried for free disk space as a SPACE
 separated list - e.g "/dev/sda1 /tmp".
 Results will be written to an attribute with leading slashes
 removed, and other slashes replaced with underscore, and the word
 'free' appended - e.g for /dev/sda1 it would be 'dev_sda1_free'.
 Note: The root filesystem '/' is always queried to an attribute
 named 'root_free'
 </longdesc>
 <shortdesc lang="en">List of Filesytems/Paths to query for free disk space</shortdesc>
 <content type="string" />
 </parameter>
 
 <parameter name="disk_unit" unique="0">
 <longdesc lang="en">
 Unit to report disk free space in.
 Can be one of: B, K, M, G, T, P (case-insensitive)
 </longdesc>
 <shortdesc lang="en">Unit to report disk free space in</shortdesc>
 <content type="string" default="G"/>
 </parameter>
 
 <parameter name="min_disk_free" unique="0">
 <longdesc lang="en">
 The amount of free space required in monitored disks. If any
 of the monitored disks has less than this amount of free space,
 all resources will move away from the node. Set the node-health-strategy
 property appropriately for this to take effect.
 If the unit is not specified, it defaults to disk_unit.
 </longdesc>
 <shortdesc lang="en">minimum disk free space required</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
 
 </parameters>
 <actions>
 <action name="start"   timeout="20s" />
 <action name="stop"    timeout="20s" />
 <action name="monitor" timeout="20s" interval="60s"/>
 <action name="meta-data"  timeout="5" />
 <action name="validate-all"  timeout="30" />
 </actions>
 </resource-agent>
 END
 }
 
 #######################################################################
 
 UpdateStat() {
     name=$1; shift
     value="$*"
     printf "%s:\t%s\n" "$name" "$value"
     ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -S status -n $name -v "$value"
 }
 
 SysInfoStats() {
 
     UpdateStat arch "`uname -m`"
     UpdateStat os "`uname -s`-`uname -r`"
 
     case `uname -s` in
 	"Darwin")
 	    mem=`top -l 1 | grep Mem: | awk '{print $10}'`
 	    mem_used=`top -l 1 | grep Mem: | awk '{print $8}'`
 	    mem=`SysInfo_mem_units $mem`
 	    mem_used=`SysInfo_mem_units $mem_used`
 	    mem_total=`expr $mem_used + $mem`
 	    cpu_type=`system_profiler SPHardwareDataType | awk -F': ' '/^CPU Type/ {print $2; exit}'`
 	    cpu_speed=`system_profiler SPHardwareDataType | awk -F': ' '/^CPU Speed/ {print $2; exit}'`
 	    cpu_cores=`system_profiler SPHardwareDataType | awk -F': ' '/^Number Of/ {print $2; exit}'`
 	;;
 	"Linux")
 	    if [ -f /proc/cpuinfo ]; then
 		cpu_type=`awk -F': ' '/model name/ {print $2; exit}' /proc/cpuinfo`
 		cpu_speed=`awk -F': ' '/bogomips/ {print $2; exit}' /proc/cpuinfo`
 		cpu_cores=`grep "^processor" /proc/cpuinfo | wc -l`
 	    fi
 
 	    if [ -f /proc/meminfo ]; then
 	        # meminfo results are in kB
 		mem=`grep "SwapFree" /proc/meminfo | awk '{print $2"k"}'`
 		if [ ! -z $mem ]; then
 		    UpdateStat free_swap `SysInfo_mem_units $mem`
 		fi
 		mem=`grep "Inactive" /proc/meminfo | awk '{print $2"k"}'`
 		mem_total=`grep "MemTotal" /proc/meminfo | awk '{print $2"k"}'`
 	    else
 		mem=`top -n 1 | grep Mem: | awk '{print $7}'`
 	    fi
 	    ;;
 	*)
     esac
 
     if [ x != x"$cpu_type" ]; then
 	UpdateStat cpu_info "$cpu_type"
     fi
 
     if [ x != x"$cpu_speed" ]; then
 	UpdateStat cpu_speed "$cpu_speed"
     fi
 
     if [ x != x"$cpu_cores" ]; then
 	UpdateStat cpu_cores "$cpu_cores"
     fi
 
     loads=`uptime`
     load15=`echo ${loads} | awk '{print $10}'`
     UpdateStat cpu_load $load15
 
     if [ ! -z "$mem" ]; then
         # Massage the memory values
  	UpdateStat ram_total `SysInfo_mem_units $mem_total`
 	UpdateStat ram_free `SysInfo_mem_units $mem`
     fi
 
     # Portability notes:
     #   o tail: explicit "-n" not available in Solaris; instead simplify
     #	  'tail -n <c>' to the equivalent 'tail -<c>'.
     for disk in "/" ${OCF_RESKEY_disks}; do
 	unset disk_free disk_label
 	disk_free=`df -h ${disk} | tail -1 | awk '{print $4}'`
 	if [ x != x"$disk_free" ]; then
 	    disk_label=`echo $disk | sed -e 's#^/$#root#;s#^/*##;s#/#_#g'`
 	    disk_free=`SysInfo_hdd_units $disk_free`
 	    UpdateStat ${disk_label}_free $disk_free
 	    if [ -n "$MIN_FREE" ]; then
 		test $disk_free -le $MIN_FREE &&
 		    UpdateStat "#health_disk" "red"
 	    fi
 	fi
     done
 }
 
 SysInfo_megabytes() {
     # Size in megabytes
     echo $1 | awk '{ n = $0;
 		     sub(/[0-9]+(.[0-9]+)?/, "");
 		     split(n, a, $0);
                      n=a[1];
                      if ($0 == "G" || $0 == "") { n *= 1024 };
                      if (/^kB?/) { n /= 1024 };
                      printf "%d\n", n }' # Intentionaly round to an integer
 }
 
 SysInfo_mem_units() {
     mem=$1
 
     if [ -z $1 ]; then 
 	return
     fi
 
     mem=$(SysInfo_megabytes "$1")
     # Round to the next multiple of 50
     r=$(($mem % 50))
     if [ $r != 0 ]; then
 	mem=$(($mem + 50 - $r))
     fi
 
     echo $mem    
 }
 
 SysInfo_hdd_units() {
     # Defauts to size in gigabytes
 
     case $OCF_RESKEY_disk_unit in 
 	[Pp]) echo $(($(SysInfo_megabytes "$1") / 1024 / 1024 / 1024));;
 	[Tt]) echo $(($(SysInfo_megabytes "$1") / 1024 / 1024));;
 	[Gg]) echo $(($(SysInfo_megabytes "$1") / 1024));;
 	[Mm]) echo $(SysInfo_megabytes "$1");;
 	[Kk]) echo $(($(SysInfo_megabytes "$1") * 1024));;
 	[Bb]) echo $(($(SysInfo_megabytes "$1") * 1024 * 1024));;
 	*) 
 	    ocf_log err "Invalid value for disk_unit: $OCF_RESKEY_disk_unit"
 	    echo $(($(SysInfo_megabytes "$1") / 1024));;
     esac
 }
 
 SysInfo_usage() {
 	cat <<END
 usage: $0 {start|stop|monitor|validate-all|meta-data}
 
 Expects to have a fully populated OCF RA-compliant environment set.
 END
 }
 
 SysInfo_start() {
     echo $OCF_RESKEY_clone > $OCF_RESKEY_pidfile
     SysInfoStats
     exit $OCF_SUCCESS
 }
 
 SysInfo_stop() {
     rm $OCF_RESKEY_pidfile
     exit $OCF_SUCCESS
 }
 
 SysInfo_monitor() {
     if [ -f $OCF_RESKEY_pidfile ]; then
 	clone=`cat $OCF_RESKEY_pidfile`
     fi
 
     if [ x$clone = x ]; then
 	rm $OCF_RESKEY_pidfile
 	exit $OCF_NOT_RUNNING
 
     elif [ $clone = $OCF_RESKEY_clone ]; then
 	SysInfoStats
 	exit $OCF_SUCCESS
 
     elif [ x$OCF_RESKEY_CRM_meta_globally_unique = xtrue  
 	    -o x$OCF_RESKEY_CRM_meta_globally_unique = xTrue
 	    -o x$OCF_RESKEY_CRM_meta_globally_unique = xyes
 	    -o x$OCF_RESKEY_CRM_meta_globally_unique = xYes
 	]; then
 	SysInfoStats
 	exit $OCF_SUCCESS
     fi
     exit $OCF_NOT_RUNNING
 }
 
 SysInfo_validate() {
     return $OCF_SUCCESS
 }
 
 if [ $# -ne 1 ]; then
     SysInfo_usage
     exit $OCF_ERR_ARGS
 fi
 
-: ${OCF_RESKEY_pidfile:="$HA_VARRUN/SysInfo-${OCF_RESOURCE_INSTANCE}"}
+: ${OCF_RESKEY_pidfile:="${HA_VARRUN%%/}/SysInfo-${OCF_RESOURCE_INSTANCE}"}
 : ${OCF_RESKEY_disk_unit:="G"}
 : ${OCF_RESKEY_clone:="0"}
 if [ x != x${OCF_RESKEY_delay} ]; then
     OCF_RESKEY_delay="-d ${OCF_RESKEY_delay}"
 fi
 MIN_FREE=""
 if [ -n "$OCF_RESKEY_min_disk_free" ]; then
 	ocf_is_decimal "$OCF_RESKEY_min_disk_free" &&
 		OCF_RESKEY_min_disk_free="$OCF_RESKEY_min_disk_free$OCF_RESKEY_disk_unit"
     MIN_FREE=`SysInfo_hdd_units $OCF_RESKEY_min_disk_free`
 fi
 
 case $__OCF_ACTION in
 meta-data)	meta_data
 		exit $OCF_SUCCESS
 		;;
 start)		SysInfo_start
 		;;
 stop)		SysInfo_stop
 		;;
 monitor)	SysInfo_monitor
 		;;
 validate-all)	SysInfo_validate
 		;;
 usage|help)	SysInfo_usage
 		exit $OCF_SUCCESS
 		;;
 *)		SysInfo_usage
 		exit $OCF_ERR_UNIMPLEMENTED
 		;;
 esac
 
 exit $?
diff --git a/extra/resources/ping b/extra/resources/ping
index 67b7dc768e..f3bc53afa1 100755
--- a/extra/resources/ping
+++ b/extra/resources/ping
@@ -1,385 +1,385 @@
 #!/bin/sh
 #
 #
 #	Ping OCF RA that utilizes the system ping 
 #
 # Copyright (c) 2009 Andrew Beekhof
 #                    All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of version 2 of the GNU General Public License as
 # published by the Free Software Foundation.
 #
 # This program is distributed in the hope that it would be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
 # Further, this software is distributed without any warranty that it is
 # free of the rightful claim of any third person regarding infringement
 # or the like.  Any license provided herein, whether implied or
 # otherwise, applies only to this software file.  Patent licenses, if
 # any, provided herein do not apply to combinations of this program with
 # other software, or any other product whatsoever.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write the Free Software Foundation,
 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 #
 
 #######################################################################
 # Initialization:
 
 : ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
 : ${__OCF_ACTION=$1}
 
 #######################################################################
 
 meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
 <resource-agent name="ping">
 <version>1.0</version>
 
 <longdesc lang="en">
 Every time the monitor action is run, this resource agent records (in the CIB) the current number of nodes the host can connect to using the system fping (preferred) or ping tool.
 </longdesc>
 <shortdesc lang="en">node connectivity</shortdesc>
 
 <parameters>
 
 <parameter name="pidfile" unique="0">
 <longdesc lang="en">PID file</longdesc>
 <shortdesc lang="en">PID file</shortdesc>
-<content type="string" default="$HA_VARRUN/ping-${OCF_RESOURCE_INSTANCE}" />
+<content type="string" default="${HA_VARRUN%%/}/ping-${OCF_RESOURCE_INSTANCE}" />
 </parameter>
 
 <parameter name="dampen" unique="0">
 <longdesc lang="en">
 The time to wait (dampening) further changes occur
 </longdesc>
 <shortdesc lang="en">Dampening interval</shortdesc>
 <content type="integer" default="5s"/>
 </parameter>
 
 <parameter name="name" unique="0">
 <longdesc lang="en">
 The name of the attributes to set.  This is the name to be used in the constraints.
 </longdesc>
 <shortdesc lang="en">Attribute name</shortdesc>
 <content type="string" default="pingd"/>
 </parameter>
 
 <parameter name="multiplier" unique="0">
 <longdesc lang="en">
 The number by which to multiply the number of connected ping nodes by
 </longdesc>
 <shortdesc lang="en">Value multiplier</shortdesc>
 <content type="integer" default="1"/>
 </parameter>
 
 <parameter name="host_list" unique="0" required="1">
 <longdesc lang="en">
 A space separated list of ping nodes to count.
 </longdesc>
 <shortdesc lang="en">Host list</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
 <parameter name="attempts" unique="0">
 <longdesc lang="en">
 Number of ping attempts, per host, before declaring it dead
 </longdesc>
 <shortdesc lang="en">no. of ping attempts</shortdesc>
 <content type="integer" default="3"/>
 </parameter>
 
 <parameter name="timeout" unique="0">
 <longdesc lang="en">
 How long, in seconds, to wait before declaring a ping lost
 </longdesc>
 <shortdesc lang="en">ping timeout in seconds</shortdesc>
 <content type="integer" default="2"/>
 </parameter>
 
 <parameter name="options" unique="0">
 <longdesc lang="en">
 A catch all for any other options that need to be passed to ping.
 </longdesc>
 <shortdesc lang="en">Extra Options</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
 <parameter name="failure_score" unique="0">
 <longdesc lang="en">
 Resource is failed if the score is less than failure_score.
 Default never fails.
 </longdesc>
 <shortdesc lang="en">failure_score</shortdesc>
 <content type="integer" default=""/>
 </parameter>
 
 <parameter name="use_fping" unique="0">
 <longdesc lang="en">
 Use fping rather than ping, if found. If set to 0, fping
 will not be used even if present.
 </longdesc>
 <shortdesc lang="en">Use fping if available</shortdesc>
 <content type="boolean" default="1"/>
 </parameter>
 
 <parameter name="debug" unique="0">
 <longdesc lang="en">
 Enables to use default attrd_updater verbose logging on every call.
 </longdesc>
 <shortdesc lang="en">Verbose logging</shortdesc>
 <content type="string" default="false"/>
 </parameter>
 
 </parameters>
 
 <actions>
 <action name="start"   timeout="60" />
 <action name="stop"    timeout="20" />
 <action name="reload"  timeout="100" />
 <action name="monitor" depth="0"  timeout="60" interval="10"/>
 <action name="meta-data"  timeout="5" />
 <action name="validate-all"  timeout="30" />
 </actions>
 </resource-agent>
 END
 }
 
 #######################################################################
 
 ping_conditional_log() {
     level=$1; shift 
     if [ ${OCF_RESKEY_debug} = "true" ]; then
 	ocf_log $level "$*"
     fi
 }
 
 ping_usage() {
 	cat <<END
 usage: $0 {start|stop|monitor|validate-all|meta-data}
 
 Expects to have a fully populated OCF RA-compliant environment set.
 END
 }
 
 ping_start() {
     ping_monitor
     if [ $? =  $OCF_SUCCESS ]; then
 	return $OCF_SUCCESS
     fi
     touch ${OCF_RESKEY_pidfile}
     ping_update
 }
 
 ping_stop() {
 
 	rm -f ${OCF_RESKEY_pidfile}
     
     attrd_updater -D -n $OCF_RESKEY_name -d $OCF_RESKEY_dampen $attrd_options
     
     return $OCF_SUCCESS
 }
 
 ping_monitor() {
     if [ -f ${OCF_RESKEY_pidfile} ]; then
 	ping_update
         if [ $? -eq 0 ]; then
             return $OCF_SUCCESS
         fi
         return $OCF_ERR_GENERIC
     fi
     return $OCF_NOT_RUNNING
 }
 
 ping_validate() {
     # Is the state directory writable? 
     state_dir=`dirname "$OCF_RESKEY_pidfile"`
     touch "$state_dir/$$"
     if [ $? != 0 ]; then
 	ocf_log err "Invalid location for 'state': $state_dir is not writable"
 	return $OCF_ERR_ARGS
     fi
     rm "$state_dir/$$"
 
 # Pidfile better be an absolute path
     case $OCF_RESKEY_pidfile in
 	/*) ;;
 	*) ocf_log warn "You should use an absolute path for pidfile not: $OCF_RESKEY_pidfile" ;;
     esac
     
 # Check the host list
     if [ "x" = "x$OCF_RESKEY_host_list" ]; then 
 	ocf_log err "Empty host_list.  Please specify some nodes to ping"
 	exit $OCF_ERR_CONFIGURED
     fi
 
     check_binary ping
 
     return $OCF_SUCCESS
 }
 
 
 fping_check() {
     active=0
     f_out=`mktemp`
     f_err=`mktemp`
 
     n=$OCF_RESKEY_attempts
     timeout=`expr $OCF_RESKEY_timeout \* 1000 / $OCF_RESKEY_attempts`
 
     cmd="fping -r $OCF_RESKEY_attempts -t $timeout -B 1.0 $OCF_RESKEY_options $OCF_RESKEY_host_list"
     $cmd>$f_out 2>$f_err; rc=$?
     active=`grep alive $f_out|wc -l`
 
     case $rc in
  	0) 
 	    ;;
  	1) 
 	    for h in `grep unreachable $f_out | awk '{print $1}'`; do
 		ping_conditional_log warn "$h is inactive"
 	    done
 	    ;;
  	*) 
 	    ocf_log err "Unexpected result for '$cmd' $rc: `tr '\n' ';' < $f_err`"
 	    ;;
     esac
     rm -f $f_out $f_err
 
     return $active
 }
 
 ping_check() {
     active=0
     for host in $OCF_RESKEY_host_list; do
 	p_exe=ping
 
 	case `uname` in
 	    Linux) p_args="-n -q -W $OCF_RESKEY_timeout -c $OCF_RESKEY_attempts";;
 	    Darwin) p_args="-n -q -t $OCF_RESKEY_timeout -c $OCF_RESKEY_attempts -o";;
 	    *) ocf_log err "Unknown host type: `uname`"; exit $OCF_ERR_INSTALLED;;
 	esac
 
 	case $host in
 	    *:*) p_exe=ping6
 	esac
 	
 	p_out=`$p_exe $p_args $OCF_RESKEY_options $host 2>&1`; rc=$?
 
 	case $rc in
 	    0) active=`expr $active + 1`;;
 	    1) ping_conditional_log warn "$host is inactive: $p_out";;
 	    *) ocf_log err "Unexpected result for '$p_exe $p_args $OCF_RESKEY_options $host' $rc: $p_out";;
 	esac
     done
     return $active
 }
 
 ping_update() {
     
     if ocf_is_true "$OCF_RESKEY_use_fping" && have_binary fping; then
 	fping_check
 	active=$?
     else
 	ping_check
 	active=$?
     fi
 
     score=`expr $active \* $OCF_RESKEY_multiplier`
     attrd_updater -n $OCF_RESKEY_name -v $score -d $OCF_RESKEY_dampen $attrd_options
     rc=$?
     case $rc in 
 	0) ping_conditional_log debug "Updated $OCF_RESKEY_name = $score" ;;
 	*) ocf_log warn "Could not update $OCF_RESKEY_name = $score: rc=$rc";;
     esac
     if [ $rc -ne 0 ]; then
         return $rc
     fi
 
     if [ -n "$OCF_RESKEY_failure_score" -a "$score" -lt "$OCF_RESKEY_failure_score" ]; then
         ocf_log warn "$OCF_RESKEY_name is less than failure_score($OCF_RESKEY_failure_score)"
         return 1
     fi
     return 0
 }
 
 : ${OCF_RESKEY_name:="pingd"}
 : ${OCF_RESKEY_dampen:="5s"}
 : ${OCF_RESKEY_attempts:="3"}
 : ${OCF_RESKEY_multiplier:="1"}
 : ${OCF_RESKEY_debug:="false"}
 : ${OCF_RESKEY_failure_score:="0"}
 : ${OCF_RESKEY_use_fping:="1"}
 
 : ${OCF_RESKEY_CRM_meta_timeout:="20000"}
-: ${OCF_RESKEY_CRM_meta_globally_unique:="true"}
+: ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
 
 integer=`echo ${OCF_RESKEY_timeout} | egrep -o '[0-9]*'`
 case ${OCF_RESKEY_timeout} in
     *[0-9]ms|*[0-9]msec) OCF_RESKEY_timeout=`expr $integer / 1000`;;
     *[0-9]m|*[0-9]min) OCF_RESKEY_timeout=`expr $integer \* 60`;;
     *[0-9]h|*[0-9]hr)  OCF_RESKEY_timeout=`expr $integer \* 60 \* 60`;;
     *) OCF_RESKEY_timeout=$integer;;
 esac
 
 if [ -z ${OCF_RESKEY_timeout} ]; then
     if [ x"$OCF_RESKEY_host_list" != x ]; then
 	host_count=`echo $OCF_RESKEY_host_list | awk '{print NF}'`
 	OCF_RESKEY_timeout=`expr $OCF_RESKEY_CRM_meta_timeout / $host_count / $OCF_RESKEY_attempts`
 	OCF_RESKEY_timeout=`expr $OCF_RESKEY_timeout / 1100` # Convert to seconds and finish 10% early
     else
 	OCF_RESKEY_timeout=5
     fi
 fi
 
 if [ ${OCF_RESKEY_timeout} -lt 1 ]; then
     OCF_RESKEY_timeout=5
 elif [ ${OCF_RESKEY_timeout} -gt 1000 ]; then
     # ping actually complains if this value is too high, 5 minutes is plenty
     OCF_RESKEY_timeout=300
 fi
 
 if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then
-    : ${OCF_RESKEY_pidfile:="$HA_VARRUN/ping-${OCF_RESKEY_name}"}
+    : ${OCF_RESKEY_pidfile:="${HA_VARRUN%%/}/ping-${OCF_RESKEY_name}"}
 else 
-    : ${OCF_RESKEY_pidfile:="$HA_VARRUN/ping-${OCF_RESOURCE_INSTANCE}"}
+    : ${OCF_RESKEY_pidfile:="${HA_VARRUN%%/}/ping-${OCF_RESOURCE_INSTANCE}"}
 fi
 
 attrd_options='-q'
 if ocf_is_true ${OCF_RESKEY_debug} ; then
     attrd_options=''
 fi
 
 # Check the debug option    
     case "${OCF_RESKEY_debug}" in
 	true|True|TRUE|1)    OCF_RESKEY_debug=true;;
 	false|False|FALSE|0) OCF_RESKEY_debug=false;;
 	*)
             ocf_log warn "Value for 'debug' is incorrect. Please specify 'true' or 'false' not: ${OCF_RESKEY_debug}"
 	    OCF_RESKEY_debug=false
 	    ;;
     esac
 
 case $__OCF_ACTION in
 meta-data)	meta_data
 		exit $OCF_SUCCESS
 		;;
 start)		ping_start;;
 stop)		ping_stop;;
 monitor)	ping_monitor;;
 reload)		ping_start;;
 validate-all)	ping_validate;;
 usage|help)	ping_usage
 		exit $OCF_SUCCESS
 		;;
 *)		ping_usage
 		exit $OCF_ERR_UNIMPLEMENTED
 		;;
 esac
 exit $?
 
diff --git a/extra/resources/pingd b/extra/resources/pingd
index 8b20415299..add152642e 100644
--- a/extra/resources/pingd
+++ b/extra/resources/pingd
@@ -1,200 +1,200 @@
 #!/bin/sh
 #
 #
 #	pingd OCF Resource Agent
 #	Records (in the CIB) the current number of ping nodes a 
 #	   cluster node can connect to.
 #
 # Copyright (c) 2006 Andrew Beekhof
 #                    All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of version 2 of the GNU General Public License as
 # published by the Free Software Foundation.
 #
 # This program is distributed in the hope that it would be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
 # Further, this software is distributed without any warranty that it is
 # free of the rightful claim of any third person regarding infringement
 # or the like.  Any license provided herein, whether implied or
 # otherwise, applies only to this software file.  Patent licenses, if
 # any, provided herein do not apply to combinations of this program with
 # other software, or any other product whatsoever.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write the Free Software Foundation,
 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 #
 #######################################################################
 # Initialization:
 
 : ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
 : ${__OCF_ACTION=$1}
 
 : ${OCF_RESKEY_name:="pingd"}
 : ${OCF_RESKEY_interval:="1"}
 : ${OCF_RESKEY_CRM_meta_interval:=0}
 
 upgrade1="This agent (ocf:pacemaker:pingd) has been replaced by the more reliable ocf:pacemaker:ping."
 upgrade2="Attempting automated conversion, run 'crm ra info ocf:pacemaker:ping' for all configuration options"
 upgrade3="You will need to remove the existing resource and replace it with one that uses 'ocf:pacemaker:ping' directly"
 
 case $__OCF_ACTION in
     start|monitor)
 	if [ "x" != "x$OCF_RESKEY_host_list" ]; then
 	    ocf_log err "$upgrade1"
 	    ocf_log err "$upgrade2"
 	    ocf_log err "Automatic conversion to ocf:pacemaker:ping failed: no hosts were configured to check for connectivity"
 	    ocf_log err "$upgrade3"
 	    exit $OCF_ERR_ARGS
 	fi
 
 	recurring=`crm configure show $OCF_RESOURCE_INSTANCE | grep "op monitor.*interval=\"[1-9]" | sed s/.*interval=// | awk -F\" '{print $2}' | sed s/.*interval=// | awk -F\" '{print $2}' | sort | head -n 1`
 
 	if [ -z $recurring ]; then
 	    ocf_log err "$upgrade1"
 	    ocf_log err "$upgrade2"
 	    ocf_log err "Automatic conversion to ocf:pacemaker:ping failed: no monitor operation configured"
 	    ocf_log err "Without an explicit monitor operation for '$OCF_RESOURCE_INSTANCE', connectivity changes will not be noticed"
 	    ocf_log err "Preventing startup to ensure the issue is addressed before it matters"
 	    exit $OCF_ERR_ARGS
 	fi
 	
 	if [ $OCF_RESKEY_CRM_meta_interval = 0 ]; then
 	    ocf_log warn "$upgrade1"
 	    ocf_log warn "$upgrade2"
 	    if [ $recurring != $OCF_RESKEY_interval ]; then
 		ocf_log warn "Your monitor operation happens every $recurring, which means that the $OCF_RESKEY_name attribute will be updated with a different frequency than the previously configured ( $OCF_RESKEY_interval )"
 		ocf_log warn "Either change the monitor interval to match or, ideally, switch to the ocf:pacemaker:ping agent and avoid all this compatibility nonsense."
 	    fi
 	fi
 	;;
     meta-data)
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
 <resource-agent name="pingd">
 <version>1.0</version>
 <longdesc lang="en">
 This agent (ocf:pacemaker:pingd) has been replaced by the more reliable ocf:pacemaker:ping.
 It records (in the CIB) the current number of ping nodes (specified in the 'host_list' parameter) a cluster node can connect to.
 </longdesc>
 <shortdesc lang="en">pingd resource agent</shortdesc>
 
 <parameters>
 
 <parameter name="pidfile" unique="0">
 <longdesc lang="en">PID file</longdesc>
 <shortdesc lang="en">PID file</shortdesc>
-<content type="string" default="$HA_VARRUN/pingd-${OCF_RESOURCE_INSTANCE}" />
+<content type="string" default="${HA_VARRUN%%1}/pingd-${OCF_RESOURCE_INSTANCE}" />
 </parameter>
 
 
 <parameter name="user" unique="0">
 <longdesc lang="en">
 The user we want to run pingd as
 </longdesc>
 <shortdesc lang="en">The user we want to run pingd as</shortdesc>
 <content type="string" default="root" />
 </parameter>
 
 <parameter name="dampen" unique="0">
 <longdesc lang="en">
 The time to wait (dampening) further changes occur
 </longdesc>
 <shortdesc lang="en">Dampening interval</shortdesc>
 <content type="integer" default="5s"/>
 </parameter>
 
 <parameter name="set" unique="0">
 <longdesc lang="en">
 The name of the instance_attributes set to place the value in.  Rarely needs to be specified.
 </longdesc>
 <shortdesc lang="en">Set name</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
 <parameter name="name" unique="0">
 <longdesc lang="en">
 The name of the attributes to set.  This is the name to be used in the constraints.
 </longdesc>
 <shortdesc lang="en">Attribute name</shortdesc>
 <content type="string" default="pingd"/>
 </parameter>
 
 <parameter name="section" unique="0">
 <longdesc lang="en">
 The section place the value in.  Rarely needs to be specified.
 </longdesc>
 <shortdesc lang="en">Section name</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
 <parameter name="multiplier" unique="0">
 <longdesc lang="en">
 The number by which to multiply the number of connected ping nodes by
 </longdesc>
 <shortdesc lang="en">Value multiplier</shortdesc>
 <content type="integer" default=""/>
 </parameter>
 
 <parameter name="host_list" unique="0">
 <longdesc lang="en">
 The list of ping nodes to count.  Defaults to all configured ping nodes.  Rarely needs to be specified.
 </longdesc>
 <shortdesc lang="en">Host list</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
 <parameter name="interval" unique="0">
 <longdesc lang="en">
 How often, in seconds, to check for node liveliness
 </longdesc>
 <shortdesc lang="en">ping interval in seconds</shortdesc>
 <content type="integer" default="1"/>
 </parameter>
 
 <parameter name="attempts" unique="0">
 <longdesc lang="en">
 Number of ping attempts, per host, before declaring it dead
 </longdesc>
 <shortdesc lang="en">no. of ping attempts</shortdesc>
 <content type="integer" default="2"/>
 </parameter>
 
 <parameter name="timeout" unique="0">
 <longdesc lang="en">
 How long, in seconds, to wait before declaring a ping lost
 </longdesc>
 <shortdesc lang="en">ping timeout in seconds</shortdesc>
 <content type="integer" default="2"/>
 </parameter>
 
 <parameter name="options" unique="0">
 <longdesc lang="en">
 A catch all for any other options that need to be passed to pingd.
 </longdesc>
 <shortdesc lang="en">Extra Options</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
 </parameters>
 
 <actions>
 <action name="start"   timeout="90" />
 <action name="stop"    timeout="100" />
 <action name="monitor" depth="0"  timeout="20" interval="10" start-delay="1m" />
 <action name="meta-data"  timeout="5" />
 <action name="validate-all"  timeout="30" />
 </actions>
 </resource-agent>
 END
 	exit $OCF_SUCCESS
 	;;
 esac
 
 ${OCF_ROOT}/resource.d/pacemaker/ping $1
 exit $?