diff --git a/cts/schemas/test-3/ref.err/bundle-promoted-max-legacy.ref.err-4 b/cts/schemas/test-3/ref.err/bundle-promoted-max-legacy.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/duplicate-nvpairs-no-default.ref.err-4 b/cts/schemas/test-3/ref.err/duplicate-nvpairs-no-default.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/duplicate-nvpairs-with-default.ref.err-4 b/cts/schemas/test-3/ref.err/duplicate-nvpairs-with-default.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/id-ref.ref.err-4 b/cts/schemas/test-3/ref.err/id-ref.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/lifetime-1.ref.err-4 b/cts/schemas/test-3/ref.err/lifetime-1.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/lifetime-2.ref.err-4 b/cts/schemas/test-3/ref.err/lifetime-2.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/multiple-location-rules.ref.err-4 b/cts/schemas/test-3/ref.err/multiple-location-rules.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/nagios.ref.err-0 b/cts/schemas/test-3/ref.err/nagios.ref.err-0 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/nagios.ref.err-1 b/cts/schemas/test-3/ref.err/nagios.ref.err-1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/nagios.ref.err-2 b/cts/schemas/test-3/ref.err/nagios.ref.err-2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/nagios.ref.err-3 b/cts/schemas/test-3/ref.err/nagios.ref.err-3 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/nagios.ref.err-4 b/cts/schemas/test-3/ref.err/nagios.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/nagios.ref.err-99 b/cts/schemas/test-3/ref.err/nagios.ref.err-99 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/no-validate-with.ref.err-4 b/cts/schemas/test-3/ref.err/no-validate-with.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/nvpair-no-value.ref.err-4 b/cts/schemas/test-3/ref.err/nvpair-no-value.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/rkt.ref.err-0 b/cts/schemas/test-3/ref.err/rkt.ref.err-0 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/rkt.ref.err-1 b/cts/schemas/test-3/ref.err/rkt.ref.err-1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/rkt.ref.err-2 b/cts/schemas/test-3/ref.err/rkt.ref.err-2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/rkt.ref.err-3 b/cts/schemas/test-3/ref.err/rkt.ref.err-3 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/rkt.ref.err-4 b/cts/schemas/test-3/ref.err/rkt.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/rkt.ref.err-99 b/cts/schemas/test-3/ref.err/rkt.ref.err-99 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/sort-nvsets.ref.err-4 b/cts/schemas/test-3/ref.err/sort-nvsets.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/upstart.ref.err-0 b/cts/schemas/test-3/ref.err/upstart.ref.err-0 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/upstart.ref.err-1 b/cts/schemas/test-3/ref.err/upstart.ref.err-1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/upstart.ref.err-2 b/cts/schemas/test-3/ref.err/upstart.ref.err-2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/upstart.ref.err-3 b/cts/schemas/test-3/ref.err/upstart.ref.err-3 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/upstart.ref.err-4 b/cts/schemas/test-3/ref.err/upstart.ref.err-4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref.err/upstart.ref.err-99 b/cts/schemas/test-3/ref.err/upstart.ref.err-99 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cts/schemas/test-3/ref/bundle-promoted-max-legacy.ref-99 b/cts/schemas/test-3/ref/bundle-promoted-max-legacy.ref-4 similarity index 60% copy from cts/schemas/test-3/ref/bundle-promoted-max-legacy.ref-99 copy to cts/schemas/test-3/ref/bundle-promoted-max-legacy.ref-4 index 732082bf80..4bceee3db1 100644 --- a/cts/schemas/test-3/ref/bundle-promoted-max-legacy.ref-99 +++ b/cts/schemas/test-3/ref/bundle-promoted-max-legacy.ref-4 @@ -1,26 +1,23 @@ -<cib crm_feature_set="3.19.7" validate-with="pacemaker-4.0" epoch="8" num_updates="0" admin_epoch="0"> - <configuration> +<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 are three bundle resource with masters attributes (one with each type of container). In this situation, the masters attribute should be replaced with a promoted-max attribute with the same value. --> - <crm_config/> - <nodes/> - <resources> - <bundle id="bundle1"> - <docker image="alpine:latest" promoted-max="2" run-command="sleep 60"/> + <crm_config original="1"/> + <nodes original="1"/> + <resources original="1"> + <bundle id="bundle1" original="1"> + <docker image="alpine:latest" promoted-max="2" run-command="sleep 60" original="1"/> </bundle> - <bundle id="bundle2"> - <podman image="alpine:latest" promoted-max="2" run-command="sleep 60"/> - </bundle> - <bundle id="bundle3"> - <rkt image="alpine:latest" promoted-max="2" run-command="sleep 60"/> + <bundle id="bundle2" original="1"> + <podman image="alpine:latest" promoted-max="2" run-command="sleep 60" original="1"/> </bundle> </resources> - <constraints/> + <constraints original="1"/> </configuration> - <status/> + <status original="1"/> </cib> diff --git a/cts/schemas/test-3/ref/bundle-promoted-max-legacy.ref-99 b/cts/schemas/test-3/ref/bundle-promoted-max-legacy.ref-99 index 732082bf80..a69b6bfab0 100644 --- a/cts/schemas/test-3/ref/bundle-promoted-max-legacy.ref-99 +++ b/cts/schemas/test-3/ref/bundle-promoted-max-legacy.ref-99 @@ -1,26 +1,23 @@ <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 are three bundle resource with masters attributes (one with each type of container). In this situation, the masters attribute should be replaced with a promoted-max attribute with the same value. --> <crm_config/> <nodes/> <resources> <bundle id="bundle1"> <docker image="alpine:latest" promoted-max="2" run-command="sleep 60"/> </bundle> <bundle id="bundle2"> <podman image="alpine:latest" promoted-max="2" run-command="sleep 60"/> </bundle> - <bundle id="bundle3"> - <rkt image="alpine:latest" promoted-max="2" run-command="sleep 60"/> - </bundle> </resources> <constraints/> </configuration> <status/> </cib> diff --git a/cts/schemas/test-3/ref/duplicate-nvpairs-no-default.ref-4 b/cts/schemas/test-3/ref/duplicate-nvpairs-no-default.ref-4 new file mode 100644 index 0000000000..9f0abd6d13 --- /dev/null +++ b/cts/schemas/test-3/ref/duplicate-nvpairs-no-default.ref-4 @@ -0,0 +1,41 @@ +<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 one of each kind of several nvset element + (cluster_property_set, instance_attributes, meta_attributes, + utilization). + * Each nvset contains multiple nvpairs with the same name, as well as + one nvpair with a different name. + * There are no nvpairs with value="#default". + * One nvset uses id-refs. + + In this situation, only the first nvpair with a given name in a given + nvset should be kept. Any subsequent ones should be dropped. + --> + <crm_config original="1"> + <cluster_property_set id="cib-bootstrap-options" original="1"> + <nvpair id="cib-bootstrap-options-option1" name="option" value="value1" original="1"/> + <nvpair id="cib-bootstrap-options-other-option" name="other-option" value="value0" original="1"/> + </cluster_property_set> + </crm_config> + <nodes original="1"/> + <resources original="1"> + <primitive class="ocf" id="rsc1" provider="heartbeat" type="apache" original="1"> + <instance_attributes id="rsc1-instance_attributes" original="1"> + <nvpair id="rsc1-instance_attributes-option1" name="option" value="value1" original="1"/> + <nvpair id="rsc1-instance_attributes-other-option" name="other-option" value="value0" original="1"/> + </instance_attributes> + <meta_attributes id="rsc1-meta_attributes" original="1"> + <nvpair id="rsc1-meta_attributes-option1" name="option" value="value1" original="1"/> + <nvpair id="rsc1-meta_attributes-other-option" name="other-option" value="value0" original="1"/> + </meta_attributes> + <utilization id="rsc1-utilization" original="1"> + <nvpair id="rsc1-utilization-other-option" name="other-option" value="valueX" original="1"/> + <nvpair id="rsc1-meta_attributes-option1" name="option" value="value1" original="0"/> + </utilization> + </primitive> + </resources> + <constraints original="1"/> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/duplicate-nvpairs-with-default.ref-4 b/cts/schemas/test-3/ref/duplicate-nvpairs-with-default.ref-4 new file mode 100644 index 0000000000..b2e24f4e22 --- /dev/null +++ b/cts/schemas/test-3/ref/duplicate-nvpairs-with-default.ref-4 @@ -0,0 +1,51 @@ +<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 one of each kind of several nvset element + (cluster_property_set, instance_attributes, meta_attributes, + utilization). + * Each nvset contains multiple nvpairs with the same name (two of which + have value "#default"), as well as one nvpair with a different name. + * Two nvsets use id-refs. + + In this situation: + * If the last nvpair with a given name in a given nvset has value + "#default", keep only that one. + * Otherwise, keep only the first nvpair with a given name in a given + nvset after the last one with that name and value "#default". + --> + <crm_config original="1"> + <cluster_property_set id="cluster-properties1" original="1"> + <nvpair id="cluster-properties1-option3" name="option" value="value3" original="1"/> + <nvpair id="cluster-properties1-other-option" name="other-option" value="value0" original="1"/> + </cluster_property_set> + <cluster_property_set id="cluster-properties2" original="1"> + <nvpair id="cluster-properties2-option4" name="option" value="value4" original="1"/> + <nvpair id="cluster-properties2-other-option" name="other-option" value="value0" original="1"/> + </cluster_property_set> + </crm_config> + <nodes original="1"/> + <resources original="1"> + <primitive class="ocf" id="rsc1" provider="heartbeat" type="apache" original="1"> + <instance_attributes id="rsc1-instance_attributes" original="1"> + <nvpair id="rsc1-instance_attributes-other-option" name="other-option" value="value0" original="1"/> + <nvpair id="rsc1-instance_attributes-option4" name="option" value="value4" original="1"/> + </instance_attributes> + <meta_attributes id="rsc1-meta_attributes" original="1"> + <nvpair id="rsc1-meta_attributes-other-option" name="other-option" value="value0" original="1"/> + <nvpair id="rsc1-meta_attributes-option5" name="option" value="value5" original="1"/> + </meta_attributes> + <utilization id="rsc1-utilization1" original="1"> + <nvpair id="rsc1-utilization1-other-option" name="other-option" value="valueX" original="1"/> + <nvpair id="rsc1-utilization1-option5" name="option" value="#default" original="1"/> + </utilization> + <utilization id="rsc1-utilization2" original="1"> + <nvpair id="rsc1-utilization1-other-option" name="other-option" value="valueX" original="0"/> + <nvpair id="rsc1-utilization1-option5" name="option" value="#default" original="0"/> + </utilization> + </primitive> + </resources> + <constraints original="1"/> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/id-ref.ref-4 b/cts/schemas/test-3/ref/id-ref.ref-4 new file mode 100644 index 0000000000..d33ffb253e --- /dev/null +++ b/cts/schemas/test-3/ref/id-ref.ref-4 @@ -0,0 +1,71 @@ +<cib crm_feature_set="3.19.7" validate-with="pacemaker-4.0" epoch="16" num_updates="0" admin_epoch="0" original="1"> + <configuration original="1"> + <!-- The essential elements of this test are: + * There is a cluster_properties_set element with an id attribute (set + to cluster-properties1) and a set of nvpair children. + * There are two cluster_properties_set elements with an id-ref + attribute (set to cluster-properties1): one before and one after the + original. + * There is a primitive resource (rsc1) with a meta_attributes element + containing nvpair children. + * The first nvpair is a definition (has an id attribute). + * The second has an id-ref attribute with no name attribute. + * The third has id-ref="cluster-properties1-option1" and + name="option3". Setting both id-ref and name is an undocumented + feature that allows the same nvpair value to be used with multiple + names (see commit 3912538 and associated pull request). + + In this situation: + * In the first step of the upgrade transformation pipeline: + * Each element with an id-ref attribute without a name attribute + should be replaced by a copy of the element whose id attribute is + set to the same value, but with the "original" attribute set to 1. + * Each element with an id-ref attribute and a name attribute should + be replaced by a copy of the element whose id attribute is set to + the original id-ref value, except that in the copy: + * The id attribute begins with $upgrade_prefix and ends with the + value of @name. + * The name attribute is overridden by the reference's @name value. + * In the final step: + * Resolved references that did not have name attributes should be + converted back to references. + * For resolved references that did have name attributes, such that + the id of the resolved element differs from the original id-ref + value: + * The first element with the new id value remains expanded as a + definition. + * Any subsequent elements with the new id value are converted to + references to the first one. + --> + <crm_config original="1"> + <cluster_property_set id="cluster-properties1" original="0"> + <nvpair id="cluster-properties1-option1" name="option1" value="value1" original="0"/> + <nvpair id="cluster-properties1-option2" name="option2" value="value2" original="0"/> + </cluster_property_set> + <cluster_property_set id="cluster-properties1" original="1"> + <nvpair id="cluster-properties1-option1" name="option1" value="value1" original="1"/> + <nvpair id="cluster-properties1-option2" name="option2" value="value2" original="1"/> + </cluster_property_set> + <cluster_property_set id="cluster-properties1" original="0"> + <nvpair id="cluster-properties1-option1" name="option1" value="value1" original="0"/> + <nvpair id="cluster-properties1-option2" name="option2" value="value2" original="0"/> + </cluster_property_set> + </crm_config> + <nodes original="1"/> + <resources original="1"> + <primitive id="rsc1" class="ocf" provider="pacemaker" type="Dummy" original="1"> + <meta_attributes id="rsc1-meta_attributes" original="1"> + <nvpair id="rsc1-meta_attributes-option1" name="option1" value="valueX" original="1"/> + <nvpair id="pcmk__3_10_upgrade-cluster-properties1-option1-option3" name="option3" value="value1" original="0"/> + </meta_attributes> + </primitive> + <primitive id="rsc2" class="ocf" provider="pacemaker" type="Dummy" original="1"> + <meta_attributes id="rsc2-meta_attributes" original="1"> + <nvpair id="pcmk__3_10_upgrade-cluster-properties1-option1-option3" name="option3" value="value1" original="0"/> + </meta_attributes> + </primitive> + </resources> + <constraints original="1"/> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/lifetime-1.ref-4 b/cts/schemas/test-3/ref/lifetime-1.ref-4 new file mode 100644 index 0000000000..1eb33227dd --- /dev/null +++ b/cts/schemas/test-3/ref/lifetime-1.ref-4 @@ -0,0 +1,136 @@ +<cib crm_feature_set="3.19.7" validate-with="pacemaker-4.0" epoch="16" num_updates="0" admin_epoch="0" original="1"> + <configuration original="1"> + <!-- The essential elements of this test are: + * There are four location constraints: + * ban-rsc1-node1 uses node/score and has a lifetime element with two + defined rules. + * ban-rsc2-node1 uses a top-level rule and has a lifetime element + with two referenced rules. + * ban-rsc3-node1 uses node/score and has a lifetime element with one + defined rule. + * ban-rsc4-node1 uses a top-level rule and has a lifetime element + with one referenced rule. + * There are two colocation constraints: + * rsc2-with-rsc1 has a lifetime element with two defined rules. + * rsc4-with-rsc3 has a lifetime element with two referenced rules. + * There are two order constraints: + * rsc1-then-rsc2 has a lifetime element with two defined rules. + * rsc3-then-rsc4 has a lifetime element with two referenced rules. + * A cluster_property_set ("cluster-properties") references two rules + that are defined in the lifetime elements of colocation and order + constraints. + + In this situation: + * All lifetime elements should be removed. + * For ban-rsc1-node1, the node/score attributes should be removed and a + compound "and" rule should be created containing the following: + * A rule version of the node/score attributes + * A compound "or" rule containing the lifetime rules + * For ban-rsc1-node2, a compound "and" rule should be created + containing the following: + * The existing top-level rule + * A compound "or" rule containing the lifetime rules + * For ban-rsc1-node3, a compound "and" rule should be created + containing the following: + * A rule version of the node/score attributes + * The lifetime rule + * For ban-rsc1-node4, a compound "and" rule should be created + containing the following: + * The existing top-level rule + * The lifetime rule + * A new location constraint should be created with a rsc-pattern that + can't match any resources. It should have a compound rule containing + all the rules defined in the lifetime elements of the colocation and + order constraints that are referenced elsewhere + (rsc2-with-rsc1-lifetime-rule1 and rsc1-then-rsc2-lifetime-rule2). + --> + <crm_config original="1"> + <cluster_property_set id="cluster-properties" original="1"> + <rule id="cluster-properties-rule" original="1"> + <rule id="rsc1-then-rsc2-lifetime-rule2" original="0"> + <date_expression id="rsc1-then-rsc2-lifetime-rule2-expr" operation="in_range" end="2005-001" original="0"/> + </rule> + <rule id="rsc2-with-rsc1-lifetime-rule1" original="0"> + <date_expression id="rsc2-with-rsc1-lifetime-rule1-expr" operation="in_range" start="2004-001" original="0"/> + </rule> + </rule> + </cluster_property_set> + </crm_config> + <nodes original="1"> + <node id="node1" uname="node1" type="member" original="1"/> + </nodes> + <resources original="1"> + <primitive id="rsc1" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + <primitive id="rsc2" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + <primitive id="rsc3" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + <primitive id="rsc4" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + </resources> + <constraints original="1"> + <rsc_location id="ban-rsc1-node1" rsc="rsc1" original="1"> + <rule id="pcmk__3_10_upgrade-ban-rsc1-node1-lifetime-and-rule" boolean-op="and"> + <rule id="pcmk__3_10_upgrade-ban-rsc1-node1-node-score-rule" score="-INFINITY"> + <expression id="pcmk__3_10_upgrade-ban-rsc1-node1-node-score-rule-expr" attribute="#uname" operation="eq" value="node1"/> + </rule> + <rule id="pcmk__3_10_upgrade-ban-rsc1-node1-lifetime-or-rule" boolean-op="or"> + <rule id="ban-rsc1-node1-lifetime-rule1" original="1"> + <date_expression id="ban-rsc1-node1-lifetime-rule1-expr" operation="in_range" start="2004-001" original="1"/> + </rule> + <rule id="ban-rsc1-node1-lifetime-rule2" original="1"> + <date_expression id="ban-rsc1-node1-lifetime-rule2-expr" operation="in_range" end="2005-001" original="1"/> + </rule> + </rule> + </rule> + </rsc_location> + <rsc_location id="ban-rsc2-node1" rsc="rsc2" original="1"> + <rule id="pcmk__3_10_upgrade-ban-rsc2-node1-lifetime-and-rule" boolean-op="and"> + <rule id="ban-rsc2-node1-rule" score="-INFINITY" original="1"> + <expression id="ban-rsc2-node1-rule-expr" attribute="#uname" operation="eq" value="node1" original="1"/> + </rule> + <rule id="pcmk__3_10_upgrade-ban-rsc2-node1-lifetime-or-rule" boolean-op="or"> + <rule id="ban-rsc1-node1-lifetime-rule1" original="0"> + <date_expression id="ban-rsc1-node1-lifetime-rule1-expr" operation="in_range" start="2004-001" original="0"/> + </rule> + <rule id="ban-rsc1-node1-lifetime-rule2" original="0"> + <date_expression id="ban-rsc1-node1-lifetime-rule2-expr" operation="in_range" end="2005-001" original="0"/> + </rule> + </rule> + </rule> + </rsc_location> + <rsc_location id="ban-rsc3-node1" rsc="rsc3" original="1"> + <rule id="pcmk__3_10_upgrade-ban-rsc3-node1-lifetime-and-rule" boolean-op="and"> + <rule id="pcmk__3_10_upgrade-ban-rsc3-node1-node-score-rule" score="-INFINITY"> + <expression id="pcmk__3_10_upgrade-ban-rsc3-node1-node-score-rule-expr" attribute="#uname" operation="eq" value="node1"/> + </rule> + <rule id="ban-rsc3-node1-lifetime-rule" original="1"> + <date_expression id="ban-rsc3-node1-lifetime-rule-expr" operation="in_range" start="2004-001" original="1"/> + </rule> + </rule> + </rsc_location> + <rsc_location id="ban-rsc4-node1" rsc="rsc4" original="1"> + <rule id="pcmk__3_10_upgrade-ban-rsc4-node1-lifetime-and-rule" boolean-op="and"> + <rule id="ban-rsc4-node1-rule" score="-INFINITY" original="1"> + <expression id="ban-rsc4-node1-rule-expr" attribute="#uname" operation="eq" value="node1" original="1"/> + </rule> + <rule id="ban-rsc3-node1-lifetime-rule" original="0"> + <date_expression id="ban-rsc3-node1-lifetime-rule-expr" operation="in_range" start="2004-001" original="0"/> + </rule> + </rule> + </rsc_location> + <rsc_colocation id="rsc2-with-rsc1" score="INFINITY" rsc="rsc2" with-rsc="rsc1" original="1"/> + <rsc_colocation id="rsc4-with-rsc3" score="INFINITY" rsc="rsc4" with-rsc="rsc3" original="1"/> + <rsc_order id="rsc1-then-rsc2" first="rsc1" then="rsc2" original="1"/> + <rsc_order id="rsc3-then-rsc4" first="rsc3" then="rsc4" original="1"/> + <rsc_location id="pcmk__3_10_upgrade-coloc-order-lifetime-rules" rsc-pattern="a^"> + <rule id="pcmk__3_10_upgrade-coloc-order-lifetime-rules-rule" score="-INFINITY"> + <rule id="rsc2-with-rsc1-lifetime-rule1" original="1"> + <date_expression id="rsc2-with-rsc1-lifetime-rule1-expr" operation="in_range" start="2004-001" original="1"/> + </rule> + <rule id="rsc1-then-rsc2-lifetime-rule2" original="1"> + <date_expression id="rsc1-then-rsc2-lifetime-rule2-expr" operation="in_range" end="2005-001" original="1"/> + </rule> + </rule> + </rsc_location> + </constraints> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/lifetime-2.ref-4 b/cts/schemas/test-3/ref/lifetime-2.ref-4 new file mode 100644 index 0000000000..e3483efadb --- /dev/null +++ b/cts/schemas/test-3/ref/lifetime-2.ref-4 @@ -0,0 +1,34 @@ +<cib crm_feature_set="3.19.7" validate-with="pacemaker-4.0" epoch="16" num_updates="0" admin_epoch="0" original="1"> + <configuration original="1"> + <!-- The essential elements of this test are: + * There are two colocation constraints: + * rsc2-with-rsc1 has a lifetime element with two defined rules. + * rsc4-with-rsc3 has a lifetime element with two referenced rules. + * There are two order constraints: + * rsc1-then-rsc2 has a lifetime element with two defined rules. + * rsc3-then-rsc4 has a lifetime element with two referenced rules. + * The rules defined in the colocation and order constraints are not + referenced anywhere else. + + In this situation, all lifetime elements should be removed, along with + their rule definitions. + --> + <crm_config original="1"/> + <nodes original="1"> + <node id="node1" uname="node1" type="member" original="1"/> + </nodes> + <resources original="1"> + <primitive id="rsc1" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + <primitive id="rsc2" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + <primitive id="rsc3" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + <primitive id="rsc4" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + </resources> + <constraints original="1"> + <rsc_colocation id="rsc2-with-rsc1" score="INFINITY" rsc="rsc2" with-rsc="rsc1" original="1"/> + <rsc_colocation id="rsc4-with-rsc3" score="INFINITY" rsc="rsc4" with-rsc="rsc3" original="1"/> + <rsc_order id="rsc1-then-rsc2" first="rsc1" then="rsc2" original="1"/> + <rsc_order id="rsc3-then-rsc4" first="rsc3" then="rsc4" original="1"/> + </constraints> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/multiple-location-rules.ref-4 b/cts/schemas/test-3/ref/multiple-location-rules.ref-4 new file mode 100644 index 0000000000..e6372e2ba7 --- /dev/null +++ b/cts/schemas/test-3/ref/multiple-location-rules.ref-4 @@ -0,0 +1,163 @@ +<cib crm_feature_set="3.19.7" validate-with="pacemaker-4.0" epoch="16" num_updates="0" admin_epoch="0" original="1"> + <configuration original="1"> + <!-- The essential elements of this test are: + * There is a location constraint (ban-rsc1) containing a rsc attribute + and two top-level rules. + * There is a location constraint (allow-rsc1) containing a rsc + attribute and one top-level rule. + * There is a location constraint (allow-rsc2) containing a rsc + attribute and one top-level rule with two nested rules. + * There is a location constraint (ban-rsc3-rsc4-node1-node2) containing + two resource_set elements (with id attributes), two top-level + rules, and two rule elements (with id attributes) within a lifetime + element. + * There is a location constraint (ban-rsc3-rsc4-node1-node2) containing + two resource_set elements (with id-ref attributes), two top-level + rules, and two rule elements (with id-ref attributes) within a + lifetime element. + + In this situation: + * ban-rsc1 should be replaced by two new location constraints, each + containing one of the original rules. + * allow-rsc1 and allow-rsc2 should be unmodified. + * ban-rsc3-rsc4-node1-node2 should be replaced by two new location + constraints, each containing one of the original rules. The first of + the new constraints should contain the original resource_set and + lifetime rule elements, while the second should contain id-refs to + them. + * ban-rsc3-rsc4-node3-node4 should be replaced by two new location + constraints, each containing one of the original rules. Both of the + new constraints should contain the original resource_set and lifetime + rule elements, which are id-refs to resource sets defined in + ban-rsc3-rsc4-node1-node2. + * The rules within a lifetime element should be converted to an "or" + rule set nested alongside an "and" rule set containing the other + top-level rule. + --> + <crm_config original="1"/> + <nodes original="1"> + <node id="node1" uname="node1" type="member" original="1"/> + <node id="node2" uname="node2" type="member" original="1"/> + <node id="node3" uname="node3" type="member" original="1"/> + <node id="node4" uname="node3" type="member" original="1"/> + </nodes> + <resources original="1"> + <primitive id="rsc1" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + <primitive id="rsc2" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + <primitive id="rsc3" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + <primitive id="rsc4" class="ocf" type="Dummy" provider="pacemaker" original="1"/> + </resources> + <constraints original="1"> + <rsc_location id="pcmk__3_10_upgrade-ban-rsc1-1" rsc="rsc1" original="0"> + <rule id="ban-rsc1-rule1" score="-INFINITY" original="1"> + <expression id="ban-rsc1-rule1-expr" attribute="#uname" operation="eq" value="node1" original="1"/> + </rule> + </rsc_location> + <rsc_location id="pcmk__3_10_upgrade-ban-rsc1-2" rsc="rsc1" original="0"> + <rule id="ban-rsc1-rule2" score="-INFINITY" original="1"> + <expression id="ban-rsc1-rule2-expr" attribute="#uname" operation="eq" value="node2" original="1"/> + </rule> + </rsc_location> + <rsc_location id="allow-rsc1" rsc="rsc1" original="1"> + <rule id="allow-rsc1-rule" score="INFINITY" original="1"> + <expression id="allow-rsc1-rule-expr" attribute="#uname" operation="eq" value="node3" original="1"/> + </rule> + </rsc_location> + <rsc_location id="allow-rsc2" rsc="rsc2" original="1"> + <rule id="allow-rsc2-rule" score="INFINITY" boolean-op="or" original="1"> + <rule id="allow-rsc2-rule-subrule1" original="1"> + <expression id="allow-rsc2-rule-subrule1-expr" attribute="#uname" operation="eq" value="node1" original="1"/> + </rule> + <rule id="allow-rsc2-rule-subrule2" original="1"> + <expression id="allow-rsc2-rule-subrule2-expr" attribute="#uname" operation="eq" value="node2" original="1"/> + </rule> + </rule> + </rsc_location> + <rsc_location id="pcmk__3_10_upgrade-ban-rsc3-rsc4-node1-node2-1" original="0"> + <resource_set id="ban-rsc3-rsc4-node1-node2-set1" original="1"> + <resource_ref id="rsc3" original="1"/> + </resource_set> + <resource_set id="ban-rsc3-rsc4-node1-node2-set2" original="1"> + <resource_ref id="rsc4" original="1"/> + </resource_set> + <rule id="pcmk__3_10_upgrade-pcmk__3_10_upgrade-ban-rsc3-rsc4-node1-node2-1-lifetime-and-rule" boolean-op="and"> + <rule id="ban-rsc3-rsc4-node1-node2-rule1" score="-INFINITY" original="1"> + <expression id="ban-rsc3-rsc4-node1-node2-rule1-expr" attribute="#uname" operation="eq" value="node1" original="1"/> + </rule> + <rule id="pcmk__3_10_upgrade-pcmk__3_10_upgrade-ban-rsc3-rsc4-node1-node2-1-lifetime-or-rule" boolean-op="or"> + <rule id="ban-rsc3-rsc4-node1-node2-lifetime-rule1" original="1"> + <date_expression id="ban-rsc3-rsc4-node1-node2-lifetime-rule1-expr" operation="in_range" start="2004-001" original="1"/> + </rule> + <rule id="ban-rsc3-rsc4-node1-node2-lifetime-rule2" original="1"> + <date_expression id="ban-rsc3-rsc4-node1-node2-lifetime-rule2-expr" operation="in_range" end="2005-001" original="1"/> + </rule> + </rule> + </rule> + </rsc_location> + <rsc_location id="pcmk__3_10_upgrade-ban-rsc3-rsc4-node1-node2-2" original="0"> + <resource_set id="ban-rsc3-rsc4-node1-node2-set1" original="0"> + <resource_ref id="rsc3" original="0"/> + </resource_set> + <resource_set id="ban-rsc3-rsc4-node1-node2-set2" original="0"> + <resource_ref id="rsc4" original="0"/> + </resource_set> + <rule id="pcmk__3_10_upgrade-pcmk__3_10_upgrade-ban-rsc3-rsc4-node1-node2-2-lifetime-and-rule" boolean-op="and"> + <rule id="ban-rsc3-rsc4-node1-node2-rule2" score="-INFINITY" original="1"> + <expression id="ban-rsc3-rsc4-node1-node2-rule2-expr" attribute="#uname" operation="eq" value="node2" original="1"/> + </rule> + <rule id="pcmk__3_10_upgrade-pcmk__3_10_upgrade-ban-rsc3-rsc4-node1-node2-2-lifetime-or-rule" boolean-op="or"> + <rule id="ban-rsc3-rsc4-node1-node2-lifetime-rule1" original="0"> + <date_expression id="ban-rsc3-rsc4-node1-node2-lifetime-rule1-expr" operation="in_range" start="2004-001" original="0"/> + </rule> + <rule id="ban-rsc3-rsc4-node1-node2-lifetime-rule2" original="0"> + <date_expression id="ban-rsc3-rsc4-node1-node2-lifetime-rule2-expr" operation="in_range" end="2005-001" original="0"/> + </rule> + </rule> + </rule> + </rsc_location> + <rsc_location id="pcmk__3_10_upgrade-ban-rsc3-rsc4-node3-node4-1" original="0"> + <resource_set id="ban-rsc3-rsc4-node1-node2-set1" original="0"> + <resource_ref id="rsc3" original="0"/> + </resource_set> + <resource_set id="ban-rsc3-rsc4-node1-node2-set2" original="0"> + <resource_ref id="rsc4" original="0"/> + </resource_set> + <rule id="pcmk__3_10_upgrade-pcmk__3_10_upgrade-ban-rsc3-rsc4-node3-node4-1-lifetime-and-rule" boolean-op="and"> + <rule id="ban-rsc3-rsc4-node3-node4-rule1" score="-INFINITY" original="1"> + <expression id="ban-rsc3-rsc4-node3-node4-rule1-expr" attribute="#uname" operation="eq" value="node3" original="1"/> + </rule> + <rule id="pcmk__3_10_upgrade-pcmk__3_10_upgrade-ban-rsc3-rsc4-node3-node4-1-lifetime-or-rule" boolean-op="or"> + <rule id="ban-rsc3-rsc4-node1-node2-lifetime-rule1" original="0"> + <date_expression id="ban-rsc3-rsc4-node1-node2-lifetime-rule1-expr" operation="in_range" start="2004-001" original="0"/> + </rule> + <rule id="ban-rsc3-rsc4-node1-node2-lifetime-rule2" original="0"> + <date_expression id="ban-rsc3-rsc4-node1-node2-lifetime-rule2-expr" operation="in_range" end="2005-001" original="0"/> + </rule> + </rule> + </rule> + </rsc_location> + <rsc_location id="pcmk__3_10_upgrade-ban-rsc3-rsc4-node3-node4-2" original="0"> + <resource_set id="ban-rsc3-rsc4-node1-node2-set1" original="0"> + <resource_ref id="rsc3" original="0"/> + </resource_set> + <resource_set id="ban-rsc3-rsc4-node1-node2-set2" original="0"> + <resource_ref id="rsc4" original="0"/> + </resource_set> + <rule id="pcmk__3_10_upgrade-pcmk__3_10_upgrade-ban-rsc3-rsc4-node3-node4-2-lifetime-and-rule" boolean-op="and"> + <rule id="ban-rsc3-rsc4-node3-node4-rule2" score="-INFINITY" original="1"> + <expression id="ban-rsc3-rsc4-node3-node4-rule2-expr" attribute="#uname" operation="eq" value="node4" original="1"/> + </rule> + <rule id="pcmk__3_10_upgrade-pcmk__3_10_upgrade-ban-rsc3-rsc4-node3-node4-2-lifetime-or-rule" boolean-op="or"> + <rule id="ban-rsc3-rsc4-node1-node2-lifetime-rule1" original="0"> + <date_expression id="ban-rsc3-rsc4-node1-node2-lifetime-rule1-expr" operation="in_range" start="2004-001" original="0"/> + </rule> + <rule id="ban-rsc3-rsc4-node1-node2-lifetime-rule2" original="0"> + <date_expression id="ban-rsc3-rsc4-node1-node2-lifetime-rule2-expr" operation="in_range" end="2005-001" original="0"/> + </rule> + </rule> + </rule> + </rsc_location> + </constraints> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/nagios.ref-0 b/cts/schemas/test-3/ref/nagios.ref-0 new file mode 100644 index 0000000000..9fe0d0bbe7 --- /dev/null +++ b/cts/schemas/test-3/ref/nagios.ref-0 @@ -0,0 +1,188 @@ +<cib crm_feature_set="3.19.7" validate-with="pacemaker-3.10" epoch="8" num_updates="0" admin_epoch="0" original="1"> + <configuration original="1"> + <!-- The essential elements of this test are: + * There is an nagios template and an ocf template. + * There are nagios and ocf primitives, defined either inline or by + reference to the corresponding template. + * There is a group with only nagios primitives and a group with both + nagios and ocf primitives. + * There is a cloned nagios resource and a cloned ocf resource. + * There is a cloned group containing only nagios primitives and a + cloned group containing both nagios and ocf primitives. + * There is a bundle containing an nagios primitive. + * There are various constraints, many of which reference nagios + resources. + + In this situation: + * The nagios 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 nagios + members should be dropped. + * The bundle should be kept so that its container remains managed; its + primitive should be dropped. + * Constraints with attributes referencing nagios resources should be + dropped. + * Resource sets containing only references to nagios 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="nagios" type="Dummy" original="1"/> + <template id="template_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + <primitive id="primitive1_drop" class="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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/nagios.ref-1 b/cts/schemas/test-3/ref/nagios.ref-1 new file mode 100644 index 0000000000..6d5ecca944 --- /dev/null +++ b/cts/schemas/test-3/ref/nagios.ref-1 @@ -0,0 +1,188 @@ +<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 nagios template and an ocf template. + * There are nagios and ocf primitives, defined either inline or by + reference to the corresponding template. + * There is a group with only nagios primitives and a group with both + nagios and ocf primitives. + * There is a cloned nagios resource and a cloned ocf resource. + * There is a cloned group containing only nagios primitives and a + cloned group containing both nagios and ocf primitives. + * There is a bundle containing an nagios primitive. + * There are various constraints, many of which reference nagios + resources. + + In this situation: + * The nagios 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 nagios + members should be dropped. + * The bundle should be kept so that its container remains managed; its + primitive should be dropped. + * Constraints with attributes referencing nagios resources should be + dropped. + * Resource sets containing only references to nagios 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="nagios" type="Dummy" original="1"/> + <template id="template_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + <primitive id="primitive1_drop" class="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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/nagios.ref-2 b/cts/schemas/test-3/ref/nagios.ref-2 new file mode 100644 index 0000000000..6d5ecca944 --- /dev/null +++ b/cts/schemas/test-3/ref/nagios.ref-2 @@ -0,0 +1,188 @@ +<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 nagios template and an ocf template. + * There are nagios and ocf primitives, defined either inline or by + reference to the corresponding template. + * There is a group with only nagios primitives and a group with both + nagios and ocf primitives. + * There is a cloned nagios resource and a cloned ocf resource. + * There is a cloned group containing only nagios primitives and a + cloned group containing both nagios and ocf primitives. + * There is a bundle containing an nagios primitive. + * There are various constraints, many of which reference nagios + resources. + + In this situation: + * The nagios 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 nagios + members should be dropped. + * The bundle should be kept so that its container remains managed; its + primitive should be dropped. + * Constraints with attributes referencing nagios resources should be + dropped. + * Resource sets containing only references to nagios 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="nagios" type="Dummy" original="1"/> + <template id="template_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + <primitive id="primitive1_drop" class="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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/nagios.ref-3 b/cts/schemas/test-3/ref/nagios.ref-3 new file mode 100644 index 0000000000..6d5ecca944 --- /dev/null +++ b/cts/schemas/test-3/ref/nagios.ref-3 @@ -0,0 +1,188 @@ +<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 nagios template and an ocf template. + * There are nagios and ocf primitives, defined either inline or by + reference to the corresponding template. + * There is a group with only nagios primitives and a group with both + nagios and ocf primitives. + * There is a cloned nagios resource and a cloned ocf resource. + * There is a cloned group containing only nagios primitives and a + cloned group containing both nagios and ocf primitives. + * There is a bundle containing an nagios primitive. + * There are various constraints, many of which reference nagios + resources. + + In this situation: + * The nagios 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 nagios + members should be dropped. + * The bundle should be kept so that its container remains managed; its + primitive should be dropped. + * Constraints with attributes referencing nagios resources should be + dropped. + * Resource sets containing only references to nagios 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="nagios" type="Dummy" original="1"/> + <template id="template_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + <primitive id="primitive1_drop" class="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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/nagios.ref-4 b/cts/schemas/test-3/ref/nagios.ref-4 new file mode 100644 index 0000000000..4719168f78 --- /dev/null +++ b/cts/schemas/test-3/ref/nagios.ref-4 @@ -0,0 +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 nagios template and an ocf template. + * There are nagios and ocf primitives, defined either inline or by + reference to the corresponding template. + * There is a group with only nagios primitives and a group with both + nagios and ocf primitives. + * There is a cloned nagios resource and a cloned ocf resource. + * There is a cloned group containing only nagios primitives and a + cloned group containing both nagios and ocf primitives. + * There is a bundle containing an nagios primitive. + * There are various constraints, many of which reference nagios + resources. + + In this situation: + * The nagios 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 nagios + members should be dropped. + * The bundle should be kept so that its container remains managed; its + primitive should be dropped. + * Constraints with attributes referencing nagios resources should be + dropped. + * Resource sets containing only references to nagios 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_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + <primitive id="primitive2_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + <primitive id="primitive4_keep" template="template_keep" original="1"/> + <group id="grp2_keep" original="1"> + <primitive id="grp2_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + <primitive id="grp2_rsc4_keep" template="template_keep" original="1"/> + </group> + <clone id="clone2_keep" original="1"> + <primitive id="clone2_rsc_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </clone> + <clone id="clone4_keep" original="1"> + <group id="clone4_grp_keep" original="1"> + <primitive id="clone4_grp_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy" 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"/> + </bundle> + </resources> + <constraints original="1"> + <rsc_location id="location2_keep" rsc="primitive2_keep" node="node1" score="INFINITY" original="1"/> + <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="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_keep" original="1"> + <resource_ref id="clone2_keep" 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="colocation4_keep" rsc="primitive4_keep" with-rsc="primitive2_keep" original="1"/> + <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="clone4_keep" original="1"/> + </resource_set> + </rsc_colocation> + <rsc_colocation id="colocation7_keep" original="1"> + <resource_set id="colocation7_keep-set_keep" original="1"> + <resource_ref id="clone2_keep" original="1"/> + <resource_ref id="clone4_keep" original="1"/> + </resource_set> + </rsc_colocation> + <rsc_order id="order4_keep" first="primitive4_keep" then="primitive2_keep" original="1"/> + <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="clone4_keep" original="1"/> + </resource_set> + </rsc_order> + <rsc_order id="order7_keep" original="1"> + <resource_set id="order7_keep-set_keep" original="1"> + <resource_ref id="clone2_keep" original="1"/> + <resource_ref id="clone4_keep" original="1"/> + </resource_set> + </rsc_order> + <rsc_ticket id="ticket2_keep" rsc="primitive2_keep" ticket="ticket1" original="1"/> + <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="clone4_keep" original="1"/> + </resource_set> + </rsc_ticket> + <rsc_ticket id="ticket5_keep" ticket="ticket1" original="1"> + <resource_set id="ticket5_keep-set_keep" original="1"> + <resource_ref id="clone2_keep" 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/nagios.ref-99 b/cts/schemas/test-3/ref/nagios.ref-99 new file mode 100644 index 0000000000..4b4aa496e0 --- /dev/null +++ b/cts/schemas/test-3/ref/nagios.ref-99 @@ -0,0 +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 nagios template and an ocf template. + * There are nagios and ocf primitives, defined either inline or by + reference to the corresponding template. + * There is a group with only nagios primitives and a group with both + nagios and ocf primitives. + * There is a cloned nagios resource and a cloned ocf resource. + * There is a cloned group containing only nagios primitives and a + cloned group containing both nagios and ocf primitives. + * There is a bundle containing an nagios primitive. + * There are various constraints, many of which reference nagios + resources. + + In this situation: + * The nagios 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 nagios + members should be dropped. + * The bundle should be kept so that its container remains managed; its + primitive should be dropped. + * Constraints with attributes referencing nagios resources should be + dropped. + * Resource sets containing only references to nagios 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_keep" class="ocf" provider="pacemaker" type="Dummy"/> + <primitive id="primitive2_keep" class="ocf" provider="pacemaker" type="Dummy"/> + <primitive id="primitive4_keep" template="template_keep"/> + <group id="grp2_keep"> + <primitive id="grp2_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy"/> + <primitive id="grp2_rsc4_keep" template="template_keep"/> + </group> + <clone id="clone2_keep"> + <primitive id="clone2_rsc_keep" class="ocf" provider="pacemaker" type="Dummy"/> + </clone> + <clone id="clone4_keep"> + <group id="clone4_grp_keep"> + <primitive id="clone4_grp_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy"/> + <primitive id="clone4_grp_rsc4_keep" template="template_keep"/> + </group> + </clone> + <bundle id="bundle_keep"> + <podman image="image"/> + </bundle> + </resources> + <constraints> + <rsc_location id="location2_keep" rsc="primitive2_keep" node="node1" score="INFINITY"/> + <rsc_location id="location4_keep" node="node1" score="INFINITY"> + <resource_set id="location4_keep-set"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_location> + <rsc_location id="location5_keep" node="node1" score="INFINITY"> + <resource_set id="location5_keep-set_keep"> + <resource_ref id="clone2_keep"/> + <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="colocation4_keep" rsc="primitive4_keep" with-rsc="primitive2_keep"/> + <rsc_colocation id="colocation6_keep"> + <resource_set id="colocation6_keep-set"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_colocation> + <rsc_colocation id="colocation7_keep"> + <resource_set id="colocation7_keep-set_keep"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_colocation> + <rsc_order id="order4_keep" first="primitive4_keep" then="primitive2_keep"/> + <rsc_order id="order6_keep"> + <resource_set id="order6_keep-set"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_order> + <rsc_order id="order7_keep"> + <resource_set id="order7_keep-set_keep"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_order> + <rsc_ticket id="ticket2_keep" rsc="primitive2_keep" ticket="ticket1"/> + <rsc_ticket id="ticket4_keep" ticket="ticket1"> + <resource_set id="ticket4_keep-set"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_ticket> + <rsc_ticket id="ticket5_keep" ticket="ticket1"> + <resource_set id="ticket5_keep-set_keep"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_ticket> + </constraints> + </configuration> + <status/> +</cib> diff --git a/cts/schemas/test-3/ref/no-validate-with.ref-4 b/cts/schemas/test-3/ref/no-validate-with.ref-4 new file mode 100644 index 0000000000..392eb408f3 --- /dev/null +++ b/cts/schemas/test-3/ref/no-validate-with.ref-4 @@ -0,0 +1,15 @@ +<cib crm_feature_set="3.19.7" epoch="16" num_updates="0" admin_epoch="0" original="1" validate-with="pacemaker-4.0"> + <configuration original="1"> + <!-- The essential elements of this test are: + * The cib element does not contain a validate-with attribute. + + In this situation, the validate-with attribute should be set to + "pacemaker-4.0". + --> + <crm_config original="1"/> + <nodes original="1"/> + <resources original="1"/> + <constraints original="1"/> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/nvpair-no-value.ref-4 b/cts/schemas/test-3/ref/nvpair-no-value.ref-4 new file mode 100644 index 0000000000..5820a8429d --- /dev/null +++ b/cts/schemas/test-3/ref/nvpair-no-value.ref-4 @@ -0,0 +1,33 @@ +<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 one nvset element of each type: cluster_property_set, + instance_attributes, meta_attributes, utilization. + * Each nvset contains one nvpair with a value and one nvpair with no + value. + + In this situation, all nvpair elements with no value should be dropped. + --> + <crm_config original="1"> + <cluster_property_set id="cib-bootstrap-options" original="1"> + <nvpair id="cib-bootstrap-options-option2" name="option2" value="value2" original="1"/> + </cluster_property_set> + </crm_config> + <nodes original="1"/> + <resources original="1"> + <primitive class="ocf" id="rsc1" provider="pacemaker" type="Dummy" original="1"> + <instance_attributes id="rsc1-instance_attributes" original="1"> + <nvpair id="rsc1-instance_attributes-option2" name="option2" value="value2" original="1"/> + </instance_attributes> + <meta_attributes id="rsc1-meta_attributes" original="1"> + <nvpair id="rsc1-meta_attributes-option2" name="option2" value="value2" original="1"/> + </meta_attributes> + <utilization id="rsc1-utilization" original="1"> + <nvpair id="rsc1-utilization-option2" name="option2" value="value2" original="1"/> + </utilization> + </primitive> + </resources> + <constraints original="1"/> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/rkt.ref-0 b/cts/schemas/test-3/ref/rkt.ref-0 new file mode 100644 index 0000000000..689626756f --- /dev/null +++ b/cts/schemas/test-3/ref/rkt.ref-0 @@ -0,0 +1,141 @@ +<cib crm_feature_set="3.19.7" validate-with="pacemaker-3.10" epoch="8" num_updates="0" admin_epoch="0" original="1"> + <configuration original="1"> + <!-- The essential elements of this test are: + * There are three bundles: one rkt, one podman, and one docker. + * There are various constraints, many of which reference the rkt + bundle. + + In this situation: + * The rkt bundle should be dropped. + * Constraints with attributes referencing the rkt bundles should be + dropped. + * Resource sets containing only references to rkt bundles should be + * 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"> + <bundle id="bundle1_drop" original="1"> + <rkt image="image" original="1"/> + <primitive id="bundle1_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle2_keep" original="1"> + <podman image="image" original="1"/> + <primitive id="bundle2_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle3_keep" original="1"> + <docker image="image" original="1"/> + <primitive id="bundle3_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle4_drop" original="1"> + <rkt image="image" original="1"/> + <primitive id="bundle4_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + </resources> + <constraints original="1"> + <rsc_location id="location1_drop" rsc="bundle1_drop" node="node1" score="INFINITY" original="1"/> + <rsc_location id="location2_keep" rsc="bundle2_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="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="location5_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_location> + <rsc_location id="location6_keep" rsc-pattern="bundle1_drop" node="node1" score="INFINITY" original="1"/> + <rsc_colocation id="colocation1_drop" rsc="bundle1_drop" with-rsc="bundle2_keep" original="1"/> + <rsc_colocation id="colocation2_drop" rsc="bundle2_keep" with-rsc="bundle1_drop" original="1"/> + <rsc_colocation id="colocation3_drop" rsc="bundle4_drop" with-rsc="bundle1_drop" original="1"/> + <rsc_colocation id="colocation4_keep" rsc="bundle3_keep" with-rsc="bundle2_keep" original="1"/> + <rsc_colocation id="colocation5_drop" original="1"> + <resource_set id="colocation5_drop-set" original="1"> + <resource_ref id="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="colocation7_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_colocation> + <rsc_order id="order1_drop" first="bundle1_drop" then="bundle2_keep" original="1"/> + <rsc_order id="order2_drop" first="bundle2_keep" then="bundle1_drop" original="1"/> + <rsc_order id="order3_drop" first="bundle4_drop" then="bundle1_drop" original="1"/> + <rsc_order id="order4_keep" first="bundle3_keep" then="bundle2_keep" original="1"/> + <rsc_order id="order5_drop" original="1"> + <resource_set id="order5_drop-set" original="1"> + <resource_ref id="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="order7_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_order> + <rsc_ticket id="ticket1_drop" rsc="bundle1_drop" ticket="ticket1" original="1"/> + <rsc_ticket id="ticket2_keep" rsc="bundle2_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="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="ticket5_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_ticket> + </constraints> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/rkt.ref-1 b/cts/schemas/test-3/ref/rkt.ref-1 new file mode 100644 index 0000000000..ae10e1e2a1 --- /dev/null +++ b/cts/schemas/test-3/ref/rkt.ref-1 @@ -0,0 +1,141 @@ +<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 are three bundles: one rkt, one podman, and one docker. + * There are various constraints, many of which reference the rkt + bundle. + + In this situation: + * The rkt bundle should be dropped. + * Constraints with attributes referencing the rkt bundles should be + dropped. + * Resource sets containing only references to rkt bundles should be + * 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"> + <bundle id="bundle1_drop" original="1"> + <rkt image="image" original="1"/> + <primitive id="bundle1_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle2_keep" original="1"> + <podman image="image" original="1"/> + <primitive id="bundle2_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle3_keep" original="1"> + <docker image="image" original="1"/> + <primitive id="bundle3_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle4_drop" original="1"> + <rkt image="image" original="1"/> + <primitive id="bundle4_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + </resources> + <constraints original="1"> + <rsc_location id="location1_drop" rsc="bundle1_drop" node="node1" score="INFINITY" original="1"/> + <rsc_location id="location2_keep" rsc="bundle2_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="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="location5_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_location> + <rsc_location id="location6_keep" rsc-pattern="bundle1_drop" node="node1" score="INFINITY" original="1"/> + <rsc_colocation id="colocation1_drop" rsc="bundle1_drop" with-rsc="bundle2_keep" original="1"/> + <rsc_colocation id="colocation2_drop" rsc="bundle2_keep" with-rsc="bundle1_drop" original="1"/> + <rsc_colocation id="colocation3_drop" rsc="bundle4_drop" with-rsc="bundle1_drop" original="1"/> + <rsc_colocation id="colocation4_keep" rsc="bundle3_keep" with-rsc="bundle2_keep" original="1"/> + <rsc_colocation id="colocation5_drop" original="1"> + <resource_set id="colocation5_drop-set" original="1"> + <resource_ref id="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="colocation7_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_colocation> + <rsc_order id="order1_drop" first="bundle1_drop" then="bundle2_keep" original="1"/> + <rsc_order id="order2_drop" first="bundle2_keep" then="bundle1_drop" original="1"/> + <rsc_order id="order3_drop" first="bundle4_drop" then="bundle1_drop" original="1"/> + <rsc_order id="order4_keep" first="bundle3_keep" then="bundle2_keep" original="1"/> + <rsc_order id="order5_drop" original="1"> + <resource_set id="order5_drop-set" original="1"> + <resource_ref id="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="order7_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_order> + <rsc_ticket id="ticket1_drop" rsc="bundle1_drop" ticket="ticket1" original="1"/> + <rsc_ticket id="ticket2_keep" rsc="bundle2_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="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="ticket5_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_ticket> + </constraints> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/rkt.ref-2 b/cts/schemas/test-3/ref/rkt.ref-2 new file mode 100644 index 0000000000..ae10e1e2a1 --- /dev/null +++ b/cts/schemas/test-3/ref/rkt.ref-2 @@ -0,0 +1,141 @@ +<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 are three bundles: one rkt, one podman, and one docker. + * There are various constraints, many of which reference the rkt + bundle. + + In this situation: + * The rkt bundle should be dropped. + * Constraints with attributes referencing the rkt bundles should be + dropped. + * Resource sets containing only references to rkt bundles should be + * 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"> + <bundle id="bundle1_drop" original="1"> + <rkt image="image" original="1"/> + <primitive id="bundle1_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle2_keep" original="1"> + <podman image="image" original="1"/> + <primitive id="bundle2_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle3_keep" original="1"> + <docker image="image" original="1"/> + <primitive id="bundle3_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle4_drop" original="1"> + <rkt image="image" original="1"/> + <primitive id="bundle4_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + </resources> + <constraints original="1"> + <rsc_location id="location1_drop" rsc="bundle1_drop" node="node1" score="INFINITY" original="1"/> + <rsc_location id="location2_keep" rsc="bundle2_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="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="location5_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_location> + <rsc_location id="location6_keep" rsc-pattern="bundle1_drop" node="node1" score="INFINITY" original="1"/> + <rsc_colocation id="colocation1_drop" rsc="bundle1_drop" with-rsc="bundle2_keep" original="1"/> + <rsc_colocation id="colocation2_drop" rsc="bundle2_keep" with-rsc="bundle1_drop" original="1"/> + <rsc_colocation id="colocation3_drop" rsc="bundle4_drop" with-rsc="bundle1_drop" original="1"/> + <rsc_colocation id="colocation4_keep" rsc="bundle3_keep" with-rsc="bundle2_keep" original="1"/> + <rsc_colocation id="colocation5_drop" original="1"> + <resource_set id="colocation5_drop-set" original="1"> + <resource_ref id="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="colocation7_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_colocation> + <rsc_order id="order1_drop" first="bundle1_drop" then="bundle2_keep" original="1"/> + <rsc_order id="order2_drop" first="bundle2_keep" then="bundle1_drop" original="1"/> + <rsc_order id="order3_drop" first="bundle4_drop" then="bundle1_drop" original="1"/> + <rsc_order id="order4_keep" first="bundle3_keep" then="bundle2_keep" original="1"/> + <rsc_order id="order5_drop" original="1"> + <resource_set id="order5_drop-set" original="1"> + <resource_ref id="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="order7_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_order> + <rsc_ticket id="ticket1_drop" rsc="bundle1_drop" ticket="ticket1" original="1"/> + <rsc_ticket id="ticket2_keep" rsc="bundle2_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="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="ticket5_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_ticket> + </constraints> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/rkt.ref-3 b/cts/schemas/test-3/ref/rkt.ref-3 new file mode 100644 index 0000000000..ae10e1e2a1 --- /dev/null +++ b/cts/schemas/test-3/ref/rkt.ref-3 @@ -0,0 +1,141 @@ +<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 are three bundles: one rkt, one podman, and one docker. + * There are various constraints, many of which reference the rkt + bundle. + + In this situation: + * The rkt bundle should be dropped. + * Constraints with attributes referencing the rkt bundles should be + dropped. + * Resource sets containing only references to rkt bundles should be + * 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"> + <bundle id="bundle1_drop" original="1"> + <rkt image="image" original="1"/> + <primitive id="bundle1_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle2_keep" original="1"> + <podman image="image" original="1"/> + <primitive id="bundle2_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle3_keep" original="1"> + <docker image="image" original="1"/> + <primitive id="bundle3_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle4_drop" original="1"> + <rkt image="image" original="1"/> + <primitive id="bundle4_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + </resources> + <constraints original="1"> + <rsc_location id="location1_drop" rsc="bundle1_drop" node="node1" score="INFINITY" original="1"/> + <rsc_location id="location2_keep" rsc="bundle2_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="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="location5_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_location> + <rsc_location id="location6_keep" rsc-pattern="bundle1_drop" node="node1" score="INFINITY" original="1"/> + <rsc_colocation id="colocation1_drop" rsc="bundle1_drop" with-rsc="bundle2_keep" original="1"/> + <rsc_colocation id="colocation2_drop" rsc="bundle2_keep" with-rsc="bundle1_drop" original="1"/> + <rsc_colocation id="colocation3_drop" rsc="bundle4_drop" with-rsc="bundle1_drop" original="1"/> + <rsc_colocation id="colocation4_keep" rsc="bundle3_keep" with-rsc="bundle2_keep" original="1"/> + <rsc_colocation id="colocation5_drop" original="1"> + <resource_set id="colocation5_drop-set" original="1"> + <resource_ref id="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="colocation7_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_colocation> + <rsc_order id="order1_drop" first="bundle1_drop" then="bundle2_keep" original="1"/> + <rsc_order id="order2_drop" first="bundle2_keep" then="bundle1_drop" original="1"/> + <rsc_order id="order3_drop" first="bundle4_drop" then="bundle1_drop" original="1"/> + <rsc_order id="order4_keep" first="bundle3_keep" then="bundle2_keep" original="1"/> + <rsc_order id="order5_drop" original="1"> + <resource_set id="order5_drop-set" original="1"> + <resource_ref id="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="order7_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_order> + <rsc_ticket id="ticket1_drop" rsc="bundle1_drop" ticket="ticket1" original="1"/> + <rsc_ticket id="ticket2_keep" rsc="bundle2_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="bundle1_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="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_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="bundle1_drop" original="1"/> + </resource_set> + <resource_set id="ticket5_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle4_drop" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_ticket> + </constraints> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/rkt.ref-4 b/cts/schemas/test-3/ref/rkt.ref-4 new file mode 100644 index 0000000000..b20daa5141 --- /dev/null +++ b/cts/schemas/test-3/ref/rkt.ref-4 @@ -0,0 +1,85 @@ +<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 are three bundles: one rkt, one podman, and one docker. + * There are various constraints, many of which reference the rkt + bundle. + + In this situation: + * The rkt bundle should be dropped. + * Constraints with attributes referencing the rkt bundles should be + dropped. + * Resource sets containing only references to rkt bundles should be + * 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"> + <bundle id="bundle2_keep" original="1"> + <podman image="image" original="1"/> + <primitive id="bundle2_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + <bundle id="bundle3_keep" original="1"> + <docker image="image" original="1"/> + <primitive id="bundle3_rsc" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </bundle> + </resources> + <constraints original="1"> + <rsc_location id="location2_keep" rsc="bundle2_keep" node="node1" score="INFINITY" original="1"/> + <rsc_location id="location4_keep" node="node1" score="INFINITY" original="1"> + <resource_set id="location4_keep-set" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_location> + <rsc_location id="location5_keep" node="node1" score="INFINITY" original="1"> + <resource_set id="location5_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_location> + <rsc_location id="location6_keep" rsc-pattern="bundle1_drop" node="node1" score="INFINITY" original="1"/> + <rsc_colocation id="colocation4_keep" rsc="bundle3_keep" with-rsc="bundle2_keep" original="1"/> + <rsc_colocation id="colocation6_keep" original="1"> + <resource_set id="colocation6_keep-set" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_colocation> + <rsc_colocation id="colocation7_keep" original="1"> + <resource_set id="colocation7_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_colocation> + <rsc_order id="order4_keep" first="bundle3_keep" then="bundle2_keep" original="1"/> + <rsc_order id="order6_keep" original="1"> + <resource_set id="order6_keep-set" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_order> + <rsc_order id="order7_keep" original="1"> + <resource_set id="order7_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_order> + <rsc_ticket id="ticket2_keep" rsc="bundle2_keep" ticket="ticket1" original="1"/> + <rsc_ticket id="ticket4_keep" ticket="ticket1" original="1"> + <resource_set id="ticket4_keep-set" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_ticket> + <rsc_ticket id="ticket5_keep" ticket="ticket1" original="1"> + <resource_set id="ticket5_keep-set_keep" original="1"> + <resource_ref id="bundle2_keep" original="1"/> + <resource_ref id="bundle3_keep" original="1"/> + </resource_set> + </rsc_ticket> + </constraints> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/rkt.ref-99 b/cts/schemas/test-3/ref/rkt.ref-99 new file mode 100644 index 0000000000..29770a41bc --- /dev/null +++ b/cts/schemas/test-3/ref/rkt.ref-99 @@ -0,0 +1,85 @@ +<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 are three bundles: one rkt, one podman, and one docker. + * There are various constraints, many of which reference the rkt + bundle. + + In this situation: + * The rkt bundle should be dropped. + * Constraints with attributes referencing the rkt bundles should be + dropped. + * Resource sets containing only references to rkt bundles should be + * Constraints with resource sets should be dropped if all of their + resource sets should be dropped. + --> + <crm_config/> + <nodes/> + <resources> + <bundle id="bundle2_keep"> + <podman image="image"/> + <primitive id="bundle2_rsc" class="ocf" provider="pacemaker" type="Dummy"/> + </bundle> + <bundle id="bundle3_keep"> + <docker image="image"/> + <primitive id="bundle3_rsc" class="ocf" provider="pacemaker" type="Dummy"/> + </bundle> + </resources> + <constraints> + <rsc_location id="location2_keep" rsc="bundle2_keep" node="node1" score="INFINITY"/> + <rsc_location id="location4_keep" node="node1" score="INFINITY"> + <resource_set id="location4_keep-set"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_location> + <rsc_location id="location5_keep" node="node1" score="INFINITY"> + <resource_set id="location5_keep-set_keep"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_location> + <rsc_location id="location6_keep" rsc-pattern="bundle1_drop" node="node1" score="INFINITY"/> + <rsc_colocation id="colocation4_keep" rsc="bundle3_keep" with-rsc="bundle2_keep"/> + <rsc_colocation id="colocation6_keep"> + <resource_set id="colocation6_keep-set"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_colocation> + <rsc_colocation id="colocation7_keep"> + <resource_set id="colocation7_keep-set_keep"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_colocation> + <rsc_order id="order4_keep" first="bundle3_keep" then="bundle2_keep"/> + <rsc_order id="order6_keep"> + <resource_set id="order6_keep-set"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_order> + <rsc_order id="order7_keep"> + <resource_set id="order7_keep-set_keep"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_order> + <rsc_ticket id="ticket2_keep" rsc="bundle2_keep" ticket="ticket1"/> + <rsc_ticket id="ticket4_keep" ticket="ticket1"> + <resource_set id="ticket4_keep-set"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_ticket> + <rsc_ticket id="ticket5_keep" ticket="ticket1"> + <resource_set id="ticket5_keep-set_keep"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_ticket> + </constraints> + </configuration> + <status/> +</cib> diff --git a/cts/schemas/test-3/ref/sort-nvsets.ref-4 b/cts/schemas/test-3/ref/sort-nvsets.ref-4 new file mode 100644 index 0000000000..38cfc6e4cc --- /dev/null +++ b/cts/schemas/test-3/ref/sort-nvsets.ref-4 @@ -0,0 +1,115 @@ +<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 are several nvset elements (cluster_property_set, + instance_attributes, meta_attributes, utilization) distributed among + various parent element types. + * Many of the nvsets have score attributes. + * Each of the nvsets has an id attribute with a number that indicates + its sort order relative to its siblings of the same element type, or + an id-ref to the same. + * One cluster_property_set has id "cib-bootstrap-options" and score + "-INFINITY". + * One meta_attributes set has an nvpair child, to verify that children + are preserved. Otherwise, children are omitted, for readability. + * The document orders of 0 vs. empty score and of "INFINITY" vs. + "+INFINITY" are reversed in rsc_defaults and op_defaults compared to + the other elements. + + In this situation: + * All nvset elements should be moved below their non-nvset siblings. + * The cluster_property_set with id "cib-bootstrap-options" should be + ordered before all its siblings. "cib-bootstrap-options" always sorts + first regardless of score. + * Otherwise, nvset elements of a given type under a given parent should + be ordered according to their score attribute (using document order + in case of a tie), which corresponds to the numbers in their IDs. + + This doesn't test every possible location where a nvset elements may + occur, but it should be exhaustive enough to be satisfactory. + --> + <crm_config original="1"> + <cluster_property_set id="cib-bootstrap-options" score="-INFINITY" original="1"/> + <cluster_property_set id="cps1" score="+INFINITY" original="1"/> + <cluster_property_set id="cps2" score="INFINITY" original="1"/> + <cluster_property_set id="cps3" score="120" original="1"/> + <cluster_property_set id="cps4" score="70" original="1"/> + <cluster_property_set id="cps5" original="1"/> + <cluster_property_set id="cps6" score="0" original="1"/> + <cluster_property_set id="cps7" score="-30" original="1"/> + <cluster_property_set id="cps8" score="-INFINITY" original="1"/> + </crm_config> + <nodes original="1"/> + <resources original="1"> + <clone id="clone1" original="1"> + <primitive class="ocf" id="rsc1" provider="heartbeat" type="apache" original="1"> + <operations original="1"> + <op id="rsc1_monitor_20000" interval="20s" name="monitor" original="1"> + <meta_attributes id="oma1" score="120" original="1"/> + <meta_attributes id="oma2" original="1"/> + <meta_attributes id="oma3" score="-30" original="1"/> + </op> + </operations> + <instance_attributes id="pia1" score="+INFINITY" original="1"/> + <instance_attributes id="pia2" score="INFINITY" original="1"/> + <utilization id="pu1" score="+INFINITY" original="1"/> + <meta_attributes id="pma1" score="+INFINITY" original="1"/> + <meta_attributes id="pma2" score="INFINITY" original="1"/> + <utilization id="pu2" score="INFINITY" original="1"/> + <utilization id="pu3" score="120" original="1"/> + <meta_attributes id="pma3" score="120" original="1"/> + <instance_attributes id="pia3" score="120" original="1"/> + <meta_attributes id="pma4" score="70" original="1"/> + <utilization id="pu4" score="70" original="1"/> + <instance_attributes id="pia4" score="70" original="1"/> + <instance_attributes id="pia5" original="1"/> + <utilization id="pu5" original="1"/> + <meta_attributes id="pma5" original="1"/> + <meta_attributes id="pma6" score="0" original="1"/> + <utilization id="pu6" score="0" original="1"/> + <instance_attributes id="pia6" score="0" original="1"/> + <meta_attributes id="pma7" score="-30" original="1"/> + <utilization id="pu7" score="-30" original="1"/> + <instance_attributes id="pia7" score="-30" original="1"/> + <meta_attributes id="pma8" score="-INFINITY" original="1"/> + <utilization id="pu8" score="-INFINITY" original="1"/> + <instance_attributes id="pia8" score="-INFINITY" original="1"/> + </primitive> + <meta_attributes id="cma1" score="+INFINITY" original="1"/> + <meta_attributes id="cma2" score="INFINITY" original="1"/> + <meta_attributes id="cma3" score="120" original="1"/> + <meta_attributes id="cma4" score="70" original="1"/> + <meta_attributes id="cma5" original="1"/> + <meta_attributes id="cma6" score="0" original="1"/> + <meta_attributes id="cma7" score="-30" original="1"/> + <meta_attributes id="cma8" score="-INFINITY" original="1"/> + </clone> + </resources> + <constraints original="1"/> + <rsc_defaults original="1"> + <meta_attributes id="rdma1" score="INFINITY" original="1"/> + <meta_attributes id="rdma2" score="+INFINITY" original="1"/> + <meta_attributes id="rdma3" score="120" original="1"> + <nvpair id="rdma3-option1" name="option1" value="value1" original="1"/> + </meta_attributes> + <meta_attributes id="rdma4" score="70" original="1"/> + <meta_attributes id="rdma5" score="0" original="1"/> + <meta_attributes id="rdma6" original="1"/> + <meta_attributes id="rdma7" score="-30" original="1"/> + <meta_attributes id="rdma8" score="-INFINITY" original="1"/> + </rsc_defaults> + <op_defaults original="1"> + <meta_attributes id="rdma1" score="INFINITY" original="0"/> + <meta_attributes id="rdma2" score="+INFINITY" original="0"/> + <meta_attributes id="rdma3" score="120" original="0"> + <nvpair id="rdma3-option1" name="option1" value="value1" original="0"/> + </meta_attributes> + <meta_attributes id="rdma4" score="70" original="0"/> + <meta_attributes id="rdma5" score="0" original="0"/> + <meta_attributes id="rdma6" original="0"/> + <meta_attributes id="rdma7" score="-30" original="0"/> + <meta_attributes id="rdma8" score="-INFINITY" original="0"/> + </op_defaults> + </configuration> + <status original="1"/> +</cib> diff --git a/cts/schemas/test-3/ref/upstart.ref-0 b/cts/schemas/test-3/ref/upstart.ref-0 new file mode 100644 index 0000000000..10da520c04 --- /dev/null +++ b/cts/schemas/test-3/ref/upstart.ref-0 @@ -0,0 +1,188 @@ +<cib crm_feature_set="3.19.7" validate-with="pacemaker-3.10" 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-1 b/cts/schemas/test-3/ref/upstart.ref-1 new file mode 100644 index 0000000000..a1cb49b963 --- /dev/null +++ b/cts/schemas/test-3/ref/upstart.ref-1 @@ -0,0 +1,188 @@ +<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-2 b/cts/schemas/test-3/ref/upstart.ref-2 new file mode 100644 index 0000000000..a1cb49b963 --- /dev/null +++ b/cts/schemas/test-3/ref/upstart.ref-2 @@ -0,0 +1,188 @@ +<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-3 b/cts/schemas/test-3/ref/upstart.ref-3 new file mode 100644 index 0000000000..a1cb49b963 --- /dev/null +++ b/cts/schemas/test-3/ref/upstart.ref-3 @@ -0,0 +1,188 @@ +<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-4 b/cts/schemas/test-3/ref/upstart.ref-4 new file mode 100644 index 0000000000..f395f98aaa --- /dev/null +++ b/cts/schemas/test-3/ref/upstart.ref-4 @@ -0,0 +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_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + <primitive id="primitive2_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + <primitive id="primitive4_keep" template="template_keep" original="1"/> + <group id="grp2_keep" original="1"> + <primitive id="grp2_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + <primitive id="grp2_rsc4_keep" template="template_keep" original="1"/> + </group> + <clone id="clone2_keep" original="1"> + <primitive id="clone2_rsc_keep" class="ocf" provider="pacemaker" type="Dummy" original="1"/> + </clone> + <clone id="clone4_keep" original="1"> + <group id="clone4_grp_keep" original="1"> + <primitive id="clone4_grp_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy" 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"/> + </bundle> + </resources> + <constraints original="1"> + <rsc_location id="location2_keep" rsc="primitive2_keep" node="node1" score="INFINITY" original="1"/> + <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="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_keep" original="1"> + <resource_ref id="clone2_keep" 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="colocation4_keep" rsc="primitive4_keep" with-rsc="primitive2_keep" original="1"/> + <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="clone4_keep" original="1"/> + </resource_set> + </rsc_colocation> + <rsc_colocation id="colocation7_keep" original="1"> + <resource_set id="colocation7_keep-set_keep" original="1"> + <resource_ref id="clone2_keep" original="1"/> + <resource_ref id="clone4_keep" original="1"/> + </resource_set> + </rsc_colocation> + <rsc_order id="order4_keep" first="primitive4_keep" then="primitive2_keep" original="1"/> + <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="clone4_keep" original="1"/> + </resource_set> + </rsc_order> + <rsc_order id="order7_keep" original="1"> + <resource_set id="order7_keep-set_keep" original="1"> + <resource_ref id="clone2_keep" original="1"/> + <resource_ref id="clone4_keep" original="1"/> + </resource_set> + </rsc_order> + <rsc_ticket id="ticket2_keep" rsc="primitive2_keep" ticket="ticket1" original="1"/> + <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="clone4_keep" original="1"/> + </resource_set> + </rsc_ticket> + <rsc_ticket id="ticket5_keep" ticket="ticket1" original="1"> + <resource_set id="ticket5_keep-set_keep" original="1"> + <resource_ref id="clone2_keep" 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 new file mode 100644 index 0000000000..83e90b3b17 --- /dev/null +++ b/cts/schemas/test-3/ref/upstart.ref-99 @@ -0,0 +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_keep" class="ocf" provider="pacemaker" type="Dummy"/> + <primitive id="primitive2_keep" class="ocf" provider="pacemaker" type="Dummy"/> + <primitive id="primitive4_keep" template="template_keep"/> + <group id="grp2_keep"> + <primitive id="grp2_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy"/> + <primitive id="grp2_rsc4_keep" template="template_keep"/> + </group> + <clone id="clone2_keep"> + <primitive id="clone2_rsc_keep" class="ocf" provider="pacemaker" type="Dummy"/> + </clone> + <clone id="clone4_keep"> + <group id="clone4_grp_keep"> + <primitive id="clone4_grp_rsc2_keep" class="ocf" provider="pacemaker" type="Dummy"/> + <primitive id="clone4_grp_rsc4_keep" template="template_keep"/> + </group> + </clone> + <bundle id="bundle_keep"> + <podman image="image"/> + </bundle> + </resources> + <constraints> + <rsc_location id="location2_keep" rsc="primitive2_keep" node="node1" score="INFINITY"/> + <rsc_location id="location4_keep" node="node1" score="INFINITY"> + <resource_set id="location4_keep-set"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_location> + <rsc_location id="location5_keep" node="node1" score="INFINITY"> + <resource_set id="location5_keep-set_keep"> + <resource_ref id="clone2_keep"/> + <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="colocation4_keep" rsc="primitive4_keep" with-rsc="primitive2_keep"/> + <rsc_colocation id="colocation6_keep"> + <resource_set id="colocation6_keep-set"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_colocation> + <rsc_colocation id="colocation7_keep"> + <resource_set id="colocation7_keep-set_keep"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_colocation> + <rsc_order id="order4_keep" first="primitive4_keep" then="primitive2_keep"/> + <rsc_order id="order6_keep"> + <resource_set id="order6_keep-set"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_order> + <rsc_order id="order7_keep"> + <resource_set id="order7_keep-set_keep"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_order> + <rsc_ticket id="ticket2_keep" rsc="primitive2_keep" ticket="ticket1"/> + <rsc_ticket id="ticket4_keep" ticket="ticket1"> + <resource_set id="ticket4_keep-set"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_ticket> + <rsc_ticket id="ticket5_keep" ticket="ticket1"> + <resource_set id="ticket5_keep-set_keep"> + <resource_ref id="clone2_keep"/> + <resource_ref id="clone4_keep"/> + </resource_set> + </rsc_ticket> + </constraints> + </configuration> + <status/> +</cib> diff --git a/cts/schemas/test-3/xml/nagios.xml b/cts/schemas/test-3/xml/nagios.xml new file mode 100644 index 0000000000..b0e5fad0cf --- /dev/null +++ b/cts/schemas/test-3/xml/nagios.xml @@ -0,0 +1,188 @@ +<cib crm_feature_set="3.19.7" validate-with="pacemaker-3.10" epoch="8" num_updates="0" admin_epoch="0"> + <configuration> + <!-- The essential elements of this test are: + * There is an nagios template and an ocf template. + * There are nagios and ocf primitives, defined either inline or by + reference to the corresponding template. + * There is a group with only nagios primitives and a group with both + nagios and ocf primitives. + * There is a cloned nagios resource and a cloned ocf resource. + * There is a cloned group containing only nagios primitives and a + cloned group containing both nagios and ocf primitives. + * There is a bundle containing an nagios primitive. + * There are various constraints, many of which reference nagios + resources. + + In this situation: + * The nagios 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 nagios + members should be dropped. + * The bundle should be kept so that its container remains managed; its + primitive should be dropped. + * Constraints with attributes referencing nagios resources should be + dropped. + * Resource sets containing only references to nagios 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="nagios" type="Dummy"/> + <template id="template_keep" class="ocf" provider="pacemaker" type="Dummy"/> + <primitive id="primitive1_drop" class="nagios" 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="nagios" type="Dummy"/> + <primitive id="grp1_rsc2_drop" template="template_drop"/> + </group> + <group id="grp2_keep"> + <primitive id="grp2_rsc1_drop" class="nagios" 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="nagios" 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="nagios" 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="nagios" 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="nagios" 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/cts/schemas/test-3/xml/rkt.xml b/cts/schemas/test-3/xml/rkt.xml new file mode 100644 index 0000000000..6a479666a6 --- /dev/null +++ b/cts/schemas/test-3/xml/rkt.xml @@ -0,0 +1,141 @@ +<cib crm_feature_set="3.19.7" validate-with="pacemaker-3.10" epoch="8" num_updates="0" admin_epoch="0"> + <configuration> + <!-- The essential elements of this test are: + * There are three bundles: one rkt, one podman, and one docker. + * There are various constraints, many of which reference the rkt + bundle. + + In this situation: + * The rkt bundle should be dropped. + * Constraints with attributes referencing the rkt bundles should be + dropped. + * Resource sets containing only references to rkt bundles should be + * Constraints with resource sets should be dropped if all of their + resource sets should be dropped. + --> + <crm_config/> + <nodes/> + <resources> + <bundle id="bundle1_drop"> + <rkt image="image"/> + <primitive id="bundle1_rsc" class="ocf" provider="pacemaker" type="Dummy"/> + </bundle> + <bundle id="bundle2_keep"> + <podman image="image"/> + <primitive id="bundle2_rsc" class="ocf" provider="pacemaker" type="Dummy"/> + </bundle> + <bundle id="bundle3_keep"> + <docker image="image"/> + <primitive id="bundle3_rsc" class="ocf" provider="pacemaker" type="Dummy"/> + </bundle> + <bundle id="bundle4_drop"> + <rkt image="image"/> + <primitive id="bundle4_rsc" class="ocf" provider="pacemaker" type="Dummy"/> + </bundle> + </resources> + <constraints> + <rsc_location id="location1_drop" rsc="bundle1_drop" node="node1" score="INFINITY"/> + <rsc_location id="location2_keep" rsc="bundle2_keep" node="node1" score="INFINITY"/> + <rsc_location id="location3_drop" node="node1" score="INFINITY"> + <resource_set id="location3_drop-set"> + <resource_ref id="bundle1_drop"/> + </resource_set> + </rsc_location> + <rsc_location id="location4_keep" node="node1" score="INFINITY"> + <resource_set id="location4_keep-set"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle4_drop"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_location> + <rsc_location id="location5_keep" node="node1" score="INFINITY"> + <resource_set id="location5_keep-set_drop"> + <resource_ref id="bundle1_drop"/> + </resource_set> + <resource_set id="location5_keep-set_keep"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle4_drop"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_location> + <rsc_location id="location6_keep" rsc-pattern="bundle1_drop" node="node1" score="INFINITY"/> + <rsc_colocation id="colocation1_drop" rsc="bundle1_drop" with-rsc="bundle2_keep"/> + <rsc_colocation id="colocation2_drop" rsc="bundle2_keep" with-rsc="bundle1_drop"/> + <rsc_colocation id="colocation3_drop" rsc="bundle4_drop" with-rsc="bundle1_drop"/> + <rsc_colocation id="colocation4_keep" rsc="bundle3_keep" with-rsc="bundle2_keep"/> + <rsc_colocation id="colocation5_drop"> + <resource_set id="colocation5_drop-set"> + <resource_ref id="bundle1_drop"/> + </resource_set> + </rsc_colocation> + <rsc_colocation id="colocation6_keep"> + <resource_set id="colocation6_keep-set"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle4_drop"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_colocation> + <rsc_colocation id="colocation7_keep"> + <resource_set id="colocation7_keep-set_drop"> + <resource_ref id="bundle1_drop"/> + </resource_set> + <resource_set id="colocation7_keep-set_keep"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle4_drop"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_colocation> + <rsc_order id="order1_drop" first="bundle1_drop" then="bundle2_keep"/> + <rsc_order id="order2_drop" first="bundle2_keep" then="bundle1_drop"/> + <rsc_order id="order3_drop" first="bundle4_drop" then="bundle1_drop"/> + <rsc_order id="order4_keep" first="bundle3_keep" then="bundle2_keep"/> + <rsc_order id="order5_drop"> + <resource_set id="order5_drop-set"> + <resource_ref id="bundle1_drop"/> + </resource_set> + </rsc_order> + <rsc_order id="order6_keep"> + <resource_set id="order6_keep-set"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle4_drop"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_order> + <rsc_order id="order7_keep"> + <resource_set id="order7_keep-set_drop"> + <resource_ref id="bundle1_drop"/> + </resource_set> + <resource_set id="order7_keep-set_keep"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle4_drop"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_order> + <rsc_ticket id="ticket1_drop" rsc="bundle1_drop" ticket="ticket1"/> + <rsc_ticket id="ticket2_keep" rsc="bundle2_keep" ticket="ticket1"/> + <rsc_ticket id="ticket3_drop" ticket="ticket1"> + <resource_set id="ticket3_drop-set"> + <resource_ref id="bundle1_drop"/> + </resource_set> + </rsc_ticket> + <rsc_ticket id="ticket4_keep" ticket="ticket1"> + <resource_set id="ticket4_keep-set"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle4_drop"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_ticket> + <rsc_ticket id="ticket5_keep" ticket="ticket1"> + <resource_set id="ticket5_keep-set_drop"> + <resource_ref id="bundle1_drop"/> + </resource_set> + <resource_set id="ticket5_keep-set_keep"> + <resource_ref id="bundle2_keep"/> + <resource_ref id="bundle4_drop"/> + <resource_ref id="bundle3_keep"/> + </resource_set> + </rsc_ticket> + </constraints> + </configuration> + <status/> +</cib> diff --git a/cts/schemas/test-3/xml/upstart.xml b/cts/schemas/test-3/xml/upstart.xml new file mode 100644 index 0000000000..74cb6512f6 --- /dev/null +++ b/cts/schemas/test-3/xml/upstart.xml @@ -0,0 +1,188 @@ +<cib crm_feature_set="3.19.7" validate-with="pacemaker-3.10" 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..363fbbc33e 100644 --- a/xml/resources-4.0.rng +++ b/xml/resources-4.0.rng @@ -1,380 +1,351 @@ <?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 new file mode 100644 index 0000000000..9fde4ca460 --- /dev/null +++ b/xml/upgrade-3.10-4.xsl @@ -0,0 +1,172 @@ +<?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 nagios-class or upstart-class resources. If there were any prior + to this transformation, they have been dropped. + * There are no bundle resources based on rkt containers. 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) = 'nagios') + or (translate(@class, $upper, $lower) = 'upstart')]"/> + +<!-- Upstart-class primitives --> +<xsl:variable name="dropped_primitives" + select="//primitive + [(translate(@class, $upper, $lower) = 'nagios') + or (translate(@class, $upper, $lower) = 'upstart') + or (@template + and (count(key('template_id', @template) + |$dropped_templates) + = count($dropped_templates)))]"/> + +<!-- Groups containing only nagios- and upstart-class primitives --> +<xsl:variable name="dropped_groups" + select="//group[count(primitive|$dropped_primitives) + = count($dropped_primitives)]"/> + +<!-- Clones containing only nagios- and 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 + |//bundle[rkt]"/> + +<!-- Drop nagios- and 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 nagios- and 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> + +<!-- Drop rkt bundles --> +<xsl:template match="bundle[rkt]"/> + + +<!-- 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>