diff --git a/Makefile.am b/Makefile.am
index 176a7621..0a1d033e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,7 +40,7 @@ EXTRA_DIST = autogen.sh conf/corosync.conf.example $(SPEC).in \
conf/lenses/tests/test_corosync.aug \
conf/lenses/corosync.aug \
conf/corosync.conf.example.udpu \
- .version
+ .version conf/corosync.xml.example
AUTOMAKE_OPTIONS = foreign
@@ -63,6 +63,14 @@ corolenstestdir = ${corolensdir}/tests
corolenstest_DATA = conf/lenses/tests/test_corosync.aug
endif
+if INSTALL_XMLCONF
+corosysxmlconfdir = ${COROSYSCONFDIR}
+corosysxmlconf_DATA = conf/corosync.xml.example
+
+corosysxmlxsltdir = ${datadir}/corosync
+corosysxmlxslt_DATA = conf/xml2conf.xsl
+endif
+
SUBDIRS = include lcr lib exec services tools test cts pkgconfig \
man init conf
diff --git a/conf/corosync.xml.example b/conf/corosync.xml.example
new file mode 100644
index 00000000..0b6d49df
--- /dev/null
+++ b/conf/corosync.xml.example
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/xml2conf.xsl b/conf/xml2conf.xsl
new file mode 100644
index 00000000..c140d68a
--- /dev/null
+++ b/conf/xml2conf.xsl
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ # Corosync configuration file generated from
+ at
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+
+
+
+
+
+ }
+
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/configure.ac b/configure.ac
index 9440ead5..e7ca328c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -304,6 +304,11 @@ AC_ARG_ENABLE([snmp],
[ --enable-snmp : SNMP protocol support ],
[ default="no" ])
+AC_ARG_ENABLE([xmlconf],
+ [ --enable-xmlconf : XML configuration support ],,
+ [ enable_xmlconf="no" ])
+AM_CONDITIONAL(INSTALL_XMLCONF, test x$enable_xmlconf = xyes)
+
# OS detection
# THIS SECTION MUST DIE!
CP=cp
@@ -457,6 +462,9 @@ fi
if test "x${enable_systemd}" = xyes; then
PACKAGE_FEATURES="$PACKAGE_FEATURES systemd"
fi
+if test "x${enable_xmlconf}" = xyes; then
+ PACKAGE_FEATURES="$PACKAGE_FEATURES xmlconf"
+fi
if test "x${enable_snmp}" = xyes; then
SNMPCONFIG=""
diff --git a/tools/.gitignore b/tools/.gitignore
index 96510447..88e7313e 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -7,3 +7,4 @@ corosync-pload
corosync-quorumtool
corosync-notifyd
corosync-cmapctl
+corosync-xmlproc
diff --git a/tools/Makefile.am b/tools/Makefile.am
index c74af0f8..30891503 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -40,6 +40,13 @@ sbin_PROGRAMS = corosync-fplay corosync-cfgtool \
bin_SCRIPTS = corosync-blackbox
+if INSTALL_XMLCONF
+bin_PROGRAMS = corosync-xmlproc
+
+corosync-xmlproc: corosync-xmlproc.sh
+ sed -e 's#@''DATADIR@#${datadir}#g' $< > $@
+endif
+
EXTRA_DIST = $(bin_SCRIPTS) corosync-notifyd.sysconfig.example
corosync_fplay_LDADD = $(LIBQB_LIBS)
diff --git a/tools/corosync-xmlproc.sh b/tools/corosync-xmlproc.sh
new file mode 100644
index 00000000..d6b24aa6
--- /dev/null
+++ b/tools/corosync-xmlproc.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+# Copyright (c) 2011 Red Hat, Inc.
+#
+# All rights reserved.
+#
+# Author: Jan Friesse (jfriesse@redhat.com)
+#
+# This software licensed under BSD license, the text of which follows:
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# - Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# - Neither the name of the Red Hat, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+XSLT_PROC=xsltproc
+
+usage() {
+ echo "$0 input_config [output]"
+ echo " where input_config is valid XML configuration file"
+
+ exit 1
+}
+
+[ "$1" == "" ] && usage
+
+$XSLT_PROC -V >/dev/null 2>&1
+if [ "$?" != 0 ];then
+ echo "Can't find xslt processor $XSLT_PROC"
+ exit 2
+fi
+
+# TODO:
+# Validation should occur before actual processing
+
+[ "$2" != "" ] && out_param="-o $2"
+
+$XSLT_PROC --stringparam inputfile "$1" $out_param @DATADIR@/corosync/xml2conf.xsl "$1"