Table of Contents
Example 11.1. Resource template for a migratable Xen virtual machine
<template id="vm-template" class="ocf" provider="heartbeat" type="Xen">  <meta_attributes id="vm-template-meta_attributes">  <nvpair id="vm-template-meta_attributes-allow-migrate" name="allow-migrate" value="true"/>  </meta_attributes>  <utilization id="vm-template-utilization">  <nvpair id="vm-template-utilization-memory" name="memory" value="512"/>  </utilization>  <operations>  <op id="vm-template-monitor-15s" interval="15s" name="monitor" timeout="60s"/>  <op id="vm-template-start-0" interval="0" name="start" timeout="60s"/>  </operations> </template>
template property.
			Example 11.2. Xen primitive resource using a resource template
<primitive id="vm1" template="vm-template">  <instance_attributes id="vm1-instance_attributes">  <nvpair id="vm1-instance_attributes-name" name="name" value="vm1"/>  <nvpair id="vm1-instance_attributes-xmfile" name="xmfile" value="/etc/xen/shared-vm/vm1"/>  </instance_attributes> </primitive>
vm1 will inherit everything from vm-template. For example, the equivalent of the above two examples would be:
			Example 11.3. Equivalent Xen primitive resource not using a resource template
<primitive id="vm1" class="ocf" provider="heartbeat" type="Xen">  <meta_attributes id="vm-template-meta_attributes">  <nvpair id="vm-template-meta_attributes-allow-migrate" name="allow-migrate" value="true"/>  </meta_attributes>  <utilization id="vm-template-utilization">  <nvpair id="vm-template-utilization-memory" name="memory" value="512"/>  </utilization>  <operations>  <op id="vm-template-monitor-15s" interval="15s" name="monitor" timeout="60s"/>  <op id="vm-template-start-0" interval="0" name="start" timeout="60s"/>  </operations>  <instance_attributes id="vm1-instance_attributes">  <nvpair id="vm1-instance_attributes-name" name="name" value="vm1"/>  <nvpair id="vm1-instance_attributes-xmfile" name="xmfile" value="/etc/xen/shared-vm/vm1"/>  </instance_attributes> </primitive>
Example 11.4. Xen resource overriding template values
<primitive id="vm2" template="vm-template">  <meta_attributes id="vm2-meta_attributes">  <nvpair id="vm2-meta_attributes-allow-migrate" name="allow-migrate" value="false"/>  </meta_attributes>  <utilization id="vm2-utilization">  <nvpair id="vm2-utilization-memory" name="memory" value="1024"/>  </utilization>  <instance_attributes id="vm2-instance_attributes">  <nvpair id="vm2-instance_attributes-name" name="name" value="vm2"/>  <nvpair id="vm2-instance_attributes-xmfile" name="xmfile" value="/etc/xen/shared-vm/vm2"/>  </instance_attributes>  <operations>  <op id="vm2-monitor-30s" interval="30s" name="monitor" timeout="120s"/>  <op id="vm2-stop-0" interval="0" name="stop" timeout="60s"/>  </operations> </primitive>
vm2 has special attribute values. Its monitor operation has a longer timeout and interval, and the primitive has an additional stop operation.
			# crm_resource --query-xml --resource vm2
# crm_resource --query-xml-raw --resource vm2
order constraints (see Section 5.3, “Specifying the Order in which Resources Should Start/Stop”)
					colocation constraints (see Section 5.4, “Placing Resources Relative to other Resources”)
					rsc_ticket constraints (for multi-site clusters as described in Section 15.3, “Configuring Ticket Dependencies”)
					<rsc_colocation id="vm-template-colo-base-rsc" rsc="vm-template" rsc-role="Started" with-rsc="base-rsc" score="INFINITY"/>
base-rsc and is the equivalent of the following constraint configuration:
			<rsc_colocation id="vm-colo-base-rsc" score="INFINITY">  <resource_set id="vm-colo-base-rsc-0" sequential="false" role="Started">  <resource_ref id="vm1"/>  <resource_ref id="vm2"/>  </resource_set>  <resource_set id="vm-colo-base-rsc-1">  <resource_ref id="base-rsc"/>  </resource_set> </rsc_colocation>
Note
rsc or with-rsc; the other reference must be a regular resource.
				<rsc_order id="order1" score="INFINITY">  <resource_set id="order1-0">  <resource_ref id="base-rsc"/>  <resource_ref id="vm-template"/>  <resource_ref id="top-rsc"/>  </resource_set> </rsc_order>
<rsc_order id="order1" score="INFINITY">  <resource_set id="order1-0">  <resource_ref id="base-rsc"/>  <resource_ref id="vm1"/>  <resource_ref id="vm2"/>  <resource_ref id="top-rsc"/>  </resource_set> </rsc_order>
<rsc_order id="order2" score="INFINITY">  <resource_set id="order2-0">  <resource_ref id="base-rsc"/>  </resource_set>  <resource_set id="order2-1" sequential="false">  <resource_ref id="vm-template"/>  </resource_set>  <resource_set id="order2-2">  <resource_ref id="top-rsc"/>  </resource_set> </rsc_order>
<rsc_order id="order2" score="INFINITY">  <resource_set id="order2-0">  <resource_ref id="base-rsc"/>  </resource_set>  <resource_set id="order2-1" sequential="false">  <resource_ref id="vm1"/>  <resource_ref id="vm2"/>  </resource_set>  <resource_set id="order2-2">  <resource_ref id="top-rsc"/>  </resource_set> </rsc_order>