public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - rgmanager: Add XSLT scripts for extracting RA metadata
@ 2009-01-26 22:40 Lon Hohberger
  0 siblings, 0 replies; only message in thread
From: Lon Hohberger @ 2009-01-26 22:40 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=758ca5bad1e4828b7026274fd155414f571c3d5b
Commit:        758ca5bad1e4828b7026274fd155414f571c3d5b
Parent:        6834a0bf614b62e2006c0aa4c333954279dfefa8
Author:        Lon Hohberger <lhh@redhat.com>
AuthorDate:    Mon Jan 26 17:32:29 2009 -0500
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Mon Jan 26 17:32:29 2009 -0500

rgmanager: Add XSLT scripts for extracting RA metadata

---
 rgmanager/src/resources/ra2csv.xsl |   19 +++++
 rgmanager/src/resources/ra2man.xsl |  158 ++++++++++++++++++++++++++++++++++++
 rgmanager/src/resources/ra2oid.xsl |   68 +++++++++++++++
 3 files changed, 245 insertions(+), 0 deletions(-)

diff --git a/rgmanager/src/resources/ra2csv.xsl b/rgmanager/src/resources/ra2csv.xsl
new file mode 100644
index 0000000..a00243a
--- /dev/null
+++ b/rgmanager/src/resources/ra2csv.xsl
@@ -0,0 +1,19 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text" indent="no"/>
+
+<xsl:template name="normalize-name">
+	<xsl:param name="type"/>
+	<xsl:param name="value"/>
+	<xsl:variable name="normalized" select="concat( translate(substring(@name, 1, 1), '_abcdefghijklmnopqrstuvwrxyz', '-ABCDEFGHIJKLMNOPQRSTUVWRXYZ'), translate(substring(@name, 2), '_ABCDEFGHIJKLMNOPQRSTUVWRXYZ', '-abcdefghijklmnopqrstuvwrxyz'))"/>
+	<xsl:choose>
+		<xsl:when test="$normalized = 'Name'"></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$type"/>,rhcs<xsl:value-of select="$normalized"/><xsl:text>
+</xsl:text></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="/resource-agent"><xsl:call-template name="normalize-name"><xsl:with-param name="type">obj</xsl:with-param><xsl:with-param name="value" select="normalize-space(@name)"/></xsl:call-template>
+<xsl:for-each select="parameters/parameter"><xsl:call-template name="normalize-name"><xsl:with-param name="type">attr</xsl:with-param><xsl:with-param name="value" select="normalize-space(@name)"/></xsl:call-template>
+</xsl:for-each>
+</xsl:template>
+</xsl:stylesheet>
diff --git a/rgmanager/src/resources/ra2man.xsl b/rgmanager/src/resources/ra2man.xsl
new file mode 100644
index 0000000..095a7b3
--- /dev/null
+++ b/rgmanager/src/resources/ra2man.xsl
@@ -0,0 +1,158 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text" indent="no"/>
+
+<xsl:template match="parameter">
+.TP
+.B <xsl:value-of select="@name"/><xsl:text>
+</xsl:text>
+<xsl:value-of select="normalize-space(longdesc)"/><xsl:text>
+</xsl:text>
+<xsl:if test="@primary = 1">This is the defining attribute for the <b><xsl:value-of select="/resource-agent/@name"/></b> resource type, and will be shown in logs.
+</xsl:if>
+<xsl:if test="@unique = 1 or @primary = 1">No other instances of the 
+.B <xsl:value-of select="/resource-agent/@name"/>
+resource may have the same value for the 
+.B <xsl:value-of select="@name"/>
+parameter.
+</xsl:if>
+<xsl:if test="@required = 1 or @primary = 1">This parameter is required; the resource manager will ignore specification of a resource without this parameter.</xsl:if>
+<xsl:if test="@reconfig = 1">You may safely change this attribute on the fly; doing so will not cause a restart of the resource or its children.
+</xsl:if>
+Content: <xsl:value-of select="content/@type"/><xsl:text>
+</xsl:text>
+<xsl:if test="content/@default">Default Value: <xsl:value-of select="content/@default"/>
+</xsl:if>
+</xsl:template>
+
+<xsl:template match="action">
+.TP
+\fB<xsl:value-of select="@name"/>\fp<xsl:if test="@timeout"> (timeout: <xsl:value-of select="@timeout"/>) </xsl:if>
+<xsl:choose>
+<xsl:when test="@name = 'start'">
+This starts the resource.
+</xsl:when>
+<xsl:when test="@name = 'stop'">
+This stops the resource.
+</xsl:when>
+<xsl:when test="@name = 'monitor'">
+<xsl:if test="@depth">
+Depth <xsl:value-of select="@depth"/>.
+</xsl:if>
+This checks the status of the resource.  This is specified in the OCF Resource Agent API, but not LSB compliant.  This is synonymous with
+.B status
+on some resource managers.
+</xsl:when>
+<xsl:when test="@name = 'validate-all'">
+Given (minimally) all required parameters to start or check the status of the resource, validate that those parameters are correct as much as possible.
+</xsl:when>
+<xsl:when test="@name = 'meta-data'">
+Display the XML metadata describing this resource.
+</xsl:when>
+<xsl:when test="@name = 'reload'">Reconfigure the resource in-place with the new given parameters.
+</xsl:when>
+<xsl:when test="@name = 'recover'">
+Attempt to recover the resource in-place without affecting dependencies.  If this fails, the resource manager will try more forceful recovery (such as stop-start).
+</xsl:when>
+<!-- known non-OCF stuff -->
+<xsl:when test="@name = 'status'">
+<xsl:if test="@depth">Depth <xsl:value-of select="@depth"/>.
+</xsl:if>
+This checks the status of the resource.  This is LSB compliant, but not specified by the OCF Resource Agent API.  This is synonymous with
+.B monitor
+on some resource managers.
+</xsl:when>
+<xsl:when test="@name = 'reconfig'">
+Reconfigure the resource in-place with the new given parameters.
+</xsl:when>
+<xsl:when test="@name = 'verify-all'">
+Given (minimally) all required parameters to start or check the status of the resource, validate that those parameters are correct as much as possible.  This is a misinterpretation of the 
+.B validate-all
+action, and should be fixed.  Please report a bug.
+</xsl:when>
+<xsl:when test="@name = 'promote'">
+If this resource was the slave instance of the
+resource, promote it to master status.
+</xsl:when>
+<xsl:when test="@name = 'demote'">
+If this resource was the master instance of the
+resource, demote it to slave status.
+</xsl:when>
+<xsl:when test="@name = 'migrate'">
+Migrate this resource to another node in the cluster.
+</xsl:when>
+<!-- Ehhh -->
+<xsl:otherwise>
+The operational behavior of this is not known.
+</xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+
+<xsl:template match="child">
+.PP
+<xsl:value-of select="@type"/> -
+Started at level <xsl:value-of select="@start"/>.
+Stopped at level <xsl:value-of select="@stop"/>.
+</xsl:template>
+<xsl:template match="/resource-agent">.TH RESOURCE_AGENT 8 2009-01-20 "<xsl:value-of select="@name"/> (Resource Agent)"
+.SH
+<xsl:value-of select="@name"/>
+Cluster Resource Agent
+
+.SH DESCRIPTION
+<xsl:value-of select="normalize-space(longdesc)"/>
+
+.SH PARAMETERS
+<xsl:apply-templates select="parameters"/>
+
+.SH RGMANAGER INTERNAL PARAMETERS
+.TP
+.B __enforce_timeouts
+If set to 1, an operation exceeding the defined timeout will be considered
+a failure of that operation.  Note that fail-to-stop is critical, and causes
+a service to enter the failed state.
+
+.TP
+.B __independent_subtree
+If set to 1, failure of a status operation of this resource or any of its
+children will be considered non-fatal unless a restart of this resource and
+all of its children also fails.
+
+.SH ACTIONS
+<xsl:apply-templates select="actions"/>
+
+.SH RGMANAGER NOTES
+<xsl:if test="special/@tag = 'rgmanager'">
+<xsl:if test="special/attributes/@maxinstances">
+.PP
+An instatnce of this resource defined in the
+.B &lt;resources&gt;
+section of
+.B cluster.conf
+can be referenced in the resource
+tree at most <xsl:value-of select="special/attributes/@maxinstances"/>
+time(s).  All subsequent references to this resource will be ignored.
+</xsl:if>
+<xsl:if test="special/attributes/@root">
+.PP
+This is the root resource class.  Other resource 
+types must be attached as children to this resource
+class.
+</xsl:if>
+<xsl:if test="special/child/@type">
+.PP
+Known Child Types:
+<xsl:apply-templates select="special"/>
+</xsl:if>
+</xsl:if>
+.SH REFERENCES
+.PP
+http://www.opencf.org/cgi-bin/viewcvs.cgi/specs/ra/resource-agent-api.txt?rev=HEAD - The Open Cluster Framework Resource Agent Application Programming Interface draft version 1.0
+
+.PP
+http://www.linux-foundation.org/spec/refspecs/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html - Linux Standards Base v3.1.0 - Init Script Actions
+
+.PP
+http://sources.redhat.com/cluster/wiki/RGManager - Linux-cluster Resource Group Manager information
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/rgmanager/src/resources/ra2oid.xsl b/rgmanager/src/resources/ra2oid.xsl
new file mode 100644
index 0000000..697bd49
--- /dev/null
+++ b/rgmanager/src/resources/ra2oid.xsl
@@ -0,0 +1,68 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text" indent="no"/>
+
+<xsl:template name="normalize-name">
+	<xsl:param name="value"/>
+	<xsl:variable name="normalized" select="concat( translate(substring(@name, 1, 1), '_abcdefghijklmnopqrstuvwrxyz', '-ABCDEFGHIJKLMNOPQRSTUVWRXYZ'), translate(substring(@name, 2), '_ABCDEFGHIJKLMNOPQRSTUVWRXYZ', '-abcdefghijklmnopqrstuvwrxyz'))"/>
+	<xsl:choose>
+		<xsl:when test="$normalized = 'Name'">name</xsl:when>
+		<xsl:otherwise>rhcs<xsl:value-of select="$normalized"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="/resource-agent">
+#
+# Resource Agent: <xsl:value-of select="@name"/>
+# Provider: <xsl:value-of select="@provider"/>
+# Provider Version: <xsl:value-of select="@version"/>
+# API Version: <xsl:value-of select="normalize-space(version)"/>
+# Description: <xsl:value-of select="normalize-space(shortdesc)"/>
+#
+objectClasses: ( 
+	1.3.6.1.4.1.2312.8.1.2.@@OBJ_CLASS_<xsl:call-template name="normalize-name"><xsl:with-param name="value" select="@name"/></xsl:call-template>@@ NAME '<xsl:call-template name="normalize-name">
+		<xsl:with-param name="value" select="@name"/>
+	</xsl:call-template>' SUP top STRUCTURAL
+	DESC '<xsl:value-of select="normalize-space(shortdesc)"/>'
+	MUST( <xsl:for-each select="parameters/parameter">
+		<xsl:if test="@required = 1 or @primary = 1">
+			<xsl:call-template name="normalize-name">
+				<xsl:with-param name="value" select="@name"/>
+			</xsl:call-template>
+			<xsl:if test="position()!=last()"> $ </xsl:if>
+		</xsl:if>
+	</xsl:for-each> )
+	MAY( <xsl:for-each select="parameters/parameter">
+		<xsl:if test="string(number(@primary)) = 'NaN' or @primary = 0">
+			<xsl:if test="string(number(@required)) = 'NaN' or @required = 0">
+				<xsl:call-template name="normalize-name">
+					<xsl:with-param name="value" select="@name"/>
+				</xsl:call-template>
+				<xsl:if test="position()!=last()"> $ </xsl:if>
+			</xsl:if>
+		</xsl:if>
+	</xsl:for-each> )
+)
+
+#
+# Object Attributes
+# FIXME: Run a list of known attribute types
+#
+<xsl:for-each select="parameters/parameter">
+<xsl:if test="@name != 'name'">
+attributeTypes: (
+	1.3.6.1.4.1.2312.8.1.1.@@ATTR_TYPE_<xsl:call-template name="normalize-name"><xsl:with-param name="value" select="@name"/></xsl:call-template>@@ NAME '<xsl:call-template name="normalize-name"><xsl:with-param name="value" select="@name"/></xsl:call-template>'
+	DESC '<xsl:value-of select="normalize-space(shortdesc)"/>'
+	<xsl:choose>
+	<xsl:when test="content/@type = 'integer'">EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27</xsl:when>
+	<xsl:when test="content/@type = 'boolean'">EQUALITY booleanMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.7</xsl:when>
+	<xsl:otherwise>EQUALITY caseExactIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26</xsl:otherwise>
+	</xsl:choose>
+	SINGLE-VALUE
+)
+</xsl:if>
+</xsl:for-each>
+</xsl:template>
+</xsl:stylesheet>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-26 22:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-26 22:40 cluster: STABLE3 - rgmanager: Add XSLT scripts for extracting RA metadata Lon Hohberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).