Product SiteDocumentation Site

6.5. Ordering Sets of Resources

A common situation is for an administrator to create a chain of ordered resources, such as:
Example 6.8. A chain of ordered resources

  <constraints>
    <rsc_order id="order-1" first="A" then="B" />
    <rsc_order id="order-2" first="B" then="C" />
    <rsc_order id="order-3" first="C" then="D" />
  </constraints>


Ordered Set
Visual representation of the four resources' start order for the above constraints
Figure 6.1. Ordered Set

To simplify this situation, there is an alternate format for ordering constraints
Example 6.9. A chain of ordered resources expressed as a set

  <constraints>
    <rsc_order id="order-1">
      <resource_set id="ordered-set-example" sequential="true">
        <resource_ref id="A"/>
        <resource_ref id="B"/>
        <resource_ref id="C"/>
        <resource_ref id="D"/>
      </resource_set>
    </rsc_order>
  </constraints>


Note

Resource sets have the same ordering semantics as groups.
Example 6.10. A group resource with the equivalent ordering rules

  <group id="dummy">
    <primitive id="A" .../>
    <primitive id="B" .../>
    <primitive id="C" .../>
    <primitive id="D" .../>
  </group>


While the set-based format is not less verbose, it is significantly easier to get right and maintain. It can also be expanded to allow ordered sets of (un)ordered resources. In the example below, rscA and rscB can both start in parallel, as can rscC and rscD, however rscC and rscD can only start once both rscA and rscB are active.
Example 6.11. Ordered sets of unordered resources

  <constraints>
    <rsc_order id="order-1">
      <resource_set id="ordered-set-1" sequential="false">
        <resource_ref id="A"/>
        <resource_ref id="B"/>
      </resource_set>
      <resource_set id="ordered-set-2" sequential="false">
        <resource_ref id="C"/>
        <resource_ref id="D"/>
      </resource_set>
    </rsc_order>
  </constraints>


Two Sets of Unordered Resources
Visual representation of the start order for two ordered sets of unordered resources
Figure 6.2. Two Sets of Unordered Resources

Of course either or both sets of resources can also be internally ordered (by setting sequential="true") and there is no limit to the number of sets that can be specified.
Example 6.12. Advanced use of set ordering - Three ordered sets, two of which are internally unordered

  <constraints>
    <rsc_order id="order-1">
      <resource_set id="ordered-set-1" sequential="false">
        <resource_ref id="A"/>
        <resource_ref id="B"/>
      </resource_set>
      <resource_set id="ordered-set-2" sequential="true">
        <resource_ref id="C"/>
        <resource_ref id="D"/>
      </resource_set>
      <resource_set id="ordered-set-3" sequential="false">
        <resource_ref id="E"/>
        <resource_ref id="F"/>
      </resource_set>
    </rsc_order>
  </constraints>


Three Resources Sets
Visual representation of the start order for the three sets defined above
Figure 6.3. Three Resources Sets