diff options
Diffstat (limited to 'xml')
-rw-r--r-- | xml/Makefile.am | 63 | ||||
-rw-r--r-- | xml/README.md | 2 | ||||
-rw-r--r-- | xml/alerts-3.10.rng | 82 | ||||
-rw-r--r-- | xml/api/crm_attribute-2.34.rng | 33 | ||||
-rw-r--r-- | xml/api/crm_attribute-2.36.rng | 33 | ||||
-rw-r--r-- | xml/api/crm_mon-2.35.rng | 197 | ||||
-rw-r--r-- | xml/api/crm_resource-2.36.rng | 289 | ||||
-rw-r--r-- | xml/api/crm_resource-2.37.rng | 348 | ||||
-rw-r--r-- | xml/api/crm_ticket-2.35.rng | 34 | ||||
-rw-r--r-- | xml/api/ocf-ra-1.1.rng | 221 | ||||
-rw-r--r-- | xml/api/options-2.34.rng | 37 | ||||
-rw-r--r-- | xml/api/options-2.36.rng | 46 | ||||
-rw-r--r-- | xml/api/stonith_admin-2.33.rng | 55 | ||||
-rw-r--r-- | xml/api/ticket-2.35.rng | 68 | ||||
-rwxr-xr-x | xml/best-match.sh | 98 | ||||
-rw-r--r-- | xml/constraints-3.10.rng | 287 | ||||
-rw-r--r-- | xml/constraints-next.rng | 4 | ||||
-rw-r--r-- | xml/nodes-3.10.rng | 46 | ||||
-rw-r--r-- | xml/nvset-3.10.rng | 68 | ||||
-rw-r--r-- | xml/options-3.10.rng | 133 | ||||
-rw-r--r-- | xml/resources-3.10.rng | 451 | ||||
-rwxr-xr-x | xml/rng-helper.in | 251 | ||||
-rw-r--r-- | xml/rule-3.10.rng | 433 | ||||
-rw-r--r-- | xml/version-diff.sh.in | 60 |
24 files changed, 3137 insertions, 202 deletions
diff --git a/xml/Makefile.am b/xml/Makefile.am index 6acb338..670a856 100644 --- a/xml/Makefile.am +++ b/xml/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004-2023 the Pacemaker project contributors +# Copyright 2004-2024 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -63,6 +63,7 @@ API_request_base = command-output \ crm_rule \ crm_shadow \ crm_simulate \ + crm_ticket \ crmadmin \ digests \ pacemakerd \ @@ -90,10 +91,13 @@ API_base = $(API_request_base) \ node-attrs \ node-history \ nodes \ + ocf-ra \ + options \ patchset \ resources \ status \ - subprocess-output + subprocess-output \ + ticket CIB_base = cib \ $(CIB_cfg_base) \ @@ -162,9 +166,9 @@ nodist_CIB_DATA = $(CIB_generated) nodist_MON_DATA = $(MON_generated) EXTRA_DIST = README.md \ - best-match.sh \ cibtr-2.rng \ context-of.xsl \ + rng-helper \ ocf-meta2man.xsl \ regression.sh \ upgrade-2.10-roundtrip.xsl \ @@ -191,22 +195,9 @@ api/api-result.rng: api/api-result-$(API_max).rng $(AM_V_at)$(MKDIR_P) api # might not exist in VPATH build $(AM_V_SCHEMA)cp $(top_builddir)/xml/$< $@ -api/api-result-%.rng: $(API_build_copies) best-match.sh Makefile.am - $(AM_V_at)echo '<?xml version="1.0" encoding="UTF-8"?>' > $@ - $(AM_V_at)echo '<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">' >> $@ - $(AM_V_at)echo ' <start>' >> $@ - $(AM_V_at)echo ' <element name="pacemaker-result">' >> $@ - $(AM_V_at)echo ' <attribute name="api-version"> <text /> </attribute>' >> $@ - $(AM_V_at)echo ' <attribute name="request"> <text /> </attribute>' >> $@ - $(AM_V_at)echo ' <optional>' >> $@ - $(AM_V_at)echo ' <choice>' >> $@ - $(AM_V_at)for rng in $(API_request_base); do $(srcdir)/best-match.sh api/$$rng $(*) $(@) " " || :; done - $(AM_V_at)echo ' </choice>' >> $@ - $(AM_V_at)echo ' </optional>' >> $@ - $(AM_V_at)$(srcdir)/best-match.sh api/status $(*) $(@) " " || : - $(AM_V_at)echo ' </element>' >> $@ - $(AM_V_at)echo ' </start>' >> $@ - $(AM_V_SCHEMA)echo '</grammar>' >> $@ +api/api-result-%.rng: $(API_build_copies) rng-helper Makefile.am + $(AM_V_SCHEMA)$(builddir)/rng-helper build_api_rng "$@" "$*" \ + $(API_request_base) crm_mon.rng: api/crm_mon-$(MON_max).rng $(AM_V_at)echo '<?xml version="1.0" encoding="UTF-8"?>' > $@ @@ -227,27 +218,15 @@ crm_mon.rng: api/crm_mon-$(MON_max).rng pacemaker.rng: pacemaker-$(CIB_max).rng $(AM_V_SCHEMA)cp $(top_builddir)/xml/$< $@ -pacemaker-%.rng: $(CIB_build_copies) best-match.sh Makefile.am - $(AM_V_at)echo '<?xml version="1.0" encoding="UTF-8"?>' > $@ - $(AM_V_at)echo '<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">' >> $@ - $(AM_V_at)echo ' <start>' >> $@ - $(AM_V_at)echo ' <element name="cib">' >> $@ - $(AM_V_at)$(srcdir)/best-match.sh cib $(*) $(@) " " - $(AM_V_at)echo ' <element name="configuration">' >> $@ - $(AM_V_at)echo ' <interleave>' >> $@ - $(AM_V_at)for rng in $(CIB_cfg_base); do $(srcdir)/best-match.sh $$rng $(*) $(@) " " || :; done - $(AM_V_at)echo ' </interleave>' >> $@ - $(AM_V_at)echo ' </element>' >> $@ - $(AM_V_at)echo ' <optional>' >> $@ - $(AM_V_at)echo ' <element name="status">' >> $@ - $(AM_V_at)$(srcdir)/best-match.sh status $(*) $(@) " " - $(AM_V_at)echo ' </element>' >> $@ - $(AM_V_at)echo ' </optional>' >> $@ - $(AM_V_at)echo ' </element>' >> $@ - $(AM_V_at)echo ' </start>' >> $@ - $(AM_V_SCHEMA)echo '</grammar>' >> $@ +pacemaker-%.rng: $(CIB_build_copies) rng-helper Makefile.am + $(AM_V_SCHEMA)$(builddir)/rng-helper build_cib_rng "$@" "$*" \ + $(CIB_cfg_base) # Dynamically generated CIB schema listing all pacemaker versions +# +# @COMPAT none, pacemaker-0.6, pacemaker-0.7, pacemaker-1.1, and +# transitional-0.6 are deprecated since 2.1.8, as is validate-with being +# optional versions.rng: pacemaker-$(CIB_max).rng Makefile.am $(AM_V_at)echo '<?xml version="1.0" encoding="UTF-8"?>' > $@ $(AM_V_at)echo '<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">' >> $@ @@ -273,14 +252,14 @@ versions.rng: pacemaker-$(CIB_max).rng Makefile.am $(AM_V_SCHEMA)echo '</grammar>' >> $@ .PHONY: diff -diff: best-match.sh +diff: rng-helper @echo "# Comparing changes in + since $(CIB_max)" - @./version-diff.sh ${CIB_version_pairs_last} + @$(builddir)/rng-helper diff ${CIB_version_pairs_last} .PHONY: fulldiff -fulldiff: best-match.sh +fulldiff: rng-helper @echo "# Comparing all changes across all the subsequent increments" - @./version-diff.sh ${CIB_version_pairs} + @$(builddir)/rng-helper diff ${CIB_version_pairs} CLEANFILES = $(API_generated) \ $(CIB_generated) \ diff --git a/xml/README.md b/xml/README.md index a3a1973..1fbd42c 100644 --- a/xml/README.md +++ b/xml/README.md @@ -20,6 +20,8 @@ A versioned schema offers transparent backward and forward compatibility. | Pacemaker | Latest Schema | Changed | --------- | ------------- | ---------------------------------------------- +| `2.1.8` | `3.10` | `alerts`, `constraints`, `nodes`, `nvset`, +| | | `options`, `resources`, `rule` | `2.1.5` | `3.9` | `alerts`, `constraints`, `nodes`, `nvset`, | | | `options`, `resources`, `rule` | `2.1.3` | `3.8` | `acls` diff --git a/xml/alerts-3.10.rng b/xml/alerts-3.10.rng new file mode 100644 index 0000000..6c58625 --- /dev/null +++ b/xml/alerts-3.10.rng @@ -0,0 +1,82 @@ +<?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-alerts"/> + </start> + + <define name="element-alerts"> + <optional> + <element name="alerts"> + <zeroOrMore> + <element name="alert"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <!-- path to the script called for alert --> + <attribute name="path"><text/></attribute> + <interleave> + <ref name="element-alert-extra"/> + <optional> + <element name="select"> + <interleave> + <optional> + <element name="select_attributes"> + <zeroOrMore> + <element name="attribute"> + <attribute name="id"><data type="ID"/></attribute> + <attribute name="name"><text/></attribute> + </element> + </zeroOrMore> + </element> + </optional> + <optional> + <element name="select_fencing"> + <empty/> + </element> + </optional> + <optional> + <element name="select_nodes"> + <empty/> + </element> + </optional> + <optional> + <element name="select_resources"> + <empty/> + </element> + </optional> + </interleave> + </element> + </optional> + <zeroOrMore> + <element name="recipient"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <attribute name="value"><text/></attribute> + <ref name="element-alert-extra"/> + </element> + </zeroOrMore> + </interleave> + </element> + </zeroOrMore> + </element> + </optional> + </define> + + <define name="element-alert-extra"> + <zeroOrMore> + <choice> + <element name="meta_attributes"> + <externalRef href="nvset-3.10.rng"/> + </element> + <element name="instance_attributes"> + <externalRef href="nvset-3.10.rng"/> + </element> + </choice> + </zeroOrMore> + </define> + +</grammar> diff --git a/xml/api/crm_attribute-2.34.rng b/xml/api/crm_attribute-2.34.rng new file mode 100644 index 0000000..8e84f0b --- /dev/null +++ b/xml/api/crm_attribute-2.34.rng @@ -0,0 +1,33 @@ +<?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-crm_attribute" /> + </start> + + <define name="element-crm_attribute"> + <choice> + <zeroOrMore> + <ref name="element-attribute" /> + </zeroOrMore> + <externalRef href="options-2.34.rng" /> + </choice> + </define> + + <define name="element-attribute"> + <element name="attribute"> + <optional> + <attribute name="scope"> <text /> </attribute> + </optional> + <optional> + <attribute name="id"> <text /> </attribute> + </optional> + <attribute name="name"> <text /> </attribute> + <attribute name="value"> <text /> </attribute> + <optional> + <attribute name="host"> <text /> </attribute> + </optional> + </element> + </define> +</grammar> diff --git a/xml/api/crm_attribute-2.36.rng b/xml/api/crm_attribute-2.36.rng new file mode 100644 index 0000000..2093a7d --- /dev/null +++ b/xml/api/crm_attribute-2.36.rng @@ -0,0 +1,33 @@ +<?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-crm_attribute" /> + </start> + + <define name="element-crm_attribute"> + <choice> + <zeroOrMore> + <ref name="element-attribute" /> + </zeroOrMore> + <externalRef href="options-2.36.rng" /> + </choice> + </define> + + <define name="element-attribute"> + <element name="attribute"> + <optional> + <attribute name="scope"> <text /> </attribute> + </optional> + <optional> + <attribute name="id"> <text /> </attribute> + </optional> + <attribute name="name"> <text /> </attribute> + <attribute name="value"> <text /> </attribute> + <optional> + <attribute name="host"> <text /> </attribute> + </optional> + </element> + </define> +</grammar> diff --git a/xml/api/crm_mon-2.35.rng b/xml/api/crm_mon-2.35.rng new file mode 100644 index 0000000..78ec973 --- /dev/null +++ b/xml/api/crm_mon-2.35.rng @@ -0,0 +1,197 @@ +<?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-crm-mon"/> + </start> + + <define name="element-crm-mon"> + <choice> + <ref name="element-crm-mon-disconnected" /> + <group> + <optional> + <externalRef href="pacemakerd-health-2.25.rng" /> + </optional> + <optional> + <ref name="element-summary" /> + </optional> + <optional> + <ref name="nodes-list" /> + </optional> + <optional> + <ref name="resources-list" /> + </optional> + <optional> + <ref name="node-attributes-list" /> + </optional> + <optional> + <externalRef href="node-history-2.12.rng"/> + </optional> + <optional> + <ref name="failures-list" /> + </optional> + <optional> + <ref name="fence-event-list" /> + </optional> + <optional> + <ref name="tickets-list" /> + </optional> + <optional> + <ref name="bans-list" /> + </optional> + </group> + </choice> + </define> + + <define name="element-crm-mon-disconnected"> + <element name="crm-mon-disconnected"> + <optional> + <attribute name="description"> <text /> </attribute> + </optional> + <optional> + <attribute name="pacemakerd-state"> <text /> </attribute> + </optional> + </element> + </define> + + <define name="element-summary"> + <element name="summary"> + <optional> + <element name="stack"> + <attribute name="type"> <text /> </attribute> + <optional> + <attribute name="pacemakerd-state"> + <text /> + </attribute> + </optional> + </element> + </optional> + <optional> + <element name="current_dc"> + <attribute name="present"> <data type="boolean" /> </attribute> + <optional> + <group> + <attribute name="version"> <text /> </attribute> + <attribute name="name"> <text /> </attribute> + <attribute name="id"> <text /> </attribute> + <attribute name="with_quorum"> <data type="boolean" /> </attribute> + </group> + </optional> + <optional> + <attribute name="mixed_version"> <data type="boolean" /> </attribute> + </optional> + </element> + </optional> + <optional> + <element name="last_update"> + <attribute name="time"> <text /> </attribute> + <optional> + <attribute name="origin"> <text /> </attribute> + </optional> + </element> + <element name="last_change"> + <attribute name="time"> <text /> </attribute> + <attribute name="user"> <text /> </attribute> + <attribute name="client"> <text /> </attribute> + <attribute name="origin"> <text /> </attribute> + </element> + </optional> + <optional> + <element name="nodes_configured"> + <attribute name="number"> <data type="nonNegativeInteger" /> </attribute> + </element> + <element name="resources_configured"> + <attribute name="number"> <data type="nonNegativeInteger" /> </attribute> + <attribute name="disabled"> <data type="nonNegativeInteger" /> </attribute> + <attribute name="blocked"> <data type="nonNegativeInteger" /> </attribute> + </element> + </optional> + <optional> + <element name="cluster_options"> + <attribute name="stonith-enabled"> <data type="boolean" /> </attribute> + <attribute name="symmetric-cluster"> <data type="boolean" /> </attribute> + <attribute name="no-quorum-policy"> <text /> </attribute> + <attribute name="maintenance-mode"> <data type="boolean" /> </attribute> + <attribute name="stop-all-resources"> <data type="boolean" /> </attribute> + <attribute name="stonith-timeout-ms"> <data type="integer" /> </attribute> + <attribute name="priority-fencing-delay-ms"> <data type="integer" /> </attribute> + </element> + </optional> + </element> + </define> + + <define name="resources-list"> + <element name="resources"> + <zeroOrMore> + <externalRef href="resources-2.29.rng" /> + </zeroOrMore> + </element> + </define> + + <define name="nodes-list"> + <element name="nodes"> + <zeroOrMore> + <externalRef href="nodes-2.29.rng" /> + </zeroOrMore> + </element> + </define> + + <define name="node-attributes-list"> + <element name="node_attributes"> + <zeroOrMore> + <externalRef href="node-attrs-2.8.rng" /> + </zeroOrMore> + </element> + </define> + + <define name="failures-list"> + <element name="failures"> + <zeroOrMore> + <externalRef href="failure-2.8.rng" /> + </zeroOrMore> + </element> + </define> + + <define name="fence-event-list"> + <element name="fence_history"> + <optional> + <attribute name="status"> <data type="integer" /> </attribute> + </optional> + <zeroOrMore> + <externalRef href="fence-event-2.15.rng" /> + </zeroOrMore> + </element> + </define> + + <define name="tickets-list"> + <element name="tickets"> + <zeroOrMore> + <externalRef href="ticket-2.35.rng" /> + </zeroOrMore> + </element> + </define> + + <define name="bans-list"> + <element name="bans"> + <zeroOrMore> + <ref name="element-ban" /> + </zeroOrMore> + </element> + </define> + + <define name="element-ban"> + <element name="ban"> + <attribute name="id"> <text /> </attribute> + <attribute name="resource"> <text /> </attribute> + <attribute name="node"> <text /> </attribute> + <attribute name="weight"> <data type="integer" /> </attribute> + <attribute name="promoted-only"> <data type="boolean" /> </attribute> + <!-- DEPRECATED: master_only is a duplicate of promoted-only that is + provided solely for API backward compatibility. It will be + removed in a future release. Check promoted-only instead. + --> + <attribute name="master_only"> <data type="boolean" /> </attribute> + </element> + </define> +</grammar> diff --git a/xml/api/crm_resource-2.36.rng b/xml/api/crm_resource-2.36.rng new file mode 100644 index 0000000..5050364 --- /dev/null +++ b/xml/api/crm_resource-2.36.rng @@ -0,0 +1,289 @@ +<?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-crm-resource"/> + </start> + + <define name="element-crm-resource"> + <choice> + <ref name="agents-list" /> + <ref name="alternatives-list" /> + <ref name="constraints-list" /> + <externalRef href="generic-list-2.4.rng"/> + <element name="metadata"> <text/> </element> + <ref name="locate-list" /> + <ref name="operations-list" /> + <externalRef href="options-2.36.rng"/> + <ref name="providers-list" /> + <ref name="reasons-list" /> + <ref name="resource-check" /> + <ref name="resource-config" /> + <ref name="resources-list" /> + <ref name="resource-agent-action" /> + </choice> + </define> + + <define name="agents-list"> + <element name="agents"> + <attribute name="standard"> <text/> </attribute> + <optional> + <attribute name="provider"> <text/> </attribute> + </optional> + <zeroOrMore> + <element name="agent"> <text/> </element> + </zeroOrMore> + </element> + </define> + + <define name="alternatives-list"> + <element name="providers"> + <attribute name="for"> <text/> </attribute> + <zeroOrMore> + <element name="provider"> <text/> </element> + </zeroOrMore> + </element> + </define> + + <define name="constraints-list"> + <element name="constraints"> + <interleave> + <zeroOrMore> + <ref name="rsc-location" /> + </zeroOrMore> + <zeroOrMore> + <ref name="rsc-colocation" /> + </zeroOrMore> + </interleave> + </element> + </define> + + <define name="locate-list"> + <element name="nodes"> + <attribute name="resource"> <text/> </attribute> + <zeroOrMore> + <element name="node"> + <optional> + <attribute name="state"><value>promoted</value></attribute> + </optional> + <text/> + </element> + </zeroOrMore> + </element> + </define> + + <define name="rsc-location"> + <element name="rsc_location"> + <attribute name="node"> <text/> </attribute> + <attribute name="rsc"> <text/> </attribute> + <attribute name="id"> <text/> </attribute> + <externalRef href="../score.rng"/> + </element> + </define> + + <define name="operations-list"> + <element name="operations"> + <oneOrMore> + <ref name="element-operation-list" /> + </oneOrMore> + </element> + </define> + + <define name="providers-list"> + <element name="providers"> + <attribute name="standard"> <value>ocf</value> </attribute> + <optional> + <attribute name="agent"> <text/> </attribute> + </optional> + <zeroOrMore> + <element name="provider"> <text/> </element> + </zeroOrMore> + </element> + </define> + + <define name="reasons-list"> + <element name="reason"> + <!-- set only when resource and node are both specified --> + <optional> + <attribute name="running_on"> <text/> </attribute> + </optional> + + <!-- set only when only a resource is specified --> + <optional> + <attribute name="running"> <data type="boolean"/> </attribute> + </optional> + + <choice> + <ref name="reasons-with-no-resource"/> + <ref name="resource-check"/> + </choice> + </element> + </define> + + <define name="reasons-with-no-resource"> + <element name="resources"> + <zeroOrMore> + <element name="resource"> + <attribute name="id"> <text/> </attribute> + <attribute name="running"> <data type="boolean"/> </attribute> + <optional> + <attribute name="host"> <text/> </attribute> + </optional> + <ref name="resource-check"/> + </element> + </zeroOrMore> + </element> + </define> + + <define name="resource-config"> + <element name="resource_config"> + <externalRef href="resources-2.29.rng" /> + <element name="xml"> <text/> </element> + </element> + </define> + + <define name="resource-check"> + <element name="check"> + <attribute name="id"> <text/> </attribute> + <optional> + <choice> + <attribute name="remain_stopped"><value>true</value></attribute> + <attribute name="promotable"><value>false</value></attribute> + </choice> + </optional> + <optional> + <attribute name="unmanaged"><value>true</value></attribute> + </optional> + <optional> + <attribute name="locked-to"> <text/> </attribute> + </optional> + <optional> + <attribute name="unhealthy"><value>true</value></attribute> + </optional> + </element> + </define> + + <define name="resources-list"> + <element name="resources"> + <zeroOrMore> + <externalRef href="resources-2.29.rng" /> + </zeroOrMore> + </element> + </define> + + <define name="rsc-colocation"> + <element name="rsc_colocation"> + <attribute name="id"> <text/> </attribute> + <attribute name="rsc"> <text/> </attribute> + <attribute name="with-rsc"> <text/> </attribute> + <externalRef href="../score.rng"/> + <optional> + <attribute name="node-attribute"> <text/> </attribute> + </optional> + <optional> + <attribute name="rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <optional> + <attribute name="with-rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + </element> + </define> + + <define name="element-operation-list"> + <element name="operation"> + <optional> + <group> + <attribute name="rsc"> <text/> </attribute> + <attribute name="agent"> <text/> </attribute> + </group> + </optional> + <attribute name="op"> <text/> </attribute> + <attribute name="node"> <text/> </attribute> + <attribute name="call"> <data type="integer" /> </attribute> + <attribute name="rc"> <data type="nonNegativeInteger" /> </attribute> + <optional> + <attribute name="last-rc-change"> <text/> </attribute> + <attribute name="exec-time"> <data type="nonNegativeInteger" /> </attribute> + </optional> + <attribute name="status"> <text/> </attribute> + </element> + </define> + + <define name="resource-agent-action"> + <element name="resource-agent-action"> + <attribute name="action"> <text/> </attribute> + <optional> + <attribute name="rsc"> <text/> </attribute> + </optional> + <attribute name="class"> <text/> </attribute> + <attribute name="type"> <text/> </attribute> + <optional> + <attribute name="provider"> <text/> </attribute> + </optional> + <optional> + <ref name="overrides-list"/> + </optional> + <ref name="agent-status"/> + <optional> + <element name="command"> + <choice> + <text /> + <externalRef href="subprocess-output-2.23.rng"/> + </choice> + </element> + </optional> + </element> + </define> + + <define name="overrides-list"> + <element name="overrides"> + <zeroOrMore> + <element name="override"> + <optional> + <attribute name="rsc"> <text/> </attribute> + </optional> + <attribute name="name"> <text/> </attribute> + <attribute name="value"> <text/> </attribute> + </element> + </zeroOrMore> + </element> + </define> + + <define name="agent-status"> + <element name="agent-status"> + <attribute name="code"> <data type="integer" /> </attribute> + <optional> + <attribute name="message"> <text/> </attribute> + </optional> + <optional> + <attribute name="execution_code"> <data type="integer" /> </attribute> + </optional> + <optional> + <attribute name="execution_message"> <text/> </attribute> + </optional> + <optional> + <attribute name="reason"> <text/> </attribute> + </optional> + </element> + </define> + + <define name="attribute-roles"> + <choice> + <value>Stopped</value> + <value>Started</value> + <value>Promoted</value> + <value>Unpromoted</value> + + <!-- These synonyms for Promoted/Unpromoted are allowed for + backward compatibility with output from older Pacemaker + versions that used them --> + <value>Master</value> + <value>Slave</value> + </choice> + </define> +</grammar> diff --git a/xml/api/crm_resource-2.37.rng b/xml/api/crm_resource-2.37.rng new file mode 100644 index 0000000..d242b85 --- /dev/null +++ b/xml/api/crm_resource-2.37.rng @@ -0,0 +1,348 @@ +<?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-crm-resource"/> + </start> + + <define name="element-crm-resource"> + <choice> + <ref name="agents-list" /> + <ref name="alternatives-list" /> + <ref name="constraints-list" /> + <externalRef href="generic-list-2.4.rng"/> + <element name="metadata"> <text/> </element> + <ref name="locate-list" /> + <ref name="operations-list" /> + <externalRef href="options-2.36.rng"/> + <ref name="providers-list" /> + <ref name="reasons-list" /> + <ref name="resource-check" /> + <ref name="resource-config" /> + <ref name="resources-list" /> + <ref name="resource-agent-action" /> + <ref name="resource-settings-list" /> + </choice> + </define> + + <define name="agents-list"> + <element name="agents"> + <attribute name="standard"> <text/> </attribute> + <optional> + <attribute name="provider"> <text/> </attribute> + </optional> + <zeroOrMore> + <element name="agent"> <text/> </element> + </zeroOrMore> + </element> + </define> + + <define name="alternatives-list"> + <element name="providers"> + <attribute name="for"> <text/> </attribute> + <zeroOrMore> + <element name="provider"> <text/> </element> + </zeroOrMore> + </element> + </define> + + <define name="constraints-list"> + <element name="constraints"> + <interleave> + <zeroOrMore> + <ref name="rsc-location" /> + </zeroOrMore> + <zeroOrMore> + <ref name="rsc-colocation" /> + </zeroOrMore> + </interleave> + </element> + </define> + + <define name="locate-list"> + <element name="nodes"> + <attribute name="resource"> <text/> </attribute> + <zeroOrMore> + <element name="node"> + <optional> + <attribute name="state"><value>promoted</value></attribute> + </optional> + <text/> + </element> + </zeroOrMore> + </element> + </define> + + <define name="rsc-location"> + <element name="rsc_location"> + <attribute name="node"> <text/> </attribute> + <attribute name="rsc"> <text/> </attribute> + <attribute name="id"> <text/> </attribute> + <externalRef href="../score.rng"/> + </element> + </define> + + <define name="operations-list"> + <element name="operations"> + <oneOrMore> + <ref name="element-operation-list" /> + </oneOrMore> + </element> + </define> + + <define name="providers-list"> + <element name="providers"> + <attribute name="standard"> <value>ocf</value> </attribute> + <optional> + <attribute name="agent"> <text/> </attribute> + </optional> + <zeroOrMore> + <element name="provider"> <text/> </element> + </zeroOrMore> + </element> + </define> + + <define name="reasons-list"> + <element name="reason"> + <!-- set only when resource and node are both specified --> + <optional> + <attribute name="running_on"> <text/> </attribute> + </optional> + + <!-- set only when only a resource is specified --> + <optional> + <attribute name="running"> <data type="boolean"/> </attribute> + </optional> + + <choice> + <ref name="reasons-with-no-resource"/> + <ref name="resource-check"/> + </choice> + </element> + </define> + + <define name="reasons-with-no-resource"> + <element name="resources"> + <zeroOrMore> + <element name="resource"> + <attribute name="id"> <text/> </attribute> + <attribute name="running"> <data type="boolean"/> </attribute> + <optional> + <attribute name="host"> <text/> </attribute> + </optional> + <ref name="resource-check"/> + </element> + </zeroOrMore> + </element> + </define> + + <define name="resource-config"> + <element name="resource_config"> + <externalRef href="resources-2.29.rng" /> + <element name="xml"> <text/> </element> + </element> + </define> + + <define name="resource-check"> + <element name="check"> + <attribute name="id"> <text/> </attribute> + <optional> + <choice> + <attribute name="remain_stopped"><value>true</value></attribute> + <attribute name="promotable"><value>false</value></attribute> + </choice> + </optional> + <optional> + <attribute name="unmanaged"><value>true</value></attribute> + </optional> + <optional> + <attribute name="locked-to"> <text/> </attribute> + </optional> + <optional> + <attribute name="unhealthy"><value>true</value></attribute> + </optional> + </element> + </define> + + <define name="resources-list"> + <element name="resources"> + <zeroOrMore> + <externalRef href="resources-2.29.rng" /> + </zeroOrMore> + </element> + </define> + + <define name="rsc-colocation"> + <element name="rsc_colocation"> + <attribute name="id"> <text/> </attribute> + <attribute name="rsc"> <text/> </attribute> + <attribute name="with-rsc"> <text/> </attribute> + <externalRef href="../score.rng"/> + <optional> + <attribute name="node-attribute"> <text/> </attribute> + </optional> + <optional> + <attribute name="rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <optional> + <attribute name="with-rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + </element> + </define> + + <define name="element-operation-list"> + <element name="operation"> + <optional> + <group> + <attribute name="rsc"> <text/> </attribute> + <attribute name="agent"> <text/> </attribute> + </group> + </optional> + <attribute name="op"> <text/> </attribute> + <attribute name="node"> <text/> </attribute> + <attribute name="call"> <data type="integer" /> </attribute> + <attribute name="rc"> <data type="nonNegativeInteger" /> </attribute> + <optional> + <attribute name="last-rc-change"> <text/> </attribute> + <attribute name="exec-time"> <data type="nonNegativeInteger" /> </attribute> + </optional> + <attribute name="status"> <text/> </attribute> + </element> + </define> + + <define name="resource-agent-action"> + <element name="resource-agent-action"> + <attribute name="action"> <text/> </attribute> + <optional> + <attribute name="rsc"> <text/> </attribute> + </optional> + <attribute name="class"> <text/> </attribute> + <attribute name="type"> <text/> </attribute> + <optional> + <attribute name="provider"> <text/> </attribute> + </optional> + <optional> + <ref name="overrides-list"/> + </optional> + <ref name="agent-status"/> + <optional> + <element name="command"> + <choice> + <text /> + <externalRef href="subprocess-output-2.23.rng"/> + </choice> + </element> + </optional> + </element> + </define> + + <define name="resource-settings-list"> + <element name="resource-settings"> + <zeroOrMore> + <choice> + <ref name="element-bundle-settings"/> + <ref name="element-clone-settings"/> + <ref name="element-group-settings"/> + <ref name="element-primitive-settings"/> + </choice> + </zeroOrMore> + </element> + </define> + + <define name="element-bundle-settings"> + <element name="bundle"> + <ref name="element-resource-setting-attrs" /> + </element> + </define> + + <define name="element-clone-settings"> + <element name="clone"> + <ref name="element-resource-setting-attrs" /> + </element> + </define> + + <define name="element-group-settings"> + <element name="group"> + <ref name="element-resource-setting-attrs" /> + </element> + </define> + + <define name="element-primitive-settings"> + <element name="primitive"> + <ref name="element-resource-setting-attrs" /> + </element> + </define> + + <define name="element-resource-setting-attrs"> + <attribute name="id"> <data type="ID"/> </attribute> + <interleave> + <optional> + <element name="meta_attributes"> + <externalRef href="../nvset-3.10.rng" /> + </element> + </optional> + <optional> + <element name="instance_attributes"> + <externalRef href="../nvset-3.10.rng" /> + </element> + </optional> + <optional> + <element name="utilization"> + <externalRef href="../nvset-3.10.rng" /> + </element> + </optional> + </interleave> + </define> + + <define name="overrides-list"> + <element name="overrides"> + <zeroOrMore> + <element name="override"> + <optional> + <attribute name="rsc"> <text/> </attribute> + </optional> + <attribute name="name"> <text/> </attribute> + <attribute name="value"> <text/> </attribute> + </element> + </zeroOrMore> + </element> + </define> + + <define name="agent-status"> + <element name="agent-status"> + <attribute name="code"> <data type="integer" /> </attribute> + <optional> + <attribute name="message"> <text/> </attribute> + </optional> + <optional> + <attribute name="execution_code"> <data type="integer" /> </attribute> + </optional> + <optional> + <attribute name="execution_message"> <text/> </attribute> + </optional> + <optional> + <attribute name="reason"> <text/> </attribute> + </optional> + </element> + </define> + + <define name="attribute-roles"> + <choice> + <value>Stopped</value> + <value>Started</value> + <value>Promoted</value> + <value>Unpromoted</value> + + <!-- These synonyms for Promoted/Unpromoted are allowed for + backward compatibility with output from older Pacemaker + versions that used them --> + <value>Master</value> + <value>Slave</value> + </choice> + </define> +</grammar> diff --git a/xml/api/crm_ticket-2.35.rng b/xml/api/crm_ticket-2.35.rng new file mode 100644 index 0000000..b2d72f6 --- /dev/null +++ b/xml/api/crm_ticket-2.35.rng @@ -0,0 +1,34 @@ +<?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-crm_ticket"/> + </start> + + <define name="element-crm_ticket"> + <ref name="tickets-list" /> + <optional> + <ref name="resources-list" /> + </optional> + </define> + + <define name="resources-list"> + <element name="resources"> + <zeroOrMore> + <element name="resource"> + <attribute name="id"> <data type="ID" /> </attribute> + </element> + </zeroOrMore> + </element> + </define> + + <define name="tickets-list"> + <element name="tickets"> + <zeroOrMore> + <externalRef href="ticket-2.35.rng" /> + </zeroOrMore> + </element> + </define> + +</grammar> diff --git a/xml/api/ocf-ra-1.1.rng b/xml/api/ocf-ra-1.1.rng new file mode 100644 index 0000000..5186d9f --- /dev/null +++ b/xml/api/ocf-ra-1.1.rng @@ -0,0 +1,221 @@ +<?xml version="1.0" encoding="utf-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + + <!-- + Version 1.1 of the OCF resource agent API schema + Adapted from https://github.com/ClusterLabs/OCF-spec + --> + <start> + <ref name="element-resource-agent" /> + </start> + + <define name="element-resource-agent"> + <element name="resource-agent"> + <attribute name="name" /> + <optional> + <attribute name="version" /> + </optional> + + <element name="version"> <text /> </element> + + <zeroOrMore> + <ref name="element-longdesc" /> + </zeroOrMore> + + <zeroOrMore> + <ref name="element-shortdesc" /> + </zeroOrMore> + + <ref name="element-parameters" /> + <ref name="element-actions" /> + <optional> + <ref name="element-special" /> + </optional> + </element> + </define> + + <define name="element-parameters"> + <element name="parameters"> + <oneOrMore> + <ref name="element-parameter" /> + </oneOrMore> + </element> + </define> + + <define name="element-parameter"> + <element name="parameter"> + <ref name="parameter-attributes" /> + + <optional> + <ref name="element-deprecated" /> + </optional> + + <oneOrMore> + <ref name="element-longdesc" /> + </oneOrMore> + + <oneOrMore> + <ref name="element-shortdesc" /> + </oneOrMore> + + <ref name="element-content" /> + </element> + </define> + + <define name="parameter-attributes"> + <attribute name="name" /> + <optional> + <attribute name="unique-group" /> + </optional> + <optional> + <!-- "unique" is deprecated --> + <attribute name="unique"> + <ref name="boolean-values" /> + </attribute> + </optional> + <optional> + <attribute name="required"> + <ref name="boolean-values" /> + </attribute> + </optional> + <optional> + <attribute name="reloadable"> + <ref name="boolean-values" /> + </attribute> + </optional> + </define> + + <define name="boolean-values"> + <choice> + <value>0</value> + <value>1</value> + </choice> + </define> + + <define name="element-deprecated"> + <element name="deprecated"> + <empty /> + <interleave> + <zeroOrMore> + <element name="replaced-with"> + <attribute name="name" /> + </element> + </zeroOrMore> + <zeroOrMore> + <element name="desc"> + <ref name="description" /> + </element> + </zeroOrMore> + </interleave> + </element> + </define> + + <define name="element-longdesc"> + <element name="longdesc"> + <ref name="description" /> + </element> + </define> + + <define name="element-shortdesc"> + <element name="shortdesc"> + <ref name="description" /> + </element> + </define> + + <define name="description"> + <attribute name="lang" /> + <ref name="anyElement" /> + </define> + + <define name="element-content"> + <element name="content"> + <choice> + <attribute name="type"> + <ref name="atomic-types" /> + </attribute> + <group> + <attribute name="type"> + <value>select</value> + </attribute> + <oneOrMore> + <element name="option"> + <attribute name="value" /> + </element> + </oneOrMore> + </group> + </choice> + <optional> + <attribute name="default" /> + </optional> + </element> + </define> + + <define name="atomic-types"> + <choice> + <value>boolean</value> + <value>string</value> + <value>integer</value> + </choice> + </define> + + <define name="element-actions"> + <element name="actions"> + <oneOrMore> + <ref name="element-action" /> + </oneOrMore> + </element> + </define> + + <define name="element-action"> + <element name="action"> + <attribute name="name" /> + <attribute name="timeout" /> + <optional> + <attribute name="interval" /> + </optional> + <optional> + <attribute name="start-delay" /> + </optional> + <optional> + <attribute name="depth" /> + </optional> + <optional> + <attribute name="role" /> + </optional> + </element> + </define> + + <define name="element-special"> + <element name="special"> + <attribute name="tag" /> + <ref name="anyElement" /> + </element> + </define> + + <define name="anyElement"> + <zeroOrMore> + <choice> + <text/> + <element> + <anyName/> + <ref name="any" /> + </element> + </choice> + </zeroOrMore> + </define> + + <define name="any"> + <zeroOrMore> + <choice> + <attribute><anyName /></attribute> + <text/> + <element> + <anyName/> + <ref name="any" /> + </element> + </choice> + </zeroOrMore> + </define> + +</grammar> diff --git a/xml/api/options-2.34.rng b/xml/api/options-2.34.rng new file mode 100644 index 0000000..94d3aad --- /dev/null +++ b/xml/api/options-2.34.rng @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + + <!-- + Pacemaker outputs option lists in an OCF-like XML format, but there are + differences that break validation against the unaltered schema. + --> + + <include href="ocf-ra-1.1.rng"> + <!-- + The OCF RA 1.1 schema requires an actions element. Pacemaker option + lists don't include an actions element. + --> + <define name="element-actions"> + <empty /> + </define> + </include> + + <!-- Extend the allowed types to include percentage and time --> + <define name="atomic-types" combine="choice"> + <choice> + <value>percentage</value> + <value>time</value> + </choice> + </define> + + <!-- Pacemaker options have additional parameter attributes --> + <define name="parameter-attributes" combine="interleave"> + <!-- Parameter is for advanced use only --> + <attribute name="advanced" /> + + <!-- Parameter's value is Pacemaker-generated, not user-configured --> + <attribute name="generated" /> + </define> + +</grammar> diff --git a/xml/api/options-2.36.rng b/xml/api/options-2.36.rng new file mode 100644 index 0000000..280e398 --- /dev/null +++ b/xml/api/options-2.36.rng @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + + <!-- + Pacemaker outputs option lists in an OCF-like XML format, but there are + differences that break validation against the unaltered schema. + --> + + <include href="ocf-ra-1.1.rng"> + <!-- + The OCF RA 1.1 schema requires an actions element. Pacemaker option + lists don't include an actions element. + --> + <define name="element-actions"> + <empty /> + </define> + </include> + + <!-- Extend the allowed types (see Pacemaker Explained for details) --> + <define name="atomic-types" combine="choice"> + <choice> + <value>duration</value> + <value>epoch_time</value> + <value>nonnegative_integer</value> + <value>percentage</value> + <value>port</value> + <value>score</value> + <value>timeout</value> + <value>version</value> + + <!-- @COMPAT Deprecated --> + <value>time</value> + </choice> + </define> + + <!-- Pacemaker options have additional parameter attributes --> + <define name="parameter-attributes" combine="interleave"> + <!-- Parameter is for advanced use only --> + <attribute name="advanced" /> + + <!-- Parameter's value is Pacemaker-generated, not user-configured --> + <attribute name="generated" /> + </define> + +</grammar> diff --git a/xml/api/stonith_admin-2.33.rng b/xml/api/stonith_admin-2.33.rng new file mode 100644 index 0000000..3cf63fb --- /dev/null +++ b/xml/api/stonith_admin-2.33.rng @@ -0,0 +1,55 @@ +<?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-stonith-admin"/> + </start> + + <define name="element-stonith-admin"> + <choice> + <ref name="stonith-admin-list" /> + <ref name="element-last-fenced" /> + <ref name="element-validation" /> + <element name="metadata"> <text /> </element> + </choice> + </define> + + <define name="stonith-admin-list"> + <optional> + <element name="list"> + <attribute name="name"> <text /> </attribute> + <attribute name="count"> <data type="nonNegativeInteger" /> </attribute> + <choice> + <empty/> + <oneOrMore> + <externalRef href="item-1.1.rng"/> + </oneOrMore> + <oneOrMore> + <externalRef href="fence-event-2.15.rng"/> + </oneOrMore> + </choice> + </element> + </optional> + </define> + + <define name="element-last-fenced"> + <element name="last-fenced"> + <attribute name="target"> <text /> </attribute> + <attribute name="when"> <text /> </attribute> + </element> + </define> + + <define name="element-validation"> + <element name="validate"> + <attribute name="agent"> <text /> </attribute> + <attribute name="valid"> <data type="boolean" /> </attribute> + <optional> + <attribute name="device"> <text /> </attribute> + </optional> + <optional> + <externalRef href="command-output-2.23.rng" /> + </optional> + </element> + </define> +</grammar> diff --git a/xml/api/ticket-2.35.rng b/xml/api/ticket-2.35.rng new file mode 100644 index 0000000..017ef38 --- /dev/null +++ b/xml/api/ticket-2.35.rng @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + + <include href="../constraints-3.9.rng"> + <start> + <ref name="element-ticket"/> + </start> + + <!-- This redefines the constraints element from constraints-X.X.rng + so it can only contain the element-rsc_ticket element. This allows + us to restrict it so only those kinds of constraints are allowed + in ticket XML. + --> + <define name="element-constraints"> + <element name="constraints"> + <zeroOrMore> + <ref name="element-rsc_ticket"/> + </zeroOrMore> + </element> + </define> + </include> + + <define name="element-ticket"> + <element name="ticket"> + <attribute name="id"> <text /> </attribute> + <optional> + <attribute name="status"> + <choice> + <value>granted</value> + <value>revoked</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="standby"> <data type="boolean" /> </attribute> + </optional> + <optional> + <attribute name="last-granted"> <text /> </attribute> + </optional> + <optional> + <element name="attribute"> + <attribute name="name"> <text /> </attribute> + <attribute name="value"> <text /> </attribute> + </element> + </optional> + <zeroOrMore> + <attribute> + <anyName> + <except> + <name>attribute</name> + <name>constraints</name> + <name>id</name> + <name>last-granted</name> + <name>standby</name> + <name>status</name> + </except> + </anyName> + <text /> + </attribute> + </zeroOrMore> + <optional> + <ref name="element-constraints" /> + </optional> + </element> + </define> + +</grammar> diff --git a/xml/best-match.sh b/xml/best-match.sh deleted file mode 100755 index 580c29f..0000000 --- a/xml/best-match.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh -# -# Find the (sub-)schema that best matches a desired version. -# -# Version numbers are assumed to be in the format X.Y, -# where X and Y are integers, and Y is no more than 3 digits, -# or the special value "next". -# - -# (Sub-)schema name (e.g. "resources") -base="$1"; shift - -# Desired version (e.g. "1.0" or "next") -target="$1"; shift - -# If not empty, append the best match as an XML externalRef to this file -# (otherwise, just echo the best match). Using readlink allows building -# from a different directory. -destination="$(readlink -f "$1")"; shift - -# Arbitrary text to print before XML (generally spaces to indent) -prefix="$1"; shift - -# Allow building from a different directory -cd "$(dirname $0)" - -list_candidates() { - ls -1 "${1}.rng" "${1}"-[0-9]*.rng 2>/dev/null -} - -version_from_filename() { - vff_filename="$1" - - case "$vff_filename" in - *-*.rng) - echo "$vff_filename" | sed -e 's/.*-\(.*\).rng/\1/' - ;; - *) - # special case for bare ${base}.rng, no -0.1's around anyway - echo 0.1 - ;; - esac -} - -filename_from_version() { - ffv_version="$1" - ffv_base="$2" - - if [ "$ffv_version" = "0.1" ]; then - echo "${ffv_base}.rng" - else - echo "${ffv_base}-${ffv_version}.rng" - fi -} - -# Convert version string (e.g. 2.10) into integer (e.g. 2010) for comparisons -int_version() { - echo "$1" | awk -F. '{ printf("%d%03d\n", $1,$2); }'; -} - -best="0.0" -for rng in $(list_candidates "${base}"); do - case ${rng} in - ${base}-${target}.rng) - # We found exactly what was requested - best=${target} - break - ;; - *-next.rng) - # "Next" schemas cannot be a best match unless directly requested - ;; - *) - v=$(version_from_filename "${rng}") - if [ $(int_version "${v}") -gt $(int_version "${best}") ]; then - # This version beats the previous best match - - if [ "${target}" = "next" ]; then - best=${v} - elif [ $(int_version "${v}") -lt $(int_version "${target}") ]; then - # This value is best only if it's still less than the target - best=${v} - fi - fi - ;; - esac -done - -if [ "$best" != "0.0" ]; then - found=$(filename_from_version "$best" "$base") - if [ -z "$destination" ]; then - echo "$(basename $found)" - else - echo "${prefix}<externalRef href=\"$(basename $found)\"/>" >> "$destination" - fi - exit 0 -fi - -exit 1 diff --git a/xml/constraints-3.10.rng b/xml/constraints-3.10.rng new file mode 100644 index 0000000..5fbb7ac --- /dev/null +++ b/xml/constraints-3.10.rng @@ -0,0 +1,287 @@ +<?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-constraints"/> + </start> + + <define name="element-constraints"> + <element name="constraints"> + <zeroOrMore> + <choice> + <ref name="element-location"/> + <ref name="element-colocation"/> + <ref name="element-order"/> + <ref name="element-rsc_ticket"/> + </choice> + </zeroOrMore> + </element> + </define> + + <define name="element-location"> + <element name="rsc_location"> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <group> + <choice> + <attribute name="rsc"><data type="IDREF"/></attribute> + <attribute name="rsc-pattern"><text/></attribute> + </choice> + <optional> + <attribute name="role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + </group> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + </choice> + <choice> + <group> + <externalRef href="score.rng"/> + <attribute name="node"><text/></attribute> + </group> + <!-- + @COMPAT: When we can break backward compatibility, limit this to a + single rule + --> + <oneOrMore> + <grammar> + <include href="rule-3.10.rng"> + <start> + <ref name="element-rule-location"/> + </start> + </include> + </grammar> + </oneOrMore> + </choice> + + <!-- @COMPAT: The lifetime element is deprecated --> + <optional> + <ref name="element-lifetime"/> + </optional> + + <optional> + <attribute name="resource-discovery"> + <ref name="attribute-discovery"/> + </attribute> + </optional> + </element> + </define> + + <define name="element-resource-set"> + <element name="resource_set"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="sequential"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="require-all"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="ordering"> + <choice> + <value>group</value> + <value>listed</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + <optional> + <attribute name="role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="kind"> + <ref name="order-types"/> + </attribute> + </choice> + </optional> + <oneOrMore> + <element name="resource_ref"> + <attribute name="id"><data type="IDREF"/></attribute> + </element> + </oneOrMore> + </group> + </choice> + </element> + </define> + + <define name="element-colocation"> + <element name="rsc_colocation"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <externalRef href="score.rng"/> + </optional> + <optional> + <attribute name="influence"><text/></attribute> + </optional> + + <!-- @COMPAT: The lifetime element is deprecated --> + <optional> + <ref name="element-lifetime"/> + </optional> + + <choice> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + <group> + <attribute name="rsc"><data type="IDREF"/></attribute> + <attribute name="with-rsc"><data type="IDREF"/></attribute> + <optional> + <attribute name="node-attribute"><text/></attribute> + </optional> + <optional> + <attribute name="rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <optional> + <attribute name="with-rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + </group> + </choice> + </element> + </define> + + <define name="element-order"> + <element name="rsc_order"> + <attribute name="id"><data type="ID"/></attribute> + + <!-- @COMPAT: The lifetime element is deprecated --> + <optional> + <ref name="element-lifetime"/> + </optional> + + <optional> + <attribute name="symmetrical"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="require-all"><data type="boolean"/></attribute> + </optional> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="kind"> + <ref name="order-types"/> + </attribute> + </choice> + </optional> + <choice> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + <group> + <attribute name="first"><data type="IDREF"/></attribute> + <attribute name="then"><data type="IDREF"/></attribute> + <optional> + <attribute name="first-action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + <optional> + <attribute name="then-action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + </group> + </choice> + </element> + </define> + + <define name="element-rsc_ticket"> + <element name="rsc_ticket"> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + <group> + <attribute name="rsc"><data type="IDREF"/></attribute> + <optional> + <attribute name="rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + </group> + </choice> + <attribute name="ticket"><text/></attribute> + <optional> + <attribute name="loss-policy"> + <choice> + <value>stop</value> + <value>demote</value> + <value>fence</value> + <value>freeze</value> + </choice> + </attribute> + </optional> + </element> + </define> + + <define name="attribute-discovery"> + <choice> + <value>always</value> + <value>never</value> + <value>exclusive</value> + </choice> + </define> + + <define name="attribute-actions"> + <choice> + <value>start</value> + <value>promote</value> + <value>demote</value> + <value>stop</value> + </choice> + </define> + + <define name="attribute-roles"> + <choice> + <value>Stopped</value> + <value>Started</value> + <value>Promoted</value> + <value>Unpromoted</value> + <value>Master</value> + <value>Slave</value> + </choice> + </define> + + <define name="order-types"> + <choice> + <value>Optional</value> + <value>Mandatory</value> + <value>Serialize</value> + </choice> + </define> + + <!-- @COMPAT: The lifetime element is deprecated --> + <define name="element-lifetime"> + <element name="lifetime"> + <oneOrMore> + <grammar> + <include href="rule-3.10.rng"> + <start> + <ref name="element-rule-location"/> + </start> + </include> + </grammar> + </oneOrMore> + </element> + </define> + +</grammar> diff --git a/xml/constraints-next.rng b/xml/constraints-next.rng index 58fd27f..241b053 100644 --- a/xml/constraints-next.rng +++ b/xml/constraints-next.rng @@ -48,7 +48,7 @@ </group> <oneOrMore> <grammar> - <include href="rule-3.9.rng"> + <include href="rule-3.10.rng"> <start> <ref name="element-rule-location"/> </start> @@ -276,7 +276,7 @@ <element name="lifetime"> <oneOrMore> <grammar> - <include href="rule-3.9.rng"> + <include href="rule-3.10.rng"> <start> <ref name="element-rule-location"/> </start> diff --git a/xml/nodes-3.10.rng b/xml/nodes-3.10.rng new file mode 100644 index 0000000..ac2c557 --- /dev/null +++ b/xml/nodes-3.10.rng @@ -0,0 +1,46 @@ +<?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-nodes"/> + </start> + + <define name="element-nodes"> + <element name="nodes"> + <zeroOrMore> + <element name="node"> + <attribute name="id"><text/></attribute> + <attribute name="uname"><text/></attribute> + <optional> + <attribute name="type"> + <choice> + <value>member</value> + <value>remote</value> + + <!-- @COMPAT ping nodes are deprecated since 2.1.3 --> + <value>ping</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <optional> + <externalRef href="score.rng"/> + </optional> + <zeroOrMore> + <choice> + <element name="instance_attributes"> + <externalRef href="nvset-3.10.rng"/> + </element> + <element name="utilization"> + <externalRef href="nvset-3.10.rng"/> + </element> + </choice> + </zeroOrMore> + </element> + </zeroOrMore> + </element> + </define> + +</grammar> diff --git a/xml/nvset-3.10.rng b/xml/nvset-3.10.rng new file mode 100644 index 0000000..07565d8 --- /dev/null +++ b/xml/nvset-3.10.rng @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- just as nvset-2.9.rng, but allows for instantiated @name restrictions --> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-nvset"/> + </start> + + <!-- nvpair/@name: + * generic string by default, parent grammar may want to prohibit + enumerated names --> + <define name="element-nvset.name"> + <attribute name="name"> + <text/> + </attribute> + </define> + + <!-- nvpair/@name: + * defer element-nvset.name grammar item + nvpair/@value: + generic string by default, parent grammar may want to restrict + enumerated pairs (i.e. related to @name) at once --> + <define name="element-nvset.name-value"> + <ref name="element-nvset.name"/> + <optional> + <attribute name="value"><text/></attribute> + </optional> + </define> + + <!-- Allow easy redefinition in parent grammars --> + <define name="element-nvset.rule"> + <externalRef href="rule-3.10.rng"/> + </define> + + <define name="element-nvset"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <attribute name="id"><data type="ID"/></attribute> + <interleave> + <optional> + <ref name="element-nvset.rule"/> + </optional> + <zeroOrMore> + <element name="nvpair"> + <choice> + <group> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <optional> + <attribute name="name"><text/></attribute> + </optional> + </group> + <group> + <attribute name="id"><data type="ID"/></attribute> + <ref name="element-nvset.name-value"/> + </group> + </choice> + </element> + </zeroOrMore> + <optional> + <externalRef href="score.rng"/> + </optional> + </interleave> + </group> + </choice> + </define> + +</grammar> diff --git a/xml/options-3.10.rng b/xml/options-3.10.rng new file mode 100644 index 0000000..68af956 --- /dev/null +++ b/xml/options-3.10.rng @@ -0,0 +1,133 @@ +<?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="options"/> + </start> + + <!-- + Include rule definitions so that we can override element-nvset.rule based on + context + --> + <include href="rule-3.10.rng"> + <start combine="choice"> + <notAllowed/> + </start> + </include> + + <!-- + see upgrade-2.10.xsl + - cibtr:table for="cluster-properties" + --> + <define name="cluster_property_set.nvpair.name-value-unsupported"> + <choice> + <group> + <attribute name="name"> + <value type="string">cluster-infrastructure</value> + </attribute> + <attribute name="value"> + <data type="string"> + <except> + <choice> + <value>heartbeat</value> + <value>openais</value> + <value>classic openais</value> + <value>classic openais (with plugin)</value> + <value>cman</value> + </choice> + </except> + </data> + </attribute> + </group> + <group> + <attribute name="name"> + <data type="string"> + <except> + <choice> + <value>cluster-infrastructure</value> + <value>cluster_recheck_interval</value> + <value>dc_deadtime</value> + <value>default-action-timeout</value> + <value>default_action_timeout</value> + <value>default-migration-threshold</value> + <value>default_migration_threshold</value> + <value>default-resource-failure-stickiness</value> + <value>default_resource_failure_stickiness</value> + <value>default-resource-stickiness</value> + <value>default_resource_stickiness</value> + <value>election_timeout</value> + <value>expected-quorum-votes</value> + <value>is-managed-default</value> + <value>is_managed_default</value> + <value>no_quorum_policy</value> + <value>notification-agent</value> + <value>notification-recipient</value> + <value>remove_after_stop</value> + <value>shutdown_escalation</value> + <value>startup_fencing</value> + <value>stonith_action</value> + <value>stonith_enabled</value> + <value>stop_orphan_actions</value> + <value>stop_orphan_resources</value> + <value>symmetric_cluster</value> + <value>transition_idle_timeout</value> + </choice> + </except> + </data> + </attribute> + <optional> + <attribute name="value"><text/></attribute> + </optional> + </group> + </choice> + </define> + + <define name="options"> + <interleave> + <element name="crm_config"> + <zeroOrMore> + <element name="cluster_property_set"> + <grammar> + <include href="nvset-3.10.rng"> + <define name="element-nvset.name-value"> + <parentRef name="cluster_property_set.nvpair.name-value-unsupported"/> + </define> + </include> + </grammar> + </element> + </zeroOrMore> + </element> + <optional> + <element name="rsc_defaults"> + <zeroOrMore> + <element name="meta_attributes"> + <grammar> + <include href="nvset-3.10.rng"> + <define name="element-nvset.rule"> + <parentRef name="element-rule-rsc_defaults"/> + </define> + </include> + </grammar> + </element> + </zeroOrMore> + </element> + </optional> + <optional> + <element name="op_defaults"> + <zeroOrMore> + <element name="meta_attributes"> + <grammar> + <include href="nvset-3.10.rng"> + <define name="element-nvset.rule"> + <parentRef name="element-rule-op_defaults"/> + </define> + </include> + </grammar> + </element> + </zeroOrMore> + </element> + </optional> + </interleave> + </define> + +</grammar> diff --git a/xml/resources-3.10.rng b/xml/resources-3.10.rng new file mode 100644 index 0000000..e540617 --- /dev/null +++ b/xml/resources-3.10.rng @@ -0,0 +1,451 @@ +<?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-3.10.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-master"/> + <ref name="element-bundle"/> + </choice> + </zeroOrMore> + </element> + </define> + + <!-- + see upgrade-2.10.xsl + - cibtr:table for="resource-meta-attributes" + --> + <define name="primitive-template.meta_attributes.nvpair.name-unsupported"> + <attribute name="name"> + <data type="string"> + <except> + <choice> + <value>isolation</value> + <value>isolation-host</value> + <value>isolation-instance</value> + <value>isolation-wrapper</value> + </choice> + </except> + </data> + </attribute> + </define> + + <define name="element-resource-extra.primitive-template"> + <zeroOrMore> + <choice> + <ref name="element-instance_attributes"/> + <element name="meta_attributes"> + <grammar> + <include href="nvset-3.10.rng"> + <define name="element-nvset.name"> + <parentRef name="primitive-template.meta_attributes.nvpair.name-unsupported"/> + </define> + </include> + </grammar> + </element> + <element name="utilization"> + <externalRef href="nvset-3.10.rng"/> + </element> + </choice> + </zeroOrMore> + </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> + <choice> + <attribute name="masters"><data type="integer"/></attribute> + <attribute name="promoted-max"><data type="integer"/></attribute> + </choice> + </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> + <choice> + <attribute name="masters"><data type="integer"/></attribute> + <attribute name="promoted-max"><data type="integer"/></attribute> + </choice> + </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> + <choice> + <attribute name="masters"><data type="integer"/></attribute> + <attribute name="promoted-max"><data type="integer"/></attribute> + </choice> + </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-master"> + <element name="master"> + <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-3.10.rng"/> + </element> + </choice> + </zeroOrMore> + </define> + + <!-- + see upgrade-2.10.xsl + - cibtr:table for="resources-operation" + --> + <define name="op.meta_attributes.nvpair.name-unsupported"> + <attribute name="name"> + <data type="string"> + <except> + <choice> + <value>requires</value> + </choice> + </except> + </data> + </attribute> + </define> + + <define name="element-resource-extra.op"> + <zeroOrMore> + <choice> + <ref name="element-instance_attributes"/> + <element name="meta_attributes"> + <grammar> + <include href="nvset-3.10.rng"> + <define name="element-nvset.name"> + <parentRef name="op.meta_attributes.nvpair.name-unsupported"/> + </define> + + <!-- + @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-3.10.rng"> + <define name="element-nvset.rule"> + <parentRef name="element-rule-node-allowed"/> + </define> + </include> + </grammar> + </element> + </define> +</grammar> diff --git a/xml/rng-helper.in b/xml/rng-helper.in new file mode 100755 index 0000000..634abdf --- /dev/null +++ b/xml/rng-helper.in @@ -0,0 +1,251 @@ +#!@BASH_PATH@ +# +# Copyright 2014-2024 the Pacemaker project contributors +# +# The version control history for this file may have further details. +# +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. +# + +# @COMPAT "next" schemas are deprecated since 2.1.5 +list_candidates() { + ls -1 "${1}.rng" "${1}"-[0-9]*.rng "${1}"-next.rng 2>/dev/null +} + +version_from_filename() { + vff_filename="$1" + + case "$vff_filename" in + *-*.rng) + echo "$vff_filename" | sed -e 's/.*-\(.*\).rng/\1/' + ;; + *) + # special case for bare ${base}.rng, no -0.1's around anyway + echo 0.1 + ;; + esac +} + +filename_from_version() { + ffv_version="$1" + ffv_base="$2" + + if [ "$ffv_version" = "0.1" ]; then + echo "${ffv_base}.rng" + else + echo "${ffv_base}-${ffv_version}.rng" + fi +} + +# Convert version string (e.g. 2.10) into integer (e.g. 2010) for comparisons +int_version() { + echo "$1" | awk -F. '{ printf("%d%03d\n", $1,$2); }'; +} + +# Find the (sub-)schema that best matches a desired version. +# +# Version numbers are assumed to be in the format X.Y, +# where X and Y are integers, and Y is no more than 3 digits, +# or the special value "next". +# +# @COMPAT "next" schemas are deprecated since 2.1.5 +best_match() { + # (Sub-)schema name (e.g. "resources") + local base="$1" + + # Desired version (e.g. "1.0" or "next") + local target="$2" + + # If not empty, append the best match as an XML externalRef to this file + # (otherwise, just echo the best match). + local destination="$3" + + # Arbitrary text to print before XML (generally spaces to indent) + local prefix="$4" + + best="0.0" + for rng in $(list_candidates "${base}"); do + case ${rng} in + ${base}-${target}.rng) + # We found exactly what was requested + best=${target} + break + ;; + *-next.rng) + # "Next" schemas cannot be a best match unless directly requested + ;; + *) + v=$(version_from_filename "${rng}") + if [ $(int_version "${v}") -gt $(int_version "${best}") ]; then + # This version beats the previous best match + + if [ "${target}" = "next" ]; then + best=${v} + elif [ $(int_version "${v}") -lt $(int_version "${target}") ]; then + # This value is best only if it's still less than the target + best=${v} + fi + fi + ;; + esac + done + + if [ "$best" != "0.0" ]; then + found=$(filename_from_version "$best" "$base") + if [ -z "$destination" ]; then + echo "$(basename $found)" + else + echo "${prefix}<externalRef href=\"$(basename $found)\"/>" >> "$destination" + fi + return 0 + fi + return 1 +} + +version_diff() { + # diff fails with ec=2 if no predecessor is found; + # this uses '=' GNU extension to sed, if that's not available, + # one can use: hline=`echo "$${p}" | grep -Fn "$${hunk}" | cut -d: -f1`; + # XXX: use line information from hunk to avoid "not detected" for ambiguity + for p in $*; do + set $(echo "$p" | tr '-' ' ') + echo "### *-$2.rng vs. predecessor" + + for v in *-"$2".rng; do + echo "#### $v vs. predecessor" + + b=$(echo "$v" | cut -d- -f1) + old=$(best_match "$b" "$1") + p=$(diff -u "$old" "$v" 2>/dev/null) + + case $? in + 1) + echo "$p" | sed -n -e '/^@@ /!d;=;p' -e ':l;n;/^\([- ]\|+.*<[^ />]\+\([^/>]\+="ID\|>$$\)\)/bl;s/^[+ ]\(.*\)/\1/p' | + while read -r hline; do + if read -r h; then + read -r i + else + break + fi + + iline=$(grep -Fn "$i" "$v" | cut -d: -f1) + + if [ "$(echo "$iline" | wc -l)" = "1" ]; then + ctxt=$({ sed -n -e "1,$((iline - 1))p" "$v" + echo "<inject id=\"GOAL\"/>$i" + sed -n -e "$((iline + 1)),$ p" "$v" + } | xsltproc --param skip 1 context-of.xsl -) + else + ctxt="(not detected)" + fi + + echo "$p" | sed -n -e "$((hline - 2)),$hline!d" -e '/^\(+++\|---\)/p' + echo "$h context: $ctxt" + echo "$p" | sed -n -e "1,${hline}d" -e '/^\(---\|@@ \)/be;p;d;:e;n;be' + done + + ;; + + 2) + echo "##### $v has no predecessor" + ;; + + esac + done + done +} + +build_api_rng() { + local FILENAME="$1" + local VERSION="$2" + + shift 2 + + cat <<EOF >"$FILENAME" +<?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> + <element name="pacemaker-result"> + <attribute name="api-version"> <text /> </attribute> + <attribute name="request"> <text /> </attribute> + <optional> + <choice> +EOF + for RNG in "$@"; do + best_match "api/$RNG" "$VERSION" "$FILENAME" " " + done + cat <<EOF >>"$FILENAME" + </choice> + </optional> +EOF + best_match api/status "$VERSION" "$FILENAME" " " + cat <<EOF >>"$FILENAME" + </element> + </start> +</grammar> +EOF +} + +build_cib_rng() { + local FILENAME="$1" + local VERSION="$2" + + shift 2 + cat <<EOF >"$FILENAME" +<?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> + <element name="cib"> +EOF + best_match cib "$VERSION" "$FILENAME" " " + cat <<EOF >>"$FILENAME" + <element name="configuration"> + <interleave> +EOF + for RNG in "$@"; do + best_match "$RNG" "$VERSION" "$FILENAME" " " + done + cat <<EOF >>"$FILENAME" + </interleave> + </element> + <optional> + <element name="status"> +EOF + best_match status "$VERSION" "$FILENAME" " " + cat <<EOF >>"$FILENAME" + </element> + </optional> + </element> + </start> +</grammar> +EOF +} + +# Allow building RNGs from a different directory +cd "$(dirname $0)" + +case "$1" in + match) + # Using readlink allows building from a different directory + best_match "$2" "$3" "$(readlink -f "$4")" "$5" + ;; + + diff) + shift + version_diff "$@" + ;; + + build_api_rng) + build_api_rng "$2" "$3" "${@:4}" + ;; + + build_cib_rng) + build_cib_rng "$2" "$3" "${@:4}" + ;; + + *) + echo "Invalid command: $1" + exit 1 + ;; +esac diff --git a/xml/rule-3.10.rng b/xml/rule-3.10.rng new file mode 100644 index 0000000..6ef362f --- /dev/null +++ b/xml/rule-3.10.rng @@ -0,0 +1,433 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + xmlns:ann="http://relaxng.org/ns/compatibility/annotations/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-rule"/> + </start> + + <!-- + Rule elements allow different syntax depending on their context, each of + which gets their own rule definition below: + + 1. rsc_location + 2. meta_attributes within rsc_defaults + 3. meta_attributes within op_defaults + 4. all other contexts that allow node attribute expressions + (instance_attributes elements within bundle, clone, group, op, primitive, + and template elements; and meta_attributes elements within op elements) + 5. all other contexts (cluster_property_set elements; instance_attributes + within alert, node, and recipient elements; meta_attributes within alert, + bundle, clone, group, primitive, recipient, and template elements; and + utilization elements within node, primitive, and template elements) + + The COMPAT comments below mark items that are invalid in their given context + and should be removed at a compatibility break. + --> + + <!-- 1. rule element within rsc_location --> + <define name="element-rule-location"> + <element name="rule"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <ref name="rule-common"/> + <oneOrMore> + <choice> + <ref name="expression-location"/> + <ref name="date_expression"/> + <ref name="element-rule-location"/> + + <!-- @COMPAT: The below expression types are invalid here --> + <ref name="rsc_expression"/> + <ref name="op_expression"/> + </choice> + </oneOrMore> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="score-attribute"><text/></attribute> + </choice> + </optional> + </group> + </choice> + </element> + </define> + + <!-- 2. rule element within rsc_defaults --> + <define name="element-rule-rsc_defaults"> + <element name="rule"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <ref name="rule-common"/> + <oneOrMore> + <choice> + <ref name="date_expression"/> + <ref name="rsc_expression"/> + <ref name="element-rule-rsc_defaults"/> + + <!-- @COMPAT: The below expression type is deprecated here --> + <ref name="expression"/> + + <!-- @COMPAT: The below expression type is invalid here --> + <ref name="op_expression"/> + </choice> + </oneOrMore> + + <!-- @COMPAT: The below score attributes are invalid here --> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="score-attribute"><text/></attribute> + </choice> + </optional> + </group> + </choice> + </element> + </define> + + <!-- 3. rule element within op_defaults --> + <define name="element-rule-op_defaults"> + <element name="rule"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <ref name="rule-common"/> + <oneOrMore> + <choice> + <ref name="date_expression"/> + <ref name="rsc_expression"/> + <ref name="op_expression"/> + <ref name="element-rule-op_defaults"/> + + <!-- @COMPAT: The below expression type is deprecated here --> + <ref name="expression"/> + </choice> + </oneOrMore> + + <!-- @COMPAT: The below score attributes are invalid here --> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="score-attribute"><text/></attribute> + </choice> + </optional> + </group> + </choice> + </element> + </define> + + + <!-- 4. rule element in other contexts allowing node attribute expressions --> + <define name="element-rule-node-allowed"> + <element name="rule"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <ref name="rule-common"/> + <oneOrMore> + <choice> + <ref name="expression"/> + <ref name="date_expression"/> + <ref name="element-rule-node-allowed"/> + + <!-- @COMPAT: The below expression types are invalid here --> + <ref name="rsc_expression"/> + <ref name="op_expression"/> + </choice> + </oneOrMore> + + <!-- @COMPAT: The below score attributes are invalid here --> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="score-attribute"><text/></attribute> + </choice> + </optional> + </group> + </choice> + </element> + </define> + + <!-- 5. rule element within all other contexts --> + <define name="element-rule"> + <element name="rule"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <ref name="rule-common"/> + <oneOrMore> + <choice> + <ref name="date_expression"/> + <ref name="element-rule"/> + + <!-- @COMPAT: The below expression types are invalid here --> + <ref name="expression"/> + <ref name="rsc_expression"/> + <ref name="op_expression"/> + </choice> + </oneOrMore> + + <!-- @COMPAT: The below score attributes are invalid here --> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="score-attribute"><text/></attribute> + </choice> + </optional> + </group> + </choice> + </element> + </define> + + <!-- Attributes that are common to all rule elements --> + <define name="rule-common"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="boolean-op"> + <choice> + <value>or</value> + <value>and</value> + </choice> + </attribute> + </optional> + + <!-- + @COMPAT Role applies only to rules within location constraints. When we can + break behavioral backward compatibility, move this to + rule-element-location. + --> + <optional> + <attribute name="role"><text/></attribute> + </optional> + </define> + + <!-- A node attribute expression --> + <define name="expression"> + <element name="expression"> + <ref name="expression-common"/> + + <optional> + <attribute name="value-source" ann:defaultValue="literal"> + <choice> + <value>literal</value> + <!-- @COMPAT: These value-source choices are invalid here --> + <value>param</value> + <value>meta</value> + </choice> + </attribute> + </optional> + </element> + </define> + + <!-- A node attribute expression in a location constraint --> + <define name="expression-location"> + <element name="expression"> + <ref name="expression-common"/> + <optional> + <attribute name="value-source" ann:defaultValue="literal"> + <choice> + <value>literal</value> + <value>param</value> + <value>meta</value> + </choice> + </attribute> + </optional> + </element> + </define> + + <!-- Attributes that are common to all <expression> elements --> + <define name="expression-common"> + <attribute name="id"><data type="ID"/></attribute> + <attribute name="attribute"><text/></attribute> + <choice> + <group> + <attribute name="operation"> + <choice> + <value>defined</value> + <value>not_defined</value> + </choice> + </attribute> + <!-- @COMPAT value attribute should be prohibited here --> + <optional> + <attribute name="value"><text/></attribute> + </optional> + </group> + <group> + <attribute name="operation"> + <choice> + <value>lt</value> + <value>gt</value> + <value>lte</value> + <value>gte</value> + <value>eq</value> + <value>ne</value> + </choice> + </attribute> + <!-- @COMPAT value attribute should be required here --> + <optional> + <attribute name="value"><text/></attribute> + </optional> + </group> + </choice> + <optional> + <attribute name="type" ann:defaultValue="string"> + <choice> + <value>string</value> + <value>integer</value> + <value>number</value> + <value>version</value> + </choice> + </attribute> + </optional> + </define> + + <define name="date_expression"> + <element name="date_expression"> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <group> + <attribute name="operation"><value>in_range</value></attribute> + <choice> + <attribute name="start"><text/></attribute> + <attribute name="end"><text/></attribute> + <group> + <attribute name="start"><text/></attribute> + <attribute name="end"><text/></attribute> + </group> + </choice> + <optional> + <ref name="duration"/> + </optional> + </group> + <group> + <attribute name="operation"><value>gt</value></attribute> + <attribute name="start"><text/></attribute> + </group> + <group> + <attribute name="operation"><value>lt</value></attribute> + <attribute name="end"><text/></attribute> + </group> + <group> + <attribute name="operation"><value>date_spec</value></attribute> + <ref name="date_spec"/> + </group> + </choice> + </element> + </define> + + <define name="rsc_expression"> + <element name="rsc_expression"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="class"><text/></attribute> + </optional> + <optional> + <attribute name="provider"><text/></attribute> + </optional> + <optional> + <attribute name="type"><text/></attribute> + </optional> + </element> + </define> + + <define name="op_expression"> + <element name="op_expression"> + <attribute name="id"><data type="ID"/></attribute> + <attribute name="name"><text/></attribute> + <optional> + <attribute name="interval"><text/></attribute> + </optional> + </element> + </define> + + <define name="duration"> + <element name="duration"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="years"><text/></attribute> + </optional> + <optional> + <attribute name="months"><text/></attribute> + </optional> + <optional> + <attribute name="weeks"><text/></attribute> + </optional> + <optional> + <attribute name="days"><text/></attribute> + </optional> + <optional> + <attribute name="hours"><text/></attribute> + </optional> + <optional> + <attribute name="minutes"><text/></attribute> + </optional> + <optional> + <attribute name="seconds"><text/></attribute> + </optional> + + <!-- @COMPAT: The below attributes are invalid here --> + <optional> + <attribute name="monthdays"><text/></attribute> + </optional> + <optional> + <attribute name="weekdays"><text/></attribute> + </optional> + <optional> + <attribute name="yearsdays"><text/></attribute> + </optional> + <optional> + <attribute name="weekyears"><text/></attribute> + </optional> + <optional> + <attribute name="moon"><text/></attribute> + </optional> + </element> + </define> + + <define name="date_spec"> + <element name="date_spec"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="years"><text/></attribute> + </optional> + <optional> + <attribute name="months"><text/></attribute> + </optional> + <optional> + <attribute name="monthdays"><text/></attribute> + </optional> + <optional> + <attribute name="hours"><text/></attribute> + </optional> + <optional> + <attribute name="minutes"><text/></attribute> + </optional> + <optional> + <attribute name="seconds"><text/></attribute> + </optional> + <optional> + <attribute name="yeardays"><text/></attribute> + </optional> + <optional> + <attribute name="weekyears"><text/></attribute> + </optional> + <optional> + <attribute name="weeks"><text/></attribute> + </optional> + <optional> + <attribute name="weekdays"><text/></attribute> + </optional> + <optional> + <attribute name="moon"><text/></attribute> + </optional> + + <!-- @COMPAT: The below attributes are invalid here --> + <optional> + <attribute name="yearsdays"><text/></attribute> + </optional> + </element> + </define> + +</grammar> diff --git a/xml/version-diff.sh.in b/xml/version-diff.sh.in deleted file mode 100644 index 1ece3b3..0000000 --- a/xml/version-diff.sh.in +++ /dev/null @@ -1,60 +0,0 @@ -#!@BASH_PATH@ -# -# Copyright 2016-2023 the Pacemaker project contributors -# -# The version control history for this file may have further details. -# -# This source code is licensed under the GNU General Public License version 2 -# or later (GPLv2+) WITHOUT ANY WARRANTY. -# - -# diff fails with ec=2 if no predecessor is found; -# this uses '=' GNU extension to sed, if that's not available, -# one can use: hline=`echo "$${p}" | grep -Fn "$${hunk}" | cut -d: -f1`; -# XXX: use line information from hunk to avoid "not detected" for ambiguity -for p in $*; do - set $(echo "$p" | tr '-' ' ') - echo "### *-$2.rng vs. predecessor" - - for v in *-"$2".rng; do - echo "#### $v vs. predecessor" - - b=$(echo "$v" | cut -d- -f1) - old=$(./best-match.sh "$b" "$1") - p=$(diff -u "$old" "$v" 2>/dev/null) - - case $? in - 1) - echo "$p" | sed -n -e '/^@@ /!d;=;p' -e ':l;n;/^\([- ]\|+.*<[^ />]\+\([^/>]\+="ID\|>$$\)\)/bl;s/^[+ ]\(.*\)/\1/p' | - while read -r hline; do - if read -r h; then - read -r i - else - break - fi - - iline=$(grep -Fn "$i" "$v" | cut -d: -f1) - - if [ "$(echo "$iline" | wc -l)" = "1" ]; then - ctxt=$({ sed -n -e "1,$((iline - 1))p" "$v" - echo "<inject id=\"GOAL\"/>$i" - sed -n -e "$((iline + 1)),$ p" "$v" - } | xsltproc --param skip 1 context-of.xsl -) - else - ctxt="(not detected)" - fi - - echo "$p" | sed -n -e "$((hline - 2)),$hline!d" -e '/^\(+++\|---\)/p' - echo "$h context: $ctxt" - echo "$p" | sed -n -e "1,${hline}d" -e '/^\(---\|@@ \)/be;p;d;:e;n;be' - done - - ;; - - 2) - echo "##### $v has no predecessor" - ;; - - esac - done -done |