Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F3686963
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
51 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/cts/schemas/test-3/ref/upstart.ref-4 b/cts/schemas/test-3/ref/upstart.ref-4
index a1cb49b963..f395f98aaa 100644
--- a/cts/schemas/test-3/ref/upstart.ref-4
+++ b/cts/schemas/test-3/ref/upstart.ref-4
@@ -1,188 +1,111 @@
<cib crm_feature_set="3.19.7" validate-with="pacemaker-4.0" epoch="8" num_updates="0" admin_epoch="0" original="1">
<configuration original="1">
<!-- The essential elements of this test are:
* There is an upstart template and an ocf template.
* There are upstart and ocf primitives, defined either inline or by
reference to the corresponding template.
* There is a group with only upstart primitives and a group with both
upstart and ocf primitives.
* There is a cloned upstart resource and a cloned ocf resource.
* There is a cloned group containing only upstart primitives and a
cloned group containing both upstart and ocf primitives.
* There is a bundle containing an upstart primitive.
* There are various constraints, many of which reference upstart
resources.
In this situation:
* The upstart templates and primitives should be dropped, while the ocf
ones should be kept.
* Groups and clones that would become empty should be dropped.
* Groups containing ocf primitives should be kept; only their upstart
members should be dropped.
* The bundle should be kept so that its container remains managed; its
primitive should be dropped.
* Constraints with attributes referencing upstart resources should be
dropped.
* Resource sets containing only references to upstart resources should
be dropped.
* Constraints with resource sets should be dropped if all of their
resource sets should be dropped.
-->
<crm_config original="1"/>
<nodes original="1"/>
<resources original="1">
- <template id="template_drop" class="upstart" type="Dummy" original="1"/>
<template id="template_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/>
- <primitive id="primitive1_drop" class="upstart" type="Dummy" original="1"/>
<primitive id="primitive2_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/>
- <primitive id="primitive3_drop" template="template_drop" original="1"/>
<primitive id="primitive4_keep" template="template_keep" original="1"/>
- <group id="grp1_drop" original="1">
- <primitive id="grp1_rsc1_drop" class="upstart" type="Dummy" original="1"/>
- <primitive id="grp1_rsc2_drop" template="template_drop" original="1"/>
- </group>
<group id="grp2_keep" original="1">
- <primitive id="grp2_rsc1_drop" class="upstart" type="Dummy" original="1"/>
<primitive id="grp2_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/>
- <primitive id="grp2_rsc3_drop" template="template_drop" original="1"/>
<primitive id="grp2_rsc4_keep" template="template_keep" original="1"/>
</group>
- <clone id="clone1_drop" original="1">
- <primitive id="clone1_rsc_drop" class="upstart" type="Dummy" original="1"/>
- </clone>
<clone id="clone2_keep" original="1">
<primitive id="clone2_rsc_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/>
</clone>
- <clone id="clone3_drop" original="1">
- <group id="clone3_grp_drop" original="1">
- <primitive id="clone3_grp_rsc1_drop" class="upstart" type="Dummy" original="1"/>
- <primitive id="clone3_grp_rsc2_drop" template="template_drop" original="1"/>
- </group>
- </clone>
<clone id="clone4_keep" original="1">
<group id="clone4_grp_keep" original="1">
- <primitive id="clone4_grp_rsc1_drop" class="upstart" type="Dummy" original="1"/>
<primitive id="clone4_grp_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/>
- <primitive id="clone4_grp_rsc3_drop" template="template_drop" original="1"/>
<primitive id="clone4_grp_rsc4_keep" template="template_keep" original="1"/>
</group>
</clone>
<bundle id="bundle_keep" original="1">
<podman image="image" original="1"/>
- <primitive id="bundle_rsc_drop" class="upstart" type="Dummy" original="1"/>
</bundle>
</resources>
<constraints original="1">
- <rsc_location id="location1_drop" rsc="primitive1_drop" node="node1" score="INFINITY" original="1"/>
<rsc_location id="location2_keep" rsc="primitive2_keep" node="node1" score="INFINITY" original="1"/>
- <rsc_location id="location3_drop" node="node1" score="INFINITY" original="1">
- <resource_set id="location3_drop-set" original="1">
- <resource_ref id="grp1_drop" original="1"/>
- <resource_ref id="clone1_drop" original="1"/>
- </resource_set>
- </rsc_location>
<rsc_location id="location4_keep" node="node1" score="INFINITY" original="1">
<resource_set id="location4_keep-set" original="1">
<resource_ref id="clone2_keep" original="1"/>
- <resource_ref id="clone3_drop" original="1"/>
<resource_ref id="clone4_keep" original="1"/>
</resource_set>
</rsc_location>
<rsc_location id="location5_keep" node="node1" score="INFINITY" original="1">
- <resource_set id="location5_keep-set_drop" original="1">
- <resource_ref id="grp1_drop" original="1"/>
- <resource_ref id="clone1_drop" original="1"/>
- </resource_set>
<resource_set id="location5_keep-set_keep" original="1">
<resource_ref id="clone2_keep" original="1"/>
- <resource_ref id="clone3_drop" original="1"/>
<resource_ref id="clone4_keep" original="1"/>
</resource_set>
</rsc_location>
<rsc_location id="location6_keep" rsc-pattern="primitive1_drop" node="node1" score="INFINITY" original="1"/>
- <rsc_colocation id="colocation1_drop" rsc="primitive1_drop" with-rsc="primitive2_keep" original="1"/>
- <rsc_colocation id="colocation2_drop" rsc="primitive2_keep" with-rsc="primitive1_drop" original="1"/>
- <rsc_colocation id="colocation3_drop" rsc="primitive3_drop" with-rsc="primitive1_drop" original="1"/>
<rsc_colocation id="colocation4_keep" rsc="primitive4_keep" with-rsc="primitive2_keep" original="1"/>
- <rsc_colocation id="colocation5_drop" original="1">
- <resource_set id="colocation5_drop-set" original="1">
- <resource_ref id="grp1_drop" original="1"/>
- <resource_ref id="clone1_drop" original="1"/>
- </resource_set>
- </rsc_colocation>
<rsc_colocation id="colocation6_keep" original="1">
<resource_set id="colocation6_keep-set" original="1">
<resource_ref id="clone2_keep" original="1"/>
- <resource_ref id="clone3_drop" original="1"/>
<resource_ref id="clone4_keep" original="1"/>
</resource_set>
</rsc_colocation>
<rsc_colocation id="colocation7_keep" original="1">
- <resource_set id="colocation7_keep-set_drop" original="1">
- <resource_ref id="grp1_drop" original="1"/>
- <resource_ref id="clone1_drop" original="1"/>
- </resource_set>
<resource_set id="colocation7_keep-set_keep" original="1">
<resource_ref id="clone2_keep" original="1"/>
- <resource_ref id="clone3_drop" original="1"/>
<resource_ref id="clone4_keep" original="1"/>
</resource_set>
</rsc_colocation>
- <rsc_order id="order1_drop" first="primitive1_drop" then="primitive2_keep" original="1"/>
- <rsc_order id="order2_drop" first="primitive2_keep" then="primitive1_drop" original="1"/>
- <rsc_order id="order3_drop" first="primitive3_drop" then="primitive1_drop" original="1"/>
<rsc_order id="order4_keep" first="primitive4_keep" then="primitive2_keep" original="1"/>
- <rsc_order id="order5_drop" original="1">
- <resource_set id="order5_drop-set" original="1">
- <resource_ref id="grp1_drop" original="1"/>
- <resource_ref id="clone1_drop" original="1"/>
- </resource_set>
- </rsc_order>
<rsc_order id="order6_keep" original="1">
<resource_set id="order6_keep-set" original="1">
<resource_ref id="clone2_keep" original="1"/>
- <resource_ref id="clone3_drop" original="1"/>
<resource_ref id="clone4_keep" original="1"/>
</resource_set>
</rsc_order>
<rsc_order id="order7_keep" original="1">
- <resource_set id="order7_keep-set_drop" original="1">
- <resource_ref id="grp1_drop" original="1"/>
- <resource_ref id="clone1_drop" original="1"/>
- </resource_set>
<resource_set id="order7_keep-set_keep" original="1">
<resource_ref id="clone2_keep" original="1"/>
- <resource_ref id="clone3_drop" original="1"/>
<resource_ref id="clone4_keep" original="1"/>
</resource_set>
</rsc_order>
- <rsc_ticket id="ticket1_drop" rsc="primitive1_drop" ticket="ticket1" original="1"/>
<rsc_ticket id="ticket2_keep" rsc="primitive2_keep" ticket="ticket1" original="1"/>
- <rsc_ticket id="ticket3_drop" ticket="ticket1" original="1">
- <resource_set id="ticket3_drop-set" original="1">
- <resource_ref id="grp1_drop" original="1"/>
- <resource_ref id="clone1_drop" original="1"/>
- </resource_set>
- </rsc_ticket>
<rsc_ticket id="ticket4_keep" ticket="ticket1" original="1">
<resource_set id="ticket4_keep-set" original="1">
<resource_ref id="clone2_keep" original="1"/>
- <resource_ref id="clone3_drop" original="1"/>
<resource_ref id="clone4_keep" original="1"/>
</resource_set>
</rsc_ticket>
<rsc_ticket id="ticket5_keep" ticket="ticket1" original="1">
- <resource_set id="ticket5_keep-set_drop" original="1">
- <resource_ref id="grp1_drop" original="1"/>
- <resource_ref id="clone1_drop" original="1"/>
- </resource_set>
<resource_set id="ticket5_keep-set_keep" original="1">
<resource_ref id="clone2_keep" original="1"/>
- <resource_ref id="clone3_drop" original="1"/>
<resource_ref id="clone4_keep" original="1"/>
</resource_set>
</rsc_ticket>
</constraints>
</configuration>
<status original="1"/>
</cib>
diff --git a/cts/schemas/test-3/ref/upstart.ref-99 b/cts/schemas/test-3/ref/upstart.ref-99
index 3c06cf056f..83e90b3b17 100644
--- a/cts/schemas/test-3/ref/upstart.ref-99
+++ b/cts/schemas/test-3/ref/upstart.ref-99
@@ -1,188 +1,111 @@
<cib crm_feature_set="3.19.7" validate-with="pacemaker-4.0" epoch="8" num_updates="0" admin_epoch="0">
<configuration>
<!-- The essential elements of this test are:
* There is an upstart template and an ocf template.
* There are upstart and ocf primitives, defined either inline or by
reference to the corresponding template.
* There is a group with only upstart primitives and a group with both
upstart and ocf primitives.
* There is a cloned upstart resource and a cloned ocf resource.
* There is a cloned group containing only upstart primitives and a
cloned group containing both upstart and ocf primitives.
* There is a bundle containing an upstart primitive.
* There are various constraints, many of which reference upstart
resources.
In this situation:
* The upstart templates and primitives should be dropped, while the ocf
ones should be kept.
* Groups and clones that would become empty should be dropped.
* Groups containing ocf primitives should be kept; only their upstart
members should be dropped.
* The bundle should be kept so that its container remains managed; its
primitive should be dropped.
* Constraints with attributes referencing upstart resources should be
dropped.
* Resource sets containing only references to upstart resources should
be dropped.
* Constraints with resource sets should be dropped if all of their
resource sets should be dropped.
-->
<crm_config/>
<nodes/>
<resources>
- <template id="template_drop" class="upstart" type="Dummy"/>
<template id="template_keep" class="ocf" provider="pacemaker" type="Dummy"/>
- <primitive id="primitive1_drop" class="upstart" type="Dummy"/>
<primitive id="primitive2_keep" class="ocf" provider="pacemaker" type="Dummy"/>
- <primitive id="primitive3_drop" template="template_drop"/>
<primitive id="primitive4_keep" template="template_keep"/>
- <group id="grp1_drop">
- <primitive id="grp1_rsc1_drop" class="upstart" type="Dummy"/>
- <primitive id="grp1_rsc2_drop" template="template_drop"/>
- </group>
<group id="grp2_keep">
- <primitive id="grp2_rsc1_drop" class="upstart" type="Dummy"/>
<primitive id="grp2_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy"/>
- <primitive id="grp2_rsc3_drop" template="template_drop"/>
<primitive id="grp2_rsc4_keep" template="template_keep"/>
</group>
- <clone id="clone1_drop">
- <primitive id="clone1_rsc_drop" class="upstart" type="Dummy"/>
- </clone>
<clone id="clone2_keep">
<primitive id="clone2_rsc_keep" class="ocf" provider="pacemaker" type="Dummy"/>
</clone>
- <clone id="clone3_drop">
- <group id="clone3_grp_drop">
- <primitive id="clone3_grp_rsc1_drop" class="upstart" type="Dummy"/>
- <primitive id="clone3_grp_rsc2_drop" template="template_drop"/>
- </group>
- </clone>
<clone id="clone4_keep">
<group id="clone4_grp_keep">
- <primitive id="clone4_grp_rsc1_drop" class="upstart" type="Dummy"/>
<primitive id="clone4_grp_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy"/>
- <primitive id="clone4_grp_rsc3_drop" template="template_drop"/>
<primitive id="clone4_grp_rsc4_keep" template="template_keep"/>
</group>
</clone>
<bundle id="bundle_keep">
<podman image="image"/>
- <primitive id="bundle_rsc_drop" class="upstart" type="Dummy"/>
</bundle>
</resources>
<constraints>
- <rsc_location id="location1_drop" rsc="primitive1_drop" node="node1" score="INFINITY"/>
<rsc_location id="location2_keep" rsc="primitive2_keep" node="node1" score="INFINITY"/>
- <rsc_location id="location3_drop" node="node1" score="INFINITY">
- <resource_set id="location3_drop-set">
- <resource_ref id="grp1_drop"/>
- <resource_ref id="clone1_drop"/>
- </resource_set>
- </rsc_location>
<rsc_location id="location4_keep" node="node1" score="INFINITY">
<resource_set id="location4_keep-set">
<resource_ref id="clone2_keep"/>
- <resource_ref id="clone3_drop"/>
<resource_ref id="clone4_keep"/>
</resource_set>
</rsc_location>
<rsc_location id="location5_keep" node="node1" score="INFINITY">
- <resource_set id="location5_keep-set_drop">
- <resource_ref id="grp1_drop"/>
- <resource_ref id="clone1_drop"/>
- </resource_set>
<resource_set id="location5_keep-set_keep">
<resource_ref id="clone2_keep"/>
- <resource_ref id="clone3_drop"/>
<resource_ref id="clone4_keep"/>
</resource_set>
</rsc_location>
<rsc_location id="location6_keep" rsc-pattern="primitive1_drop" node="node1" score="INFINITY"/>
- <rsc_colocation id="colocation1_drop" rsc="primitive1_drop" with-rsc="primitive2_keep"/>
- <rsc_colocation id="colocation2_drop" rsc="primitive2_keep" with-rsc="primitive1_drop"/>
- <rsc_colocation id="colocation3_drop" rsc="primitive3_drop" with-rsc="primitive1_drop"/>
<rsc_colocation id="colocation4_keep" rsc="primitive4_keep" with-rsc="primitive2_keep"/>
- <rsc_colocation id="colocation5_drop">
- <resource_set id="colocation5_drop-set">
- <resource_ref id="grp1_drop"/>
- <resource_ref id="clone1_drop"/>
- </resource_set>
- </rsc_colocation>
<rsc_colocation id="colocation6_keep">
<resource_set id="colocation6_keep-set">
<resource_ref id="clone2_keep"/>
- <resource_ref id="clone3_drop"/>
<resource_ref id="clone4_keep"/>
</resource_set>
</rsc_colocation>
<rsc_colocation id="colocation7_keep">
- <resource_set id="colocation7_keep-set_drop">
- <resource_ref id="grp1_drop"/>
- <resource_ref id="clone1_drop"/>
- </resource_set>
<resource_set id="colocation7_keep-set_keep">
<resource_ref id="clone2_keep"/>
- <resource_ref id="clone3_drop"/>
<resource_ref id="clone4_keep"/>
</resource_set>
</rsc_colocation>
- <rsc_order id="order1_drop" first="primitive1_drop" then="primitive2_keep"/>
- <rsc_order id="order2_drop" first="primitive2_keep" then="primitive1_drop"/>
- <rsc_order id="order3_drop" first="primitive3_drop" then="primitive1_drop"/>
<rsc_order id="order4_keep" first="primitive4_keep" then="primitive2_keep"/>
- <rsc_order id="order5_drop">
- <resource_set id="order5_drop-set">
- <resource_ref id="grp1_drop"/>
- <resource_ref id="clone1_drop"/>
- </resource_set>
- </rsc_order>
<rsc_order id="order6_keep">
<resource_set id="order6_keep-set">
<resource_ref id="clone2_keep"/>
- <resource_ref id="clone3_drop"/>
<resource_ref id="clone4_keep"/>
</resource_set>
</rsc_order>
<rsc_order id="order7_keep">
- <resource_set id="order7_keep-set_drop">
- <resource_ref id="grp1_drop"/>
- <resource_ref id="clone1_drop"/>
- </resource_set>
<resource_set id="order7_keep-set_keep">
<resource_ref id="clone2_keep"/>
- <resource_ref id="clone3_drop"/>
<resource_ref id="clone4_keep"/>
</resource_set>
</rsc_order>
- <rsc_ticket id="ticket1_drop" rsc="primitive1_drop" ticket="ticket1"/>
<rsc_ticket id="ticket2_keep" rsc="primitive2_keep" ticket="ticket1"/>
- <rsc_ticket id="ticket3_drop" ticket="ticket1">
- <resource_set id="ticket3_drop-set">
- <resource_ref id="grp1_drop"/>
- <resource_ref id="clone1_drop"/>
- </resource_set>
- </rsc_ticket>
<rsc_ticket id="ticket4_keep" ticket="ticket1">
<resource_set id="ticket4_keep-set">
<resource_ref id="clone2_keep"/>
- <resource_ref id="clone3_drop"/>
<resource_ref id="clone4_keep"/>
</resource_set>
</rsc_ticket>
<rsc_ticket id="ticket5_keep" ticket="ticket1">
- <resource_set id="ticket5_keep-set_drop">
- <resource_ref id="grp1_drop"/>
- <resource_ref id="clone1_drop"/>
- </resource_set>
<resource_set id="ticket5_keep-set_keep">
<resource_ref id="clone2_keep"/>
- <resource_ref id="clone3_drop"/>
<resource_ref id="clone4_keep"/>
</resource_set>
</rsc_ticket>
</constraints>
</configuration>
<status/>
</cib>
diff --git a/xml/resources-4.0.rng b/xml/resources-4.0.rng
index 726f8c493b..44cd16e51e 100644
--- a/xml/resources-4.0.rng
+++ b/xml/resources-4.0.rng
@@ -1,380 +1,377 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<ref name="element-resources"/>
</start>
<!--
Include rule definitions so that we can override element-nvset.rule based on
context
-->
<include href="rule-4.0.rng">
<start combine="choice">
<notAllowed/>
</start>
</include>
<define name="element-resources">
<element name="resources">
<zeroOrMore>
<choice>
<ref name="element-primitive"/>
<ref name="element-template"/>
<ref name="element-group"/>
<ref name="element-clone"/>
<ref name="element-bundle"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="element-primitive">
<element name="primitive">
<interleave>
<attribute name="id"><data type="ID"/></attribute>
<choice>
<group>
<ref name="element-resource-class"/>
<attribute name="type"><text/></attribute>
</group>
<attribute name="template"><data type="IDREF"/></attribute>
</choice>
<optional>
<attribute name="description"><text/></attribute>
</optional>
<ref name="element-resource-extra.primitive-template"/>
<ref name="element-operations"/>
</interleave>
</element>
</define>
<define name="element-template">
<element name="template">
<interleave>
<attribute name="id"><data type="ID"/></attribute>
<ref name="element-resource-class"/>
<attribute name="type"><text/></attribute>
<optional>
<attribute name="description"><text/></attribute>
</optional>
<ref name="element-resource-extra.primitive-template"/>
<ref name="element-operations"/>
</interleave>
</element>
</define>
<define name="element-bundle">
<element name="bundle">
<interleave>
<attribute name="id"><data type="ID"/></attribute>
<optional>
<attribute name="description"><text/></attribute>
</optional>
<ref name="element-resource-extra"/>
<choice>
<element name="docker">
<attribute name="image"><text/></attribute>
<optional>
<attribute name="replicas"><data type="integer"/></attribute>
</optional>
<optional>
<attribute name="replicas-per-host"><data type="integer"/></attribute>
</optional>
<optional>
<attribute name="promoted-max"><data type="integer"/></attribute>
</optional>
<optional>
<attribute name="run-command"> <text/></attribute>
</optional>
<optional>
<attribute name="network"><text/></attribute>
</optional>
<optional>
<attribute name="options"><text/></attribute>
</optional>
</element>
<!-- @COMPAT rkt containers in bundles are deprecated since 2.1.8 -->
<element name="rkt">
<attribute name="image"><text/></attribute>
<optional>
<attribute name="replicas"><data type="integer"/></attribute>
</optional>
<optional>
<attribute name="replicas-per-host"><data type="integer"/></attribute>
</optional>
<optional>
<attribute name="promoted-max"><data type="integer"/></attribute>
</optional>
<optional>
<attribute name="run-command"> <text/></attribute>
</optional>
<optional>
<attribute name="network"><text/></attribute>
</optional>
<optional>
<attribute name="options"><text/></attribute>
</optional>
</element>
<element name="podman">
<attribute name="image"><text/></attribute>
<optional>
<attribute name="replicas"><data type="integer"/></attribute>
</optional>
<optional>
<attribute name="replicas-per-host"><data type="integer"/></attribute>
</optional>
<optional>
<attribute name="promoted-max"><data type="integer"/></attribute>
</optional>
<optional>
<attribute name="run-command"> <text/></attribute>
</optional>
<optional>
<attribute name="network"><text/></attribute>
</optional>
<optional>
<attribute name="options"><text/></attribute>
</optional>
</element>
</choice>
<optional>
<element name="network">
<optional>
<attribute name="ip-range-start"><text/></attribute>
</optional>
<optional>
<attribute name="control-port"><data type="integer"/></attribute>
</optional>
<optional>
<attribute name="host-interface"><text/></attribute>
</optional>
<optional>
<attribute name="host-netmask"><data type="integer"/></attribute>
</optional>
<optional>
<attribute name="add-host"><data type="boolean"/></attribute>
</optional>
<zeroOrMore>
<element name="port-mapping">
<attribute name="id"><data type="ID"/></attribute>
<choice>
<group>
<attribute name="port"><data type="integer"/></attribute>
<optional>
<attribute name="internal-port"><data type="integer"/></attribute>
</optional>
</group>
<attribute name="range">
<data type="string">
<param name="pattern">([0-9\-]+)</param>
</data>
</attribute>
</choice>
</element>
</zeroOrMore>
</element>
</optional>
<optional>
<element name="storage">
<zeroOrMore>
<element name="storage-mapping">
<attribute name="id"><data type="ID"/></attribute>
<choice>
<attribute name="source-dir"><text/></attribute>
<attribute name="source-dir-root"><text/></attribute>
</choice>
<attribute name="target-dir"><text/></attribute>
<optional>
<attribute name="options"><text/></attribute>
</optional>
</element>
</zeroOrMore>
</element>
</optional>
<optional>
<ref name="element-primitive"/>
</optional>
</interleave>
</element>
</define>
<define name="element-group">
<element name="group">
<attribute name="id"><data type="ID"/></attribute>
<optional>
<attribute name="description"><text/></attribute>
</optional>
<interleave>
<ref name="element-resource-extra"/>
<oneOrMore>
<ref name="element-primitive"/>
</oneOrMore>
</interleave>
</element>
</define>
<define name="element-clone">
<element name="clone">
<attribute name="id"><data type="ID"/></attribute>
<optional>
<attribute name="description"><text/></attribute>
</optional>
<interleave>
<ref name="element-resource-extra"/>
<choice>
<ref name="element-primitive"/>
<ref name="element-group"/>
</choice>
</interleave>
</element>
</define>
<define name="element-resource-extra">
<zeroOrMore>
<choice>
<ref name="element-instance_attributes"/>
<element name="meta_attributes">
<externalRef href="nvset-4.0.rng"/>
</element>
</choice>
</zeroOrMore>
</define>
<define name="element-resource-extra.primitive-template">
<zeroOrMore>
<choice>
<ref name="element-instance_attributes"/>
<element name="meta_attributes">
<externalRef href="nvset-4.0.rng"/>
</element>
<element name="utilization">
<externalRef href="nvset-4.0.rng"/>
</element>
</choice>
</zeroOrMore>
</define>
<define name="element-resource-extra.op">
<zeroOrMore>
<choice>
<ref name="element-instance_attributes"/>
<element name="meta_attributes">
<grammar>
<include href="nvset-4.0.rng">
<!--
@COMPAT: Support for node attribute expressions is deprecated
here. We can just delete this define when we drop support.
-->
<define name="element-nvset.rule">
<parentRef name="element-rule-node-allowed"/>
</define>
</include>
</grammar>
</element>
</choice>
</zeroOrMore>
</define>
<define name="element-operations">
<optional>
<element name="operations">
<optional>
<attribute name="id"><data type="ID"/></attribute>
</optional>
<optional>
<attribute name="id-ref"><data type="IDREF"/></attribute>
</optional>
<zeroOrMore>
<element name="op">
<attribute name="id"><data type="ID"/></attribute>
<attribute name="name"><text/></attribute>
<attribute name="interval"><text/></attribute>
<optional>
<attribute name="description"><text/></attribute>
</optional>
<optional>
<choice>
<attribute name="start-delay"><text/></attribute>
<attribute name="interval-origin"><text/></attribute>
</choice>
</optional>
<optional>
<attribute name="timeout"><text/></attribute>
</optional>
<optional>
<attribute name="enabled"><data type="boolean"/></attribute>
</optional>
<optional>
<attribute name="record-pending"><data type="boolean"/></attribute>
</optional>
<optional>
<attribute name="role">
<choice>
<value>Stopped</value>
<value>Started</value>
<value>Promoted</value>
<value>Unpromoted</value>
<value>Slave</value>
<value>Master</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="on-fail">
<choice>
<value>ignore</value>
<value>block</value>
<value>demote</value>
<value>stop</value>
<value>restart</value>
<value>standby</value>
<value>fence</value>
<value>restart-container</value>
</choice>
</attribute>
</optional>
<ref name="element-resource-extra.op"/>
</element>
</zeroOrMore>
</element>
</optional>
</define>
<define name="element-resource-class">
<choice>
<group>
<attribute name="class"><value>ocf</value></attribute>
<attribute name="provider"><text/></attribute>
</group>
<attribute name="class">
<choice>
<value>lsb</value>
<value>heartbeat</value>
<value>stonith</value>
<value>service</value>
<value>systemd</value>
- <!-- @COMPAT upstart resources are deprecated since 2.1.0 -->
- <value>upstart</value>
-
<!-- @COMPAT nagios resources are deprecated since 2.1.6 -->
<value>nagios</value>
</choice>
</attribute>
</choice>
</define>
<define name="element-instance_attributes">
<element name="instance_attributes">
<grammar>
<include href="nvset-4.0.rng">
<define name="element-nvset.rule">
<parentRef name="element-rule-node-allowed"/>
</define>
</include>
</grammar>
</element>
</define>
</grammar>
diff --git a/xml/upgrade-3.10-3.xsl b/xml/upgrade-3.10-3.xsl
index ccf37c2d18..91debb4fed 100644
--- a/xml/upgrade-3.10-3.xsl
+++ b/xml/upgrade-3.10-3.xsl
@@ -1,228 +1,229 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Use comments liberally as future maintainers may be unfamiliar with XSLT.
-->
<!--
upgrade-3.10-3.xsl
Guarantees after this transformation:
* There are no lifetime elements.
* If a lifetime element existed in a location constraint prior to this
transformation, we drop it. If the lifetime element had multiple top-level
rules, we nest them inside a single "or" rule; otherwise, we keep the
top-level lifetime rule as-is. Then we do the following with it:
* If the constraint did not have a top-level rule, the lifetime-based rule
becomes the constraint's top-level rule.
* If the constraint already had a top-level rule, we create a new "and"
top-level constraint rule, containing the existing top-level constraint
rule and the lifetime-based rule.
* If a lifetime element existed in a colocation or order constraint prior to
this transformation, its rules are in a new location constraint that does
not apply to any resources. This is in case some other rule references
them. A rule in a lifetime element may contain a node attribute expression,
which is now allowed only within a location constraint rule.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="upgrade-3.10-common.xsl"/>
+<!-- Index all rules by ID -->
<xsl:key name='rule_id' match="rule" use="@id"/>
<!-- Copy everything unaltered by default -->
<xsl:template match="/|@*|node()">
<xsl:call-template name="identity"/>
</xsl:template>
<!-- Constraints -->
<!--
Create a new location constraint that doesn't match any resources, to hold the
defined rules from deleted lifetime elements in colocation and order
constraints that are still referenced elsewhere (if any)
-->
<xsl:template match="constraints">
<!-- All colocation and ordering constraints -->
<xsl:variable name="coloc_order" select="rsc_colocation|rsc_order"/>
<!--
All rules originally defined in colocation/ordering lifetime elements
-->
<xsl:variable name="co_lifetime_rules"
select="$coloc_order/lifetime/rule
[boolean(number(@original))]"/>
<!--
Rule IDs from $co_lifetime_rule_ids that will still be referenced somewhere
after dropping colocation/ordering lifetime elements
-->
<xsl:variable name="co_lifetime_live_rules"
select="$co_lifetime_rules
[count(key('rule_id', @id)/ancestor::lifetime
[parent::rsc_colocation or parent::rsc_order])
!= count(key('rule_id', @id))]"/>
<!--
The rules in $co_lifetime_live_rules are referenced elsewhere, so they need
definitions. The end of the transformation pipeline would ensure that the
first remaining occurrence of the rule remains a definition while the rest
become references. However, a lifetime rule may contain a node attribute
expression, so its definition should go inside a rsc_location, the last
remaining element type that supports rules with node attribute expressions.
It is likely a mistake if some context besides a location constraint or a
lifetime element references a rule with a node attribute expression in a
lifetime element. However, it is allowed by the pacemaker-3.10 schema, and
we want to ensure the upgraded CIB still validates against the
pacemaker-4.0 schema provided the input CIB validates against the
pacemaker-3.10 schema.
-->
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:if test="$co_lifetime_live_rules">
<xsl:variable name="location_id"
select="concat($upgrade_prefix,
'coloc-order-lifetime-rules')"/>
<!-- New location constraint to hold rules: matches no resources -->
<xsl:element name="rsc_location">
<xsl:attribute name="id">
<xsl:value-of select="$location_id"/>
</xsl:attribute>
<!-- Nothing can come before the beginning-of-string anchor -->
<xsl:attribute name="rsc-pattern">a^</xsl:attribute>
<!-- Top-level wrapper rule: score and boolean-op don't matter -->
<xsl:element name="rule">
<xsl:attribute name="id">
<xsl:value-of select="concat($location_id, '-rule')"/>
</xsl:attribute>
<xsl:attribute name="score">-INFINITY</xsl:attribute>
<xsl:apply-templates select="$co_lifetime_live_rules"/>
</xsl:element>
</xsl:element>
</xsl:if>
</xsl:copy>
</xsl:template>
<!--
Generate an equivalent rule from a constraint's node and score attributes.
The context node is assumed to be a location constraint with node and score
attributes.
-->
<xsl:template name="node_score_rule">
<xsl:variable name="rule_id"
select="concat($upgrade_prefix, @id, '-node-score-rule')"/>
<xsl:element name="rule">
<xsl:attribute name="id">
<xsl:value-of select="$rule_id"/>
</xsl:attribute>
<xsl:apply-templates select="@score"/>
<xsl:element name="expression">
<xsl:attribute name="id">
<xsl:value-of select="concat($rule_id, '-expr')"/>
</xsl:attribute>
<xsl:attribute name="attribute">#uname</xsl:attribute>
<xsl:attribute name="operation">eq</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="@node"/>
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:template>
<!--
For a lifetime element in a location constraint, nest its rules (joined into
an "or" rule if there are multiple) inside a top-level rule of the
constraint.
* If there was already a top-level rule, nest it alongside the lifetime-based
rule in a new top-level "and" rule.
* Otherwise, create a new rule equivalent to the node and score XML attributes,
and nest it alongside the lifetime-based rule in a new top-level "and" rule.
For the constraint to apply, at least one of the lifetime rules must apply, and
either the node XML attribute must match or the existing top-level rule must be
satisfied.
-->
<xsl:template match="rsc_location[lifetime]">
<xsl:copy>
<!-- Existing attributes (except node and score) and resource sets -->
<xsl:apply-templates select="@*[(local-name() != 'node')
and (local-name() != 'score')]
|resource_set"/>
<xsl:element name="rule">
<!--
Set a probably-unique ID for the new wrapper rule, based on the
rsc_location ID
-->
<xsl:attribute name="id">
<xsl:value-of select="concat($upgrade_prefix, @id,
'-lifetime-and-rule')"/>
</xsl:attribute>
<xsl:attribute name="boolean-op">and</xsl:attribute>
<!-- Include existing top-level rule or node/score attributes -->
<xsl:choose>
<xsl:when test="rule">
<!-- Existing top-level rule -->
<xsl:apply-templates select="rule"/>
</xsl:when>
<xsl:otherwise>
<!-- New rule from node and score attributes -->
<xsl:call-template name="node_score_rule"/>
</xsl:otherwise>
</xsl:choose>
<!--
Lifetime element's rules (either singleton or nested in a new "or"
rule)
-->
<xsl:apply-templates select="lifetime"/>
</xsl:element>
</xsl:copy>
</xsl:template>
<!--
For a lifetime element with multiple rules within a location constraint, nest
the rules within an "or" wrapper and drop the lifetime element.
-->
<xsl:template match="rsc_location/lifetime[count(rule) > 1]">
<xsl:element name="rule">
<!--
Set a probably-unique ID for the new wrapper rule, based on the
rsc_location ID
-->
<xsl:attribute name="id">
<xsl:value-of select="concat($upgrade_prefix, ../@id,
'-lifetime-or-rule')"/>
</xsl:attribute>
<xsl:attribute name="boolean-op">or</xsl:attribute>
<xsl:apply-templates select="rule"/>
</xsl:element>
</xsl:template>
<!--
For a lifetime element with only one rule within a location constraint, simply
drop the lifetime element and keep the rule.
-->
<xsl:template match="rsc_location/lifetime[count(rule) = 1]">
<xsl:apply-templates select="rule"/>
</xsl:template>
<!-- Drop lifetime elements within colocation and order constraints -->
<xsl:template match="rsc_colocation/lifetime"/>
<xsl:template match="rsc_order/lifetime"/>
</xsl:stylesheet>
diff --git a/xml/upgrade-3.10-4.xsl b/xml/upgrade-3.10-4.xsl
index 7cddc049af..5c7bd8cc35 100644
--- a/xml/upgrade-3.10-4.xsl
+++ b/xml/upgrade-3.10-4.xsl
@@ -1,23 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Use comments liberally as future maintainers may be unfamiliar with XSLT.
-->
<!--
upgrade-3.10-4.xsl
Guarantees after this transformation:
+ * There are no upstart-class resources. If there were any prior to this
+ transformation, they have been dropped.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="upgrade-3.10-common.xsl"/>
+<!-- XSLT 1.0 lacks upper-case() and lower-case() functions -->
+<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
+<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
+
+<!-- Index all resource templates by ID -->
+<xsl:key name="template_id" match="template" use="@id"/>
+
<!-- Copy everything unaltered by default -->
<xsl:template match="/|@*|node()">
<xsl:call-template name="identity"/>
</xsl:template>
+
+<!-- Resources -->
+
+<!-- The following XSL templates use XPath 1.0 set intersection idioms -->
+
+<!-- Upstart-class templates -->
+<xsl:variable name="dropped_templates"
+ select="//template
+ [translate(@class, $upper, $lower) = 'upstart']"/>
+
+<!-- Upstart-class primitives -->
+<xsl:variable name="dropped_primitives"
+ select="//primitive
+ [(translate(@class, $upper, $lower) = 'upstart')
+ or (@template
+ and (count(key('template_id', @template)
+ |$dropped_templates)
+ = count($dropped_templates)))]"/>
+
+<!-- Groups containing only upstart-class primitives -->
+<xsl:variable name="dropped_groups"
+ select="//group[count(primitive|$dropped_primitives)
+ = count($dropped_primitives)]"/>
+
+<!-- Clones containing only upstart-class primitives -->
+<xsl:variable name="dropped_clones"
+ select="//clone[count(.//primitive|$dropped_primitives)
+ = count($dropped_primitives)]"/>
+
+<!-- All dropped resources -->
+<xsl:variable name="dropped_resources"
+ select="$dropped_primitives|$dropped_groups|$dropped_clones"/>
+
+<!-- Drop upstart-class resource templates -->
+<xsl:template match="template">
+ <xsl:if test="count(.|$dropped_templates) != count($dropped_templates)">
+ <xsl:call-template name="identity"/>
+ </xsl:if>
+</xsl:template>
+
+<!-- Drop upstart-class primitives -->
+<xsl:template match="primitive">
+ <xsl:if test="count(.|$dropped_primitives) != count($dropped_primitives)">
+ <xsl:call-template name="identity"/>
+ </xsl:if>
+</xsl:template>
+
+<!-- Drop groups that would become empty -->
+<xsl:template match="group">
+ <xsl:if test="count(.|$dropped_groups) != count($dropped_groups)">
+ <xsl:call-template name="identity"/>
+ </xsl:if>
+</xsl:template>
+
+<!-- Drop clones that would become empty -->
+<xsl:template match="clone">
+ <xsl:if test="count(.|$dropped_clones) != count($dropped_clones)">
+ <xsl:call-template name="identity"/>
+ </xsl:if>
+</xsl:template>
+
+
+<!-- Constraints -->
+
+<!-- Drop resource refs that refer to dropped resources -->
+<xsl:variable name="dropped_resource_refs"
+ select="//resource_ref[@id = $dropped_resources/@id]"/>
+
+<xsl:template match="resource_ref">
+ <xsl:if test="count(.|$dropped_resource_refs)
+ != count($dropped_resource_refs)">
+ <xsl:call-template name="identity"/>
+ </xsl:if>
+</xsl:template>
+
+<!-- Drop resource sets that would become empty -->
+<xsl:variable name="dropped_resource_sets"
+ select="//resource_set
+ [count(resource_ref|$dropped_resource_refs)
+ = count($dropped_resource_refs)]"/>
+
+<xsl:template match="resource_set">
+ <xsl:if test="count(.|$dropped_resource_sets)
+ != count($dropped_resource_sets)">
+ <xsl:call-template name="identity"/>
+ </xsl:if>
+</xsl:template>
+
+<!-- Drop constraints that would contain no valid resource references -->
+<xsl:template match="rsc_location|rsc_ticket">
+ <xsl:choose>
+ <xsl:when test="@rsc = $dropped_resources/@id"/>
+
+ <!-- The constraint contained resource sets, and they're all dropped -->
+ <xsl:when test="resource_set
+ and (count(resource_set|$dropped_resource_sets)
+ = count($dropped_resource_sets))"/>
+
+ <xsl:otherwise>
+ <xsl:call-template name="identity"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="rsc_colocation">
+ <xsl:choose>
+ <xsl:when test="@rsc = $dropped_resources/@id"/>
+ <xsl:when test="@with-rsc = $dropped_resources/@id"/>
+ <xsl:when test="resource_set
+ and (count(resource_set|$dropped_resource_sets)
+ = count($dropped_resource_sets))"/>
+ <xsl:otherwise>
+ <xsl:call-template name="identity"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="rsc_order">
+ <xsl:choose>
+ <xsl:when test="@first = $dropped_resources/@id"/>
+ <xsl:when test="@then = $dropped_resources/@id"/>
+ <xsl:when test="resource_set
+ and (count(resource_set|$dropped_resource_sets)
+ = count($dropped_resource_sets))"/>
+ <xsl:otherwise>
+ <xsl:call-template name="identity"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
</xsl:stylesheet>
diff --git a/xml/upgrade-3.10-common.xsl b/xml/upgrade-3.10-common.xsl
index 6859b61ea3..0bda64141c 100644
--- a/xml/upgrade-3.10-common.xsl
+++ b/xml/upgrade-3.10-common.xsl
@@ -1,98 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Use comments liberally as future maintainers may be unfamiliar with XSLT.
-->
<!--
upgrade-3.10-common.xsl
This stylesheet is intended to be imported by all other stylesheets in the
upgrade-3.10-* pipeline. It provides variables and templates that are used by
multiple stylesheets.
This file should not contain any templates with a match attribute.
Assumptions:
* The input XML validates against the pacemaker-3.10.rng schema.
* No element of the input XML contains an id attribute whose value begins with
"pcmk__3_10_upgrade-". This allows us to generate new IDs without fear of
conflict. However, the schema does not enforce this assumption.
+ * For attributes of type IDREF, the referenced element is of the correct type.
+ For example, the rsc attribute in a constraint refers to a resource element
+ (primitive, group, clone, bundle). The schema cannot enforce this assumption;
+ it requires only that each IDREF refer to a valid ID. As a result, the result
+ of our transformation pipeline may fail to validate if IDREFs refer to
+ unexpected element types.
+
+ @TODO Try to clean up IDREFs to unexpected element types when the referenced
+ elements are removed.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Strip whitespace-only text nodes but indent output -->
<xsl:strip-space elements="*"/>
<xsl:output encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<!-- Prefix for auto-generated IDs -->
<xsl:variable name="upgrade_prefix" select="'pcmk__3_10_upgrade-'"/>
<!--
Modified identity transformation. Copy everything unaltered by default, but set
the "original" attribute based on the "original" template param.
"original" is a temporary attribute to indicate that an element existed in the
input XML. It's not allowed by the schema for any element, so we don't have to
worry about conflicts.
The first step in the upgrade pipeline is to resolve id-ref attributes (type
IDREF) to id attributes (type ID). We do this as follows. For each element with
an id-ref attribute, replace that element with a deep copy of the referenced
element. Set the "original" attribute to 0 in the copy.
At the end of the upgrade pipeline, we convert back to references as follows.
For each element with an id attribute and with the "original" attribute either
unset or set to 0:
* If there is another element with the same id value that either occurs before
the current element or has original="1", convert the current element back to
a reference with only the id-ref attribute.
* Otherwise, drop the "original" attribute and leave the rest of the current
element's attributes and descendants unchanged (except for converting
descendants back to references if needed).
Notes:
* We resolve all attributes named id-ref (which are of type IDREF). We do not
resolve all attributes of type IDREF. We resolve only in the places where
either a definition (with id) or a reference (with id-ref) would validate
against the pacemaker-3.10 schema (ignoring ID uniqueness requirements after
resolution).
* If the "original" attribute is unset for an element, the end of the
transformation pipeline treats the element as if it had original="0".
* By default, if the "original" param is set, then it's passed down with the
same value for all descendants.
-->
<!--
Identity transformation, optionally setting the "original" attribute
Params:
* original: Boolean (1/0) indicating whether an element was part of the
original input XML. If set and this is an element node, the param
is used as the value for the "original" attribute for this element
and its descendants.
-->
<xsl:template name="identity">
<xsl:param name="original"/>
<xsl:copy>
<!-- All existing attributes -->
<xsl:apply-templates select="@*"/>
<xsl:if test="self::* and $original">
<!-- Set "original" attribute for element nodes -->
<xsl:attribute name="original">
<xsl:value-of select="$original"/>
</xsl:attribute>
</xsl:if>
<!-- All nodes, passing down $original value recursively -->
<xsl:apply-templates select="node()">
<xsl:with-param name="original" select="$original"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Apr 21, 6:15 PM (1 d, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1665158
Default Alt Text
(51 KB)
Attached To
Mode
rP Pacemaker
Attached
Detach File
Event Timeline
Log In to Comment