diff --git a/xml/Makefile.am b/xml/Makefile.am index b58c9277bb..81ba763df5 100644 --- a/xml/Makefile.am +++ b/xml/Makefile.am @@ -1,126 +1,129 @@ # # Copyright (C) 2004 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MAINTAINERCLEANFILES = Makefile.in dtddir = $(CRM_DTD_DIRECTORY) dtd_SCRIPTS = crm.dtd crm-transitional.dtd xsltdir = $(dtddir) xslt_SCRIPTS = upgrade06.xsl upgrade-*.xsl RNGdir = $(dtddir) # See Readme.md for details on updating schema files # Sorted list of available numeric RNG versions, # extracted from filenames like NAME-MAJOR[.MINOR][.MINOR-MINOR].rng RNG_numeric_versions = $(shell ls -1 *.rng \ | sed -n -e 's/^.*-\([0-9.]\+\).rng$$/\1/p' \ | sort -u -t. -k 1,1n -k 2,2n -k 3,3n) # The highest numeric version RNG_max ?= $(lastword $(RNG_numeric_versions)) # The previous numeric version before $(RNG_max) RNG_last ?= $(shell ls -1 *.rng \ | sed -n -e 's/^.*-\([0-9.]\+\).rng$$/\1/p' \ | sort -u -t. -k 1,1nr -k 2,2nr -k 3,3nr \ | head -n 2 | tail -n 1) # A sorted list of all RNG versions (numeric and "next") RNG_versions = next $(RNG_numeric_versions) RNG_generated = pacemaker.rng $(foreach base,$(RNG_versions),pacemaker-$(base).rng) versions.rng RNG_cfg_base = options nodes resources constraints fencing acls tags RNG_base = cib $(RNG_cfg_base) status score rule nvset RNG_files = $(foreach base,$(RNG_base),$(wildcard $(base)*.rng)) -RNG_SCRIPTS = $(RNG_files) $(RNG_generated) +# List of non-Pacemaker RNGs +RNG_extra = crm_mon.rng + +RNG_SCRIPTS = $(RNG_files) $(RNG_generated) $(RNG_extra) EXTRA_DIST = best-match.sh best_match = $(shell $(top_srcdir)/xml/best-match.sh $(1) $(2)) versions: echo "Max: $(RNG_max)" echo "Available: $(RNG_versions)" versions.rng: Makefile.am echo " RNG $@" echo "<?xml version='1.0' encoding='UTF-8'?>" > $@ echo "<grammar xmlns='http://relaxng.org/ns/structure/1.0' datatypeLibrary='http://www.w3.org/2001/XMLSchema-datatypes'>" >> $@ echo " <start>" >> $@ echo " <interleave>" >> $@ echo " <optional>" >> $@ echo " <attribute name='validate-with'>" >> $@ echo " <choice>" >> $@ echo " <value>none</value>" >> $@ echo " <value>pacemaker-0.6</value>" >> $@ echo " <value>transitional-0.6</value>" >> $@ echo " <value>pacemaker-0.7</value>" >> $@ echo " <value>pacemaker-1.1</value>" >> $@ for rng in $(RNG_versions); do echo " <value>pacemaker-$$rng</value>" >> $@; done echo " </choice>" >> $@ echo " </attribute>" >> $@ echo " </optional>" >> $@ echo " <attribute name='admin_epoch'><data type='nonNegativeInteger'/></attribute>" >> $@ echo " <attribute name='epoch'><data type='nonNegativeInteger'/></attribute>" >> $@ echo " <attribute name='num_updates'><data type='nonNegativeInteger'/></attribute>" >> $@ echo " </interleave>" >> $@ echo " </start>" >> $@ echo "</grammar>" >> $@ pacemaker.rng: pacemaker-$(RNG_max).rng echo " RNG $@" cp $(top_builddir)/xml/$< $@ pacemaker-%.rng: $(RNG_files) best-match.sh Makefile.am echo " RNG $@" echo "<?xml version='1.0' encoding='UTF-8'?>" > $@ echo "<grammar xmlns='http://relaxng.org/ns/structure/1.0' datatypeLibrary='http://www.w3.org/2001/XMLSchema-datatypes'>" >> $@ echo " <start>" >> $@ echo " <element name='cib'>" >> $@ $(top_srcdir)/xml/best-match.sh cib $(*) $(@) " " echo " <element name='configuration'>" >> $@ echo " <interleave>" >> $@ for rng in $(RNG_cfg_base); do $(top_srcdir)/xml/best-match.sh $$rng $(*) $(@) " "; done echo " </interleave>" >> $@ echo " </element>" >> $@ echo " <element name='status'>" >> $@ $(top_srcdir)/xml/best-match.sh status $(*) $(@) " " echo " </element>" >> $@ echo " </element>" >> $@ echo " </start>" >> $@ echo "</grammar>" >> $@ files_next = $(shell echo $(wildcard *-next.rng) | sed 's/-next.rng//g') files_max = $(shell echo $(wildcard *-$(RNG_max).rng) | sed 's/-[0-9][0-9.]*.rng//g') diff: echo "# Comparing changes in: $(RNG_max)" -for rng in $(files_max); do echo "### $${rng}"; diff -u `$(top_srcdir)/xml/best-match.sh $${rng} $(RNG_last)` $${rng}-$(RNG_max).rng; done echo -e "\n\n\n# Comparing changes since: $(RNG_max)" -for rng in $(files_next); do echo "### $${rng}"; diff -u `$(top_srcdir)/xml/best-match.sh $${rng} $(RNG_max)` $${rng}-next.rng; done sync: git rm -f $(wildcard *-next.rng) make pacemaker-next.rng clean: rm -f $(RNG_generated) diff --git a/xml/crm_mon.rng b/xml/crm_mon.rng new file mode 100644 index 0000000000..5f6dc7cd27 --- /dev/null +++ b/xml/crm_mon.rng @@ -0,0 +1,182 @@ +<?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"> + <element name="crm_mon"> + <attribute name="version"> <text/> </attribute> + <element name="summary"> + <optional> + <element name="last_update"> + <!-- crm_mon shows dates like "Mon Apr 13 16:06:27 2015" not + the XSD dateTime like "2015-04-13T16:06:27-05:00" --> + <attribute name="time"> <text/> </attribute> + </element> + </optional> + <optional> + <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="stack"> + <attribute name="type"> <text/> </attribute> + </element> + </optional> + <element name="current_dc"> + <attribute name="present"> <data type="boolean" /> </attribute> + <optional> + <group> + <attribute name="version"> <text/> </attribute> + <attribute name="name"> <text/> </attribute> + <!-- pacemaker IDs are user-defined strings that are + not as restricted as the XSD ID type --> + <attribute name="id"> <text/> </attribute> + <attribute name="with_quorum"> <data type="boolean" /> </attribute> + </group> + </optional> + </element> + <element name="nodes_configured"> + <attribute name="number"> <data type="int" /> </attribute> + <choice> + <attribute name="expected_votes"> <data type="int" /> </attribute> + <attribute name="expected_votes"> <value>unknown</value> </attribute> + </choice> + </element> + <element name="resources_configured"> + <attribute name="number"> <data type="int" /> </attribute> + </element> + </element> + <element name="nodes"> + <zeroOrMore> + <element name="node"> + <attribute name="name"> <text/> </attribute> + <attribute name="id"> <text/> </attribute> + <attribute name="online"> <data type="boolean" /> </attribute> + <attribute name="standby"> <data type="boolean" /> </attribute> + <attribute name="standby_onfail"> <data type="boolean" /> </attribute> + <attribute name="maintenance"> <data type="boolean" /> </attribute> + <attribute name="pending"> <data type="boolean" /> </attribute> + <attribute name="unclean"> <data type="boolean" /> </attribute> + <attribute name="shutdown"> <data type="boolean" /> </attribute> + <attribute name="expected_up"> <data type="boolean" /> </attribute> + <attribute name="is_dc"> <data type="boolean" /> </attribute> + <attribute name="resources_running"> <data type="int" /> </attribute> + <attribute name="type"> + <choice> + <value>unknown</value> + <value>member</value> + <value>remote</value> + <value>ping</value> + </choice> + </attribute> + <optional> + <!-- 1.1.13 adds container_id for virtualized pacemaker_remote nodes --> + <attribute name="container_id"> <text/> </attribute> + </optional> + <ref name="resource_list" /> + </element> + </zeroOrMore> + </element> + <optional> + <element name="resources"> + <ref name="resource_list" /> + </element> + </optional> + <optional> + <element name="failures"> + <zeroOrMore> + <element name="failure"> + <choice> + <attribute name="op_key"> <text/> </attribute> + <attribute name="id"> <text/> </attribute> + </choice> + <attribute name="node"> <text/> </attribute> + <attribute name="exitstatus"> <text/> </attribute> + <attribute name="exitreason"> <text/> </attribute> + <attribute name="exitcode"> <data type="int" /> </attribute> + <attribute name="call"> <text/> </attribute> + <attribute name="status"> <text/> </attribute> + <optional> + <group> + <attribute name="last-rc-change"> <text/> </attribute> + <attribute name="queued"> <text/> </attribute> + <attribute name="exec"> <text/> </attribute> + <attribute name="interval"> <data type="int" /> </attribute> + <attribute name="task"> <text/> </attribute> + </group> + </optional> + </element> + </zeroOrMore> + </element> + </optional> + </element> + </define> + + <define name="resource_list"> + <interleave> + <zeroOrMore> + <ref name="element-resource" /> + </zeroOrMore> + <zeroOrMore> + <ref name="element-group" /> + </zeroOrMore> + <zeroOrMore> + <ref name="element-clone" /> + </zeroOrMore> + </interleave> + </define> + + <define name="element-resource"> + <element name="resource"> + <attribute name="id"> <text/> </attribute> + <attribute name="resource_agent"> <text/> </attribute> + <attribute name="role"> <text/> </attribute> + <attribute name="active"> <data type="boolean" /> </attribute> + <attribute name="orphaned"> <data type="boolean" /> </attribute> + <attribute name="managed"> <data type="boolean" /> </attribute> + <attribute name="failed"> <data type="boolean" /> </attribute> + <attribute name="failure_ignored"> <data type="boolean" /> </attribute> + <attribute name="nodes_running_on"> <data type="int" /> </attribute> + <optional> + <attribute name="pending"> <text/> </attribute> + </optional> + <optional> + <!-- crm_mon prints the node only if group-by-node is false --> + <element name="node"> + <attribute name="name"> <text/> </attribute> + <attribute name="id"> <text/> </attribute> + <attribute name="cached"> <data type="boolean" /> </attribute> + </element> + </optional> + </element> + </define> + + <define name="element-group"> + <element name="group"> + <attribute name="id"> <text/> </attribute> + <attribute name="number_resources"> <data type="int" /> </attribute> + <ref name="resource_list" /> + </element> + </define> + + <define name="element-clone"> + <element name="clone"> + <attribute name="id"> <text/> </attribute> + <attribute name="multi_state"> <data type="boolean" /> </attribute> + <attribute name="unique"> <data type="boolean" /> </attribute> + <attribute name="managed"> <data type="boolean" /> </attribute> + <attribute name="failed"> <data type="boolean" /> </attribute> + <attribute name="failure_ignored"> <data type="boolean" /> </attribute> + <ref name="resource_list" /> + </element> + </define> + +</grammar>