Whamcloud - gitweb
LUDOC-104: Design elements to highlight lustre specific features.
authorRichard Henwood <richard.henwood@intel.com>
Wed, 26 Dec 2012 21:01:43 +0000 (15:01 -0600)
committerRichard Henwood <richard.henwood@intel.com>
Wed, 6 Feb 2013 02:53:28 +0000 (21:53 -0500)
The Docbook 5 standard allows for a condition attribute to all
elements. By setting this condition with the value of l23 or l24
passages of the manual that are specific to version of Lustre
can be marked up.

This change adds an annotation against elements that have the
condition attribute set. Graphics are rendered in-line at the
relevant point in the text and against the relevant entries in
the table of contents.

'condition' annotations to two existing lustre specific sections
of the to demonstrate this new design feature.

The document design elements are displayed similarly across epub, html,
xhtml and pdf renderings of the manual.

Signed-off-by: Richard Henwood <richard.henwood@intel.com>
Change-Id: Idd2cb762e219204bfc63c9ed81ccedd49b2c43ac
Reviewed-on: http://review.whamcloud.com/4611
Tested-by: Hudson
BackupAndRestore.xml
ConfiguringLustre.xml
LustreTuning.xml
Makefile
style/customstyle.xsl [new file with mode: 0644]
style/customstyle_fo.xsl [new file with mode: 0644]
style/manual.css [new file with mode: 0644]

index 0724bd9..9de0266 100644 (file)
@@ -193,7 +193,7 @@ Changelog records consumed: 42</screen>
     <note>
       <para>Keeping an updated full backup of the MDT is especially important because a permanent failure of the MDT file system renders the much larger amount of data in all the OSTs largely inaccessible and unusable.</para>
     </note>
-    <warning>
+    <warning condition='l23'>
         <para>In Lustre 2.0 through 2.2, the only successful way to backup and restore an MDT is to do a device-level backup as is described in this section. File-level restore of an MDT is not possible before Lustre 2.3, as the Object Index (OI) file cannot be rebuilt after restore without the OI Scrub functionality. <emphasis role='bold'>Since Lustre 2.3</emphasis>, Object Index files are automatically rebuilt at first mount after a restore is detected (see <link xl:href='http://jira.whamcloud.com/browse/LU-957'>LU-957</link>), and file-level backup is supported (see <xref linkend='dbdoclet.50438207_21638'/>).</para>
     </warning>
     <para>If hardware replacement is the reason for the backup or if a spare storage device is available, it is possible to do a raw copy of the MDT or OST from one block device to the other, as long as the new device is at least as large as the original device. To do this, run:</para>
index 6d4d443..68e1783 100644 (file)
@@ -61,7 +61,7 @@
           <para>See <xref linkend="dbdoclet.50438194_88063"/> for more details.</para> 
         </note>
       </listitem>
-      <listitem xml:id="dbdoclet.addmdtindex" condition='l24'>
+      <listitem xml:id="dbdoclet.addmdtindex">
                <para>Optional for Lustre 2.4 and later. Add in additional MDTs.</para>
         <screen>mkfs.lustre --fsname=<replaceable>fsname</replaceable> --mgsnode=<replaceable>nid</replaceable> --mdt --index=1 <replaceable>/dev/block_device</replaceable></screen>
                <note><para>Up to 4095 additional MDTs can be added.</para></note>
index d9eb216..0b5bd3c 100644 (file)
        <note><para>Default values for the thread counts are automatically selected. The values are chosen to best exploit the number of CPUs present in the system and to provide best overall performance for typical workloads.</para></note>
     </section>
   </section>
-    <section xml:id="dbdoclet.mdsbinding" condition='l24'>
+    <section xml:id="dbdoclet.mdsbinding" condition='l23'>
       <title><indexterm><primary>tuning</primary><secondary>MDS binding</secondary></indexterm>Binding MDS Service Thread to CPU Partitions</title>
        <para>With the introduction of Node Affinity (<xref linkend="nodeaffdef"/>) in Lustre 2.3, MDS threads can be bound to particular CPU Partitions (CPTs). Default values for bindings are selected automatically to provide good overall performance for a given CPU count. However, an administrator can deviate from these setting if they choose.</para>
            <itemizedlist>
index 7570a8a..a9571b1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,7 @@ XSL=$(or $(shell ls -d $(XSL_UBN) 2> /dev/null), \
         $(shell ls -d $(XSL_REL) 2> /dev/null), \
         $(shell ls -d $(XSL_F16) 2> /dev/null), \
         $(shell ls -d $(XSL_MAC) 2> /dev/null))
+PRIMARYXSL=$(XSL)/$(subst $(TGT_BASE).,,$@)/docbook.xsl
 
 .PHONY: all
 all: clean check xhtml html pdf epub
@@ -34,13 +35,16 @@ check: $(SRC_XML)
        xmllint --noout --xinclude --noent --relaxng $(RNG) ./index.xml
 
 # Note: can't use "suffix" instead of "subst", because it keeps the '.'
-$(TGT_BASE).html $(TGT_BASE).xhtml $(TGT_BASE).epub $(TGT_BASE).fo: $(SRCS)
-       xsltproc --stringparam fop1.extensions  1 \
-               --stringparam section.label.includes.component.label 1 \
-               --stringparam section.autolabel 1 \
-               --stringparam chapter.autolabel 1 \
-               --stringparam appendix.autolabel 1 \
-               --xinclude -o $@ $(XSL)/$(subst $(TGT_BASE).,,$@)/docbook.xsl ./index.xml
+# Note: xsl:import is resolved at compile time, so the primary xsl
+#   is substituted into the custom xsl with sed before compliation.
+$(TGT_BASE).html $(TGT_BASE).xhtml $(TGT_BASE).epub: $(SRCS)
+       sed -e 's;PRIMARYXSL;${PRIMARYXSL};' ./style/customstyle.xsl | \
+       xsltproc --xinclude -o $@ - ./index.xml
+
+$(TGT_BASE).fo: $(SRCS)
+       sed -e 's;PRIMARYXSL;${PRIMARYXSL};' ./style/customstyle_fo.xsl | \
+       xsltproc --xinclude -o $@ - ./index.xml
+
 
 $(TGT_BASE).pdf: $(TGT_BASE).fo
                fop $< $@
@@ -58,6 +62,8 @@ pdf: $(TGT_BASE).pdf
 epub: $(TGT_BASE).epub
        echo "application/epub+zip" > mimetype
        cp -r ./figures ./OEBPS/
+       mkdir ./OEBPS/style
+       cp ./style/manual.css ./OEBPS/style/
        zip -0Xq $(TGT_BASE).epub mimetype
        zip -Xr9D $(TGT_BASE).epub OEBPS/*
        zip -Xr9D $(TGT_BASE).epub META-INF/*
@@ -90,5 +96,5 @@ push:
 clean:
        rm -f $(TGT_BASE).html $(TGT_BASE).xhtml $(TGT_BASE).pdf\
                mastermanual.revision mastermanual.index mimetype\
-               $(TGT_BASE).diff.html $(TGT_BASE).epub
+               $(TGT_BASE).diff.html $(TGT_BASE).epub $(TGT_BASE).fo
        rm -rf ./META-INF ./OEBPS
diff --git a/style/customstyle.xsl b/style/customstyle.xsl
new file mode 100644 (file)
index 0000000..77c5576
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version='1.0'?>
+<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- xsl:import takes place at compile time. For this reason, I sed in the correct
+               primary xsl (for html,xhtml), and then run xsltproc -->
+<xsl:import href="PRIMARYXSL"/>
+
+<xsl:param name="html.stylesheet" select="'./style/manual.css'"/>
+
+<xsl:param name="chapter.autolabel" select="1"></xsl:param>
+<xsl:param name="section.autolabel" select="1"></xsl:param>
+<xsl:param name="appendix.autolabel" select="1"></xsl:param>
+<xsl:param name="autotoc.label.in.hyperlink" select="1"></xsl:param>
+<xsl:param name="section.label.includes.component.label" select="1"></xsl:param>
+
+<!--  textdecoration_1 applies the style to the text to highlight an region
+               of the documentation refers to a lustre specific version.
+
+               template_{1,2,3} all use the 'condition="{l23,l24}" attributes and add
+               decoration to the rendered version of the manual to show lustre version
+               specific features. -->
+
+<!-- textdecoration_1: a template to apply a div with a class
+               around the relevant sections of text. -->
+<xsl:template name='textdecoration_1'>
+       <xsl:param name='version'/>
+       <xsl:param name='chunkid'/>
+       <div class='versioncontent'>
+               <span class='versionlabel'>
+                       <xsl:value-of select='$version'/>
+               </span>
+               <xsl:apply-templates/>
+       </div>
+</xsl:template>
+
+<!-- template_1: this tempate matches condition='l23' and calls
+               the textdecoration_1 template with the relevant class. -->
+<xsl:template match="*[@condition='l23']">
+       <xsl:variable name="id">
+               <xsl:call-template name="object.id"/>
+       </xsl:variable>
+       <xsl:call-template name='section.titlepage'/>
+       <xsl:call-template name='textdecoration_1'>
+               <xsl:with-param name='version' select="'introduced in Lustre 2.3'"/>
+               <xsl:with-param name='chunkid' select="$id"/>
+       </xsl:call-template>
+</xsl:template>
+
+<!-- template_2: this tempate matches condition='l24' and calls
+               the textdecoration_1 template with the relevant class. -->
+<xsl:template match="*[@condition='l24']">
+       <xsl:variable name="id">
+               <xsl:call-template name="object.id"/>
+       </xsl:variable>
+       <xsl:call-template name='section.titlepage'/>
+       <xsl:call-template name='textdecoration_1'>
+               <xsl:with-param name='version' select="'introduced in Lustre 2.4'"/>
+               <xsl:with-param name='chunkid' select="$id"/>
+       </xsl:call-template>
+</xsl:template>
+
+
+<!-- template_3: This template over loads the behavior of creating the table of contents. It
+               adds in a small entry to identify lustre version specific features.
+               for more information, see this page:
+               http://xml.web.cern.ch/XML/www.sagehill.net/xml/docbookxsl/PrintCustomEx.html#PrintTocEntries -->
+<xsl:template name="toc.line">
+       <xsl:param name="toc-context" select="."/>
+       <xsl:param name="depth" select="1"/>
+       <xsl:param name="depth.from.context" select="8"/>
+
+       <span>
+       <xsl:attribute name="class">
+               <xsl:value-of select="local-name(.)"/>
+       </xsl:attribute>
+
+       <!-- * if $autotoc.label.in.hyperlink is zero, then output the label -->
+       <!-- * before the hyperlinked title (as the DSSSL stylesheet does) -->
+       <xsl:if test="$autotoc.label.in.hyperlink = 0">
+               <xsl:variable name="label">
+                       <xsl:apply-templates select="." mode="label.markup"/>
+               </xsl:variable>
+               <xsl:copy-of select="$label"/>
+               <xsl:if test="$label != ''">
+                       <xsl:value-of select="$autotoc.label.separator"/>
+               </xsl:if>
+       </xsl:if>
+
+       <a>
+               <xsl:attribute name="href">
+                       <xsl:call-template name="href.target">
+                               <xsl:with-param name="context" select="$toc-context"/>
+                               <xsl:with-param name="toc-context" select="$toc-context"/>
+                       </xsl:call-template>
+               </xsl:attribute>
+
+       <!-- * if $autotoc.label.in.hyperlink is non-zero, then output the label
+                        as part of the hyperlinked title -->
+               <xsl:if test="not($autotoc.label.in.hyperlink = 0)">
+                       <xsl:variable name="label">
+                               <xsl:apply-templates select="." mode="label.markup"/>
+                       </xsl:variable>
+                       <xsl:copy-of select="$label"/>
+                       <xsl:if test="$label != ''">
+                               <xsl:value-of select="$autotoc.label.separator"/>
+                       </xsl:if>
+               </xsl:if>
+               <xsl:apply-templates select="." mode="titleabbrev.markup"/>
+       </a>
+       </span>
+       <!-- add another span to hold the lustre version annotation -->
+       <xsl:if test="@condition='l24'">
+               <span class='floatright'>L 2.4 </span>
+       </xsl:if>
+       <xsl:if test="@condition='l23'">
+               <span class='floatright'>L 2.3 </span>
+       </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/style/customstyle_fo.xsl b/style/customstyle_fo.xsl
new file mode 100644 (file)
index 0000000..aeee0c0
--- /dev/null
@@ -0,0 +1,122 @@
+<?xml version='1.0'?>
+<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+       xmlns:fo="http://www.w3.org/1999/XSL/Format"
+       xmlns:d="http://docbook.org/ns/docbook"
+       exclude-result-prefixes="d"
+       version="1.0" >
+<!-- xsl:import takes place at compile time. For this reason, I sed in the correct
+     primary xsl pdf, and then run xsltproc -->
+<xsl:import href="PRIMARYXSL"/>
+<xsl:output method='xml'/>
+
+<xsl:param name="chapter.autolabel" select="1"></xsl:param>
+<xsl:param name="section.autolabel" select="1"></xsl:param>
+<xsl:param name="appendix.autolabel" select="1"></xsl:param>
+<xsl:param name="autotoc.label.in.hyperlink" select="1"></xsl:param>
+<xsl:param name="section.label.includes.component.label" select="1"></xsl:param>
+
+<!--  textdecoration_1 applies the style to the text to highlight an region
+               of the documentation refers to a lustre specific version.
+
+               template_{1,2,3} all use the 'condition="{l23,l24}" attributes and add
+               decoration to the rendered version of the manual to show lustre version
+               specific features. -->
+
+<!-- textdecoration_1: a template to highlight regions of text. -->
+<xsl:template name='textdecoration_1'>
+       <xsl:param name='version'/>
+       <xsl:param name='chunkid'/>
+       <fo:block-container id="{$chunkid}"
+                       padding='5pt'
+                       border-color='gray'
+                       border-style='solid'
+                       border-width='1pt'>
+               <fo:block-container float='left' text-indent='3px' start-indent='-20px'>
+                       <fo:block background-color="gray">
+                               <xsl:value-of select='$version'/>
+                       </fo:block>
+               </fo:block-container>
+               <fo:block text-indent='0px' start-indent='0px'>
+                       <xsl:apply-templates/>
+               </fo:block>
+       </fo:block-container>
+</xsl:template>
+
+<!-- template_1: this tempate matches condition='l23' and calls
+               the textdecoration_1 template with the relevant image. -->
+<xsl:template match="*[@condition='l23']">
+       <xsl:variable name="id">
+               <xsl:call-template name="object.id"/>
+       </xsl:variable>
+       <xsl:call-template name='section.titlepage'/>
+       <xsl:call-template name='textdecoration_1'>
+               <xsl:with-param name='version' select="'introduced in Lustre 2.3'"/>
+               <xsl:with-param name='chunkid' select="$id"/>
+       </xsl:call-template>
+</xsl:template>
+<!-- template_2: this tempate matches condition='l24' and calls
+               the textdecoration_1 template with the relevant image. -->
+<xsl:template match="*[@condition='l24']">
+       <xsl:variable name="id">
+               <xsl:call-template name="object.id"/>
+       </xsl:variable>
+       <xsl:call-template name='section.titlepage'/>
+       <xsl:call-template name='textdecoration_1'>
+               <xsl:with-param name='version' select="'introduced in Lustre 2.4'"/>
+               <xsl:with-param name='chunkid' select="$id"/>
+       </xsl:call-template>
+</xsl:template>
+
+<!-- template_3: This template over loads the behavior of creating the table of contents. It
+               adds in a small entry to identify lustre version specific features.
+               for more information, see this page:
+               http://xml.web.cern.ch/XML/www.sagehill.net/xml/docbookxsl/PrintCustomEx.html#PrintTocEntries -->
+<xsl:template name="toc.line">
+       <xsl:variable name="id">
+               <xsl:call-template name="object.id"/>
+       </xsl:variable>
+       <xsl:variable name="lustrecond">
+               <xsl:choose>
+                       <xsl:when test="@condition='l23'">L 2.3</xsl:when>
+                       <xsl:when test="@condition='l24'">L 2.4</xsl:when>
+                       <xsl:otherwise></xsl:otherwise>
+               </xsl:choose>
+       </xsl:variable>
+
+       <xsl:variable name="label">
+               <xsl:apply-templates select="." mode="label.markup"/>
+       </xsl:variable>
+       <fo:block text-align-last="justify"
+                       end-indent="{$toc.indent.width}pt"
+                       last-line-end-indent="-{$toc.indent.width}pt">
+               <fo:inline keep-with-next.within-line="always">
+                       <xsl:choose>
+                               <xsl:when test="local-name(.) = 'chapter'">
+                                       <xsl:attribute name="font-weight">bold</xsl:attribute>
+                               </xsl:when>
+                       </xsl:choose>
+                       <fo:basic-link internal-destination="{$id}">
+                               <xsl:if test="$label != ''">
+                                       <xsl:copy-of select="$label"/>
+                                       <xsl:value-of select="$autotoc.label.separator"/>
+                               </xsl:if>
+                               <xsl:apply-templates select="." mode="title.markup"/>
+                       </fo:basic-link>
+               </fo:inline>
+               <fo:inline keep-together.within-line="always">
+                       <xsl:text> </xsl:text>
+                       <fo:leader leader-pattern="dots"
+                                       leader-pattern-width="3pt"
+                                       leader-alignment="reference-area"
+                                       keep-with-next.within-line="always"/>
+                       <xsl:text>  </xsl:text>
+                       <xsl:value-of select='$lustrecond'/>
+                       <xsl:text>  </xsl:text>
+                       <fo:basic-link internal-destination="{$id}">
+                               <fo:page-number-citation ref-id="{$id}"/>
+                       </fo:basic-link>
+               </fo:inline>
+       </fo:block>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/style/manual.css b/style/manual.css
new file mode 100644 (file)
index 0000000..3082a88
--- /dev/null
@@ -0,0 +1,20 @@
+pre.programlisting, pre.screen
+{   background-color: #e0e0e0;
+    padding: 5px;
+}
+
+span.versionlabel {
+  display: inline-block;
+  position: relative;
+  top: -10px;
+  left: 10px;
+  background-color: white;
+  border: 1px solid gray;
+}
+div.versioncontent {
+  border: 1px solid gray;
+}
+
+span.floatright {
+  float: right;
+}