1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"
doctype-public="-//OASIS//DTD DocBook XML V4.4//EN"
doctype-system="http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"/>
<!--<xsl:strip-space elements="longdesc shortdesc"/>-->
<!-- Package name. -->
<xsl:param name="package">resource-agents</xsl:param>
<!-- Package version number. Must be passed in. -->
<xsl:param name="version"/>
<!-- RA class -->
<xsl:param name="class">ocf</xsl:param>
<!-- RA provider -->
<xsl:param name="provider">heartbeat</xsl:param>
<!-- Man volume number -->
<xsl:param name="manvolum">7</xsl:param>
<!-- -->
<xsl:param name="variable.prefix"/>
<!-- Separator between different action/@name -->
<xsl:param name="separator"> | </xsl:param>
<xsl:variable name="manpagetitleprefix"><xsl:value-of select="$class"/>_<xsl:value-of select="$provider"/>_</xsl:variable>
<xsl:template match="/">
<refentry>
<xsl:apply-templates mode="root"/>
</refentry>
</xsl:template>
<xsl:template match="resource-agent" mode="root">
<xsl:param name="this" select="self::resource-agent"/>
<xsl:attribute name="id">
<xsl:text>re-ra-</xsl:text>
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:apply-templates select="$this" mode="refentryinfo"/>
<xsl:apply-templates select="$this" mode="refmeta"/>
<xsl:apply-templates select="$this" mode="refnamediv"/>
<xsl:apply-templates select="$this" mode="synopsis"/>
<xsl:apply-templates select="$this" mode="description"/>
<xsl:apply-templates select="$this" mode="parameters"/>
<xsl:apply-templates select="$this" mode="actions"/>
<xsl:apply-templates select="$this" mode="example"/>
<xsl:apply-templates select="$this" mode="seealso"/>
</xsl:template>
<!-- Empty Templates -->
<xsl:template match="node()" mode="root"/>
<xsl:template match="*" mode="refmeta"/>
<xsl:template match="*" mode="refnamediv"/>
<xsl:template match="*" mode="synopsis"/>
<xsl:template match="*" mode="description"/>
<xsl:template match="*" mode="parameters"/>
<!-- Mode refentryinfo -->
<xsl:template match="resource-agent" mode="refentryinfo">
<refentryinfo>
<productname><xsl:value-of select="$package"/></productname>
<productnumber><xsl:value-of select="$version"/></productnumber>
<corpauthor>Linux-HA contributors (see the resource agent source for information about individual authors)</corpauthor>
</refentryinfo>
</xsl:template>
<!-- Mode refmeta -->
<xsl:template match="resource-agent" mode="refmeta">
<refmeta>
<refentrytitle><xsl:value-of select="$manpagetitleprefix"/><xsl:value-of select="@name"/></refentrytitle>
<manvolnum><xsl:value-of select="$manvolum"/></manvolnum>
<refmiscinfo class="manual">OCF resource agents</refmiscinfo>
</refmeta>
</xsl:template>
<!-- Mode refnamediv -->
<xsl:template match="resource-agent" mode="refnamediv">
<refnamediv>
<refname><xsl:value-of select="$manpagetitleprefix"/><xsl:value-of select="@name"/></refname>
<refpurpose><xsl:apply-templates select="shortdesc"/></refpurpose>
</refnamediv>
</xsl:template>
<!-- Mode synopsis -->
<xsl:template match="resource-agent" mode="synopsis">
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command moreinfo="none">
<xsl:value-of select="@name"/>
</command>
<xsl:apply-templates select="actions" mode="synopsis"/>
</cmdsynopsis>
</refsynopsisdiv>
</xsl:template>
<xsl:template match="actions" mode="synopsis">
<group choice="opt" rep="norepeat">
<xsl:apply-templates select="action[@name = 'start'][1]" mode="synopsis"/>
<xsl:apply-templates select="action[@name = 'stop'][1]" mode="synopsis"/>
<xsl:apply-templates select="action[@name = 'status'][1]" mode="synopsis"/>
<xsl:apply-templates select="action[@name = 'monitor'][1]" mode="synopsis"/>
<xsl:apply-templates select="action[@name = 'migrate_to'][1]" mode="synopsis"/>
<xsl:apply-templates select="action[@name = 'migrate_from'][1]" mode="synopsis"/>
<xsl:apply-templates select="action[@name = 'promote'][1]" mode="synopsis"/>
<xsl:apply-templates select="action[@name = 'demote'][1]" mode="synopsis"/>
<xsl:apply-templates select="action[@name = 'meta-data'][1]" mode="synopsis"/>
<xsl:apply-templates select="action[@name = 'validate-all'][1]" mode="synopsis"/>
</group>
</xsl:template>
<xsl:template match="action" mode="synopsis">
<arg choice="plain" rep="norepeat">
<xsl:value-of select="@name"/>
</arg>
</xsl:template>
<!-- Mode Description -->
<!-- break string into <para> elements on linefeeds -->
<!-- would be so much easier with replace(...) -->
<xsl:template name="break_into_para">
<xsl:param name="string" />
<xsl:choose>
<xsl:when test="starts-with($string, '
') or starts-with($string, ' ')" >
<!-- trim leading newlines and other witespace -->
<xsl:variable name="normalized" select="normalize-space($string)" />
<xsl:variable name="nlen" select="string-length($normalized)" />
<xsl:if test="$nlen > 0" >
<xsl:variable name="leading" select="string-length(substring-before($string, substring($normalized, 1, 1)))" />
<xsl:call-template name="break_into_para">
<xsl:with-param name="string" select="substring($string, $leading + 1)" />
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="lf" select="'

'" />
<xsl:variable name="lf_dash" select="'
-'" />
<xsl:choose>
<xsl:when test="contains($string, $lf)">
<xsl:variable name="first" select="substring-before($string, $lf)" />
<!-- recursively call on remaining string -->
<xsl:call-template name="break_into_para">
<xsl:with-param name="string" select="$first"/>
</xsl:call-template>
<xsl:call-template name="break_into_para">
<xsl:with-param name="string" select="substring-after($string, $lf)" />
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($string, $lf_dash)">
<xsl:variable name="first" select="substring-before($string, $lf_dash)" />
<!-- recursively call on remaining string -->
<xsl:call-template name="break_into_para">
<xsl:with-param name="string" select="$first"/>
</xsl:call-template>
<xsl:call-template name="break_into_para">
<xsl:with-param name="string" select="concat('-',substring-after($string, $lf_dash))" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<para>
<xsl:value-of select="'
'"/>
<xsl:value-of select="$string"/>
<xsl:value-of select="'
'"/>
</para>
<xsl:value-of select="'
'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="resource-agent" mode="description">
<refsection>
<title>Description</title>
<xsl:apply-templates mode="description"/>
</refsection>
</xsl:template>
<xsl:template match="text()" mode="longdesc">
<xsl:call-template name="break_into_para">
<xsl:with-param name="string" select="." />
</xsl:call-template>
</xsl:template>
<xsl:template match="longdesc" mode="description">
<xsl:apply-templates mode="longdesc"/>
</xsl:template>
<xsl:template match="actions" mode="description">
<xsl:if test="action[@name = 'migrate_from' or @name = 'migrate_to']">
<para>This resource agent may be configured for <emphasis>native
migration</emphasis> if available in the cluster manager. For
Pacemaker, the
<parameter>allow-migrate="true"</parameter> meta
attribute enables native migration.</para>
</xsl:if>
<xsl:apply-templates mode="longdesc"/>
</xsl:template>
<!-- Mode Parameters -->
<xsl:template match="resource-agent" mode="parameters">
<refsection>
<title>Supported Parameters</title>
<xsl:choose>
<xsl:when test="parameters">
<xsl:apply-templates mode="parameters"/>
</xsl:when>
<xsl:otherwise>
<para>
<xsl:text>This resource agent does not support any parameters.</xsl:text>
</para>
</xsl:otherwise>
</xsl:choose>
</refsection>
</xsl:template>
<xsl:template match="resource-agent/shortdesc|resource-agent/longdesc" mode="parameters"/>
<xsl:template match="parameters" mode="parameters">
<variablelist>
<xsl:apply-templates mode="parameters"/>
</variablelist>
</xsl:template>
<xsl:template match="parameter" mode="parameters">
<varlistentry>
<term>
<option><xsl:value-of select="concat($variable.prefix, @name)"/></option>
</term>
<listitem>
<xsl:apply-templates select="longdesc" mode="parameters"/>
<para>
<xsl:apply-templates select="content" mode="parameters"/>
</para>
</listitem>
</varlistentry>
</xsl:template>
<xsl:template match="longdesc" mode="parameters">
<xsl:apply-templates select="node()" mode="longdesc"/>
</xsl:template>
<xsl:template match="shortdesc" mode="parameters">
<xsl:apply-templates select="text()" mode="parameters"/>
</xsl:template>
<xsl:template match="content" mode="parameters">
<xsl:if test="@type != '' or @default != ''">
<xsl:text> (</xsl:text>
<xsl:if test="../@unique = 1">
<xsl:text>unique, </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="../@required = 1">
<xsl:text>required</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>optional</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>, </xsl:text>
<xsl:if test="@parameter != ''">
<xsl:value-of select="@type"/>
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="@type != ''">
<xsl:value-of select="@type"/>
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="@default != ''">
<xsl:text>default </xsl:text>
<xsl:if test="@type = 'string'">
<xsl:text>"</xsl:text>
</xsl:if>
<code>
<xsl:value-of select="@default"/>
</code>
<xsl:if test="@type = 'string'">
<xsl:text>"</xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="@type='boolean' and @default = ''">
<xsl:text>default </xsl:text>
<code>false</code>
</xsl:when>
<xsl:otherwise>
<xsl:text>no default</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:template>
<!-- Mode Actions -->
<xsl:template match="resource-agent" mode="actions">
<refsection>
<title>Supported Actions</title>
<xsl:choose>
<xsl:when test="actions">
<xsl:apply-templates select="actions" mode="actions"/>
</xsl:when>
<xsl:otherwise>
<!-- This should actually never happen. Every RA must
advertise the actions it supports. -->
<para>
<xsl:text>This resource agent does not advertise any supported actions.</xsl:text>
</para>
</xsl:otherwise>
</xsl:choose>
</refsection>
</xsl:template>
<xsl:template match="actions" mode="actions">
<para>This resource agent supports the following actions (operations):</para>
<variablelist>
<xsl:apply-templates select="action" mode="actions"/>
</variablelist>
</xsl:template>
<xsl:template match="action" mode="actions">
<varlistentry>
<term>
<option>
<xsl:value-of select="@name"/>
<xsl:if test="@role != ''">
<xsl:text> (</xsl:text>
<xsl:value-of select="@role"/>
<xsl:text> role)</xsl:text>
</xsl:if>
</option>
</term>
<listitem>
<para>
<xsl:choose>
<xsl:when test="@name = 'start'">
<xsl:text>Starts the resource.</xsl:text>
</xsl:when>
<xsl:when test="@name = 'stop'">
<xsl:text>Stops the resource.</xsl:text>
</xsl:when>
<xsl:when test="@name = 'status'">
<xsl:text>Performs a status check.</xsl:text>
</xsl:when>
<xsl:when test="@name = 'monitor'">
<xsl:text>Performs a detailed status check.</xsl:text>
</xsl:when>
<xsl:when test="@name = 'promote'">
<xsl:text>Promotes the resource to the Master role.</xsl:text>
</xsl:when>
<xsl:when test="@name = 'demote'">
<xsl:text>Demotes the resource to the Slave role.</xsl:text>
</xsl:when>
<xsl:when test="@name = 'migrate_from'">
<xsl:text>Executes steps necessary for migrating the
resource </xsl:text>
<emphasis>away from</emphasis>
<xsl:text> the node.</xsl:text>
</xsl:when>
<xsl:when test="@name = 'migrate_to'">
<xsl:text>Executes steps necessary for migrating the
resource </xsl:text>
<emphasis>to</emphasis>
<xsl:text> the node.</xsl:text>
</xsl:when>
<xsl:when test="@name = 'validate-all'">
<xsl:text>Performs a validation of the resource configuration.</xsl:text>
</xsl:when>
<xsl:when test="@name = 'meta-data'">
<xsl:text>Retrieves resource agent metadata (internal use only).</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:if test="@timeout != ''">
<xsl:text> Suggested minimum timeout: </xsl:text>
<xsl:value-of select="@timeout"/>
<xsl:text>.</xsl:text>
</xsl:if>
<xsl:if test="@interval != ''">
<xsl:text> Suggested interval: </xsl:text>
<xsl:value-of select="@interval"/>
<xsl:text>.</xsl:text>
</xsl:if>
</para>
</listitem>
</varlistentry>
</xsl:template>
<!-- Mode Example -->
<xsl:template match="resource-agent" mode="example">
<refsection>
<title>Example</title>
<para>
<xsl:text>The following is an example configuration for a </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> resource using the </xsl:text>
<citerefentry><refentrytitle>crm</refentrytitle><manvolnum>8</manvolnum></citerefentry>
<xsl:text> shell:</xsl:text>
</para>
<programlisting>
<xsl:text>primitive p_</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$class"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="$provider"/>
<xsl:text>:</xsl:text>
<xsl:choose>
<xsl:when test="parameters/parameter[@required = 1]">
<xsl:value-of select="@name"/>
<xsl:text> \
params \
</xsl:text>
<xsl:apply-templates select="parameters" mode="example"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/><xsl:text> \</xsl:text>
</xsl:otherwise>
</xsl:choose>
<!-- Insert a suggested allow-migrate meta attribute if the
resource agent supports migration -->
<xsl:if test="actions/action[@name = 'migrate_from' or @name = 'migrate_to']">
<xsl:text>
meta allow-migrate="true" \</xsl:text>
</xsl:if>
<xsl:apply-templates select="actions" mode="example"/>
</programlisting>
<!-- Insert a master/slave set definition if the resource
agent supports promotion and demotion -->
<xsl:if test="actions/action/@name = 'promote' and actions/action/@name = 'demote'">
<programlisting>
<xsl:text>ms ms_</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> p_</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> \
meta notify="true" interleave="true"</xsl:text>
</programlisting>
</xsl:if>
</refsection>
</xsl:template>
<xsl:template match="parameters" mode="example">
<xsl:apply-templates select="parameter[@required = 1]" mode="example"/>
</xsl:template>
<xsl:template match="parameter" mode="example">
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>=</xsl:text>
<xsl:apply-templates select="content" mode="example"/>
<xsl:text> \</xsl:text>
<xsl:if test="following-sibling::parameter/@required = 1">
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="content" mode="example">
<xsl:choose>
<xsl:when test="@default != ''">
<xsl:text>"</xsl:text>
<xsl:value-of select="@default"/>
<xsl:text>"</xsl:text>
</xsl:when>
<xsl:otherwise>
<replaceable><xsl:value-of select="@type"/></replaceable>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="actions" mode="example">
<!-- In the CRM shell example, show only the monitor action -->
<xsl:apply-templates select="action[@name = 'monitor']" mode="example"/>
</xsl:template>
<xsl:template match="action" mode="example">
<xsl:text>
op </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="@*" mode="example"/>
<xsl:if test="following-sibling::action/@name = 'monitor'">
<xsl:text>\</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="action/@*" mode="example">
<xsl:choose>
<xsl:when test="name() = 'name'"><!-- suppress --></xsl:when>
<xsl:otherwise>
<xsl:value-of select="name()"/>
<xsl:text>="</xsl:text>
<xsl:value-of select="current()"/>
<xsl:text>" </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="following-sibling::*">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="longdesc" mode="example"/>
<xsl:template match="shortdesc" mode="example"/>
<xsl:template match="resource-agent" mode="seealso">
<refsection>
<title>See also</title>
<para>
<ulink>
<xsl:attribute name="url">
<xsl:text>http://www.linux-ha.org/wiki/</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>_(resource_agent)</xsl:text>
</xsl:attribute>
</ulink>
</para>
</refsection>
</xsl:template>
</xsl:stylesheet>
|