diff options
author | Radek Novacek <rnovacek@redhat.com> | 2013-10-16 16:31:38 +0200 |
---|---|---|
committer | Radek Novacek <rnovacek@redhat.com> | 2013-10-17 08:40:59 +0200 |
commit | 866c8805d295b07565c3061884dd764dd806cd91 (patch) | |
tree | df32edfd121afd76044d3ee42df773481888f7d8 | |
parent | f4bb88cedbd3d4928c968dbfb481a5bbf2de677d (diff) | |
download | openlmi-providers-866c8805d295b07565c3061884dd764dd806cd91.tar.gz openlmi-providers-866c8805d295b07565c3061884dd764dd806cd91.tar.xz openlmi-providers-866c8805d295b07565c3061884dd764dd806cd91.zip |
power: Add documentation for power provider
-rw-r--r-- | src/power/doc/admin/Makefile | 159 | ||||
-rw-r--r-- | src/power/doc/admin/concepts.rst | 19 | ||||
-rw-r--r-- | src/power/doc/admin/conf.py | 294 | ||||
-rw-r--r-- | src/power/doc/admin/index.rst | 21 | ||||
-rw-r--r-- | src/power/doc/admin/introduction.rst | 16 | ||||
-rw-r--r-- | src/power/doc/admin/mof/Makefile | 15 | ||||
-rw-r--r-- | src/power/doc/admin/mof/header.txt | 2 | ||||
-rw-r--r-- | src/power/doc/admin/pic/plantuml.cfg | 3 | ||||
-rw-r--r-- | src/power/doc/admin/pic/powermanagement.svg | 1 | ||||
-rw-r--r-- | src/power/doc/admin/pic/powermanagement.uml | 15 | ||||
-rw-r--r-- | src/power/doc/admin/usage.rst | 43 |
11 files changed, 588 insertions, 0 deletions
diff --git a/src/power/doc/admin/Makefile b/src/power/doc/admin/Makefile new file mode 100644 index 0000000..fe563ae --- /dev/null +++ b/src/power/doc/admin/Makefile @@ -0,0 +1,159 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp \ + devhelp epub latex latexpdf text man changes linkcheck doctest \ + gettext mof + +help: + @echo "Please use \`make <target>' where <target> is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +mof: + make -C mof + +clean: + -rm -rf $(BUILDDIR)/* + make -C mof clean + +html: mof + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/OpenLMIPowerProvider.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/OpenLMIPowerProvider.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/OpenLMIPowerProvider" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/OpenLMIPowerProvider" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: mof + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: mof + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff --git a/src/power/doc/admin/concepts.rst b/src/power/doc/admin/concepts.rst new file mode 100644 index 0000000..3693815 --- /dev/null +++ b/src/power/doc/admin/concepts.rst @@ -0,0 +1,19 @@ +.. _concepts: + +Power Management API concepts +============================= + +.. figure:: pic/powermanagement.svg + + Class diagram for Power Management provider. + +Base class of this provider is +:ref:`LMI_PowerManagementService <LMI-PowerManagementService>`. +This class has method +:ref:`RequestPowerStateChange <LMI-PowerManagementService-RequestPowerStateChange>` +that can be used for changing between power states. + +For list of available power states, see property +:ref:`PowerStatesSupported <LMI-PowerManagementCapabilities-PowerStatesSupported>` +of the class +:ref:`LMI_PowerManagementCapabilities <LMI-PowerManagementCapabilities>` diff --git a/src/power/doc/admin/conf.py b/src/power/doc/admin/conf.py new file mode 100644 index 0000000..16e6ff5 --- /dev/null +++ b/src/power/doc/admin/conf.py @@ -0,0 +1,294 @@ +# -*- coding: utf-8 -*- +# +# OpenLMI Power Management Provider documentation build configuration file, created by +# sphinx-quickstart on Thu Oct 3 14:25:59 2013. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +def setup(app): + # Register new option to include class list and class tree in index.rst + app.add_config_value('includeClasses', 'True', True) +includeClasses = True + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'OpenLMI Power Management Provider' +copyright = u'2013, Radek Novacek' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '0.3.0' +# The full version, including alpha/beta/rc tags. +release = '0.3.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'openlmitheme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +html_theme_path = ["../../../../tools"] + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'OpenLMIPowerProviderdoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'OpenLMIPowerProvider.tex', u'OpenLMI Power Management Provider Documentation', + u'Radek Novacek', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'openlmipowerprovider', u'OpenLMI Power Management Provider Documentation', + [u'Radek Novacek'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------------ + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'OpenLMIPowerProvider', u'OpenLMI Power Management Provider Documentation', + u'Radek Novacek', 'OpenLMIPowerProvider', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + + +# -- Options for Epub output --------------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = u'OpenLMI Power Management Provider' +epub_author = u'Radek Novacek' +epub_publisher = u'Radek Novacek' +epub_copyright = u'2013, Radek Novacek' + +# The language of the text. It defaults to the language option +# or en if the language is not set. +#epub_language = '' + +# The scheme of the identifier. Typical schemes are ISBN or URL. +#epub_scheme = '' + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +#epub_identifier = '' + +# A unique identification for the text. +#epub_uid = '' + +# A tuple containing the cover image and cover page html template filenames. +#epub_cover = () + +# HTML files that should be inserted before the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_pre_files = [] + +# HTML files shat should be inserted after the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_post_files = [] + +# A list of files that should not be packed into the epub file. +#epub_exclude_files = [] + +# The depth of the table of contents in toc.ncx. +#epub_tocdepth = 3 + +# Allow duplicate toc entries. +#epub_tocdup = True + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/src/power/doc/admin/index.rst b/src/power/doc/admin/index.rst new file mode 100644 index 0000000..7471cb7 --- /dev/null +++ b/src/power/doc/admin/index.rst @@ -0,0 +1,21 @@ +OpenLMI Power Management Provider Documentation +=============================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + introduction + concepts + usage + +.. ifconfig:: includeClasses + + OpenLMI Power Management CIM classes: + + .. toctree:: + :maxdepth: 1 + + mof/tree + mof/index diff --git a/src/power/doc/admin/introduction.rst b/src/power/doc/admin/introduction.rst new file mode 100644 index 0000000..779f184 --- /dev/null +++ b/src/power/doc/admin/introduction.rst @@ -0,0 +1,16 @@ +.. _introduction: + +Introduction +============ +*OpenLMI Power Management Provider* allows to manage power states of +the managed system. Key functionality is ability to reboot, power off, suspend +and hibernate managed system. + +This provider is based on following `DMTF <http://dmtf.org>`_ standard: + +* `DSP1027 - Power State Management Profile <http://dmtf.org/sites/default/files/standards/documents/DSP1027_2.0.0.pdf>`_ + +The knowledge of this standard is not necessary, but it can help a lot. + +Application developers should first get familiar with :ref:`Power Management API concepts <concepts>` +and then look at :ref:`usage of OpenLMI Power Management <usage>`. diff --git a/src/power/doc/admin/mof/Makefile b/src/power/doc/admin/mof/Makefile new file mode 100644 index 0000000..e720c5b --- /dev/null +++ b/src/power/doc/admin/mof/Makefile @@ -0,0 +1,15 @@ +src: index.rst + +TOPDIR=../../../../.. +MOFS=$(TOPDIR)/mof/60_LMI_PowerManagement.mof + +index.rst: $(MOFS) + $(TOPDIR)/tools/openlmi-doc-class2rst -H header.txt \ + -M `echo $(MOFS) | sed 's/ / -M /g'` \ + -S /usr/share/mof/cim-current/CIM_Schema.mof \ + -S $(TOPDIR)/mof/05_LMI_Qualifiers.mof \ + -S $(TOPDIR)/mof/30_LMI_Jobs.mof \ + `cat $(MOFS) | grep "^class" | cut -d ' ' -f 2 | sed 's/://'` + +clean: + rm -f *.rst diff --git a/src/power/doc/admin/mof/header.txt b/src/power/doc/admin/mof/header.txt new file mode 100644 index 0000000..cc06402 --- /dev/null +++ b/src/power/doc/admin/mof/header.txt @@ -0,0 +1,2 @@ +Class reference +=============== diff --git a/src/power/doc/admin/pic/plantuml.cfg b/src/power/doc/admin/pic/plantuml.cfg new file mode 100644 index 0000000..917cf04 --- /dev/null +++ b/src/power/doc/admin/pic/plantuml.cfg @@ -0,0 +1,3 @@ +skinparam defaultFontName Courier +skinparam defaultFontSize 10 + diff --git a/src/power/doc/admin/pic/powermanagement.svg b/src/power/doc/admin/pic/powermanagement.svg new file mode 100644 index 0000000..0578eb4 --- /dev/null +++ b/src/power/doc/admin/pic/powermanagement.svg @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="268pt" style="width:480px;height:268px;" version="1.1" viewBox="0 0 480 268" width="480pt"><defs><filter height="300%" id="f1" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4" dy="4" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><rect fill="#FEFECE" filter="url(#f1)" height="31.6406" style="stroke: #A80036; stroke-width: 1.5;" width="122" x="131" y="8"/><text fill="#000000" font-family="Courier" font-size="10" lengthAdjust="spacingAndGlyphs" textLength="108" x="138" y="20">CIM_ComputerSystem</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="132" x2="252" y1="23.6406" y2="23.6406"/><rect fill="#FEFECE" filter="url(#f1)" height="35.2813" style="stroke: #A80036; stroke-width: 1.5;" width="170" x="107" y="114.5"/><text fill="#000000" font-family="Courier" font-size="10" lengthAdjust="spacingAndGlyphs" textLength="156" x="114" y="126.5">LMI_PowerManagementService</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="108" x2="276" y1="130.1406" y2="130.1406"/><text fill="#000000" font-family="Courier" font-size="10" lengthAdjust="spacingAndGlyphs" textLength="150" x="113" y="144.1406">RequestPowerStateChange()</text><rect fill="#FEFECE" filter="url(#f1)" height="35.2813" style="stroke: #A80036; stroke-width: 1.5;" width="372" x="6" y="224.5"/><text fill="#000000" font-family="Courier" font-size="10" lengthAdjust="spacingAndGlyphs" textLength="186" x="99" y="236.5">LMI_PowerManagementCapabilities</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="7" x2="377" y1="240.1406" y2="240.1406"/><text fill="#000000" font-family="Courier" font-size="10" lengthAdjust="spacingAndGlyphs" textLength="360" x="12" y="254.1406">PowerStatesSupportedValues = [OffSoftGraceful, OffSoft, ...]</text><path d="M130.726,30.309 C104.4864,35.976 76.2035,47.357 60,70 C42.0764,95.047 71.215,110.075 106.63,118.945 " fill="none" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="Courier" font-size="10" lengthAdjust="spacingAndGlyphs" textLength="216" x="61" y="81">LMI_AssociatedPowerManagementService</text><path d="M251.059,114.435 C275.313,104.368 295.192,89.631 283,70 C274.538,56.375 260.593,46.751 246.133,40.004 " fill="none" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="Courier" font-size="10" lengthAdjust="spacingAndGlyphs" textLength="192" x="287" y="81">LMI_HostedPowerManagementService</text><path d="M192,149.875 C192,170.1646 192,204.0069 192,224.2435 " fill="none" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="Courier" font-size="10" lengthAdjust="spacingAndGlyphs" textLength="138" x="193" y="191">LMI_ElementCapabilities</text></g></svg>
\ No newline at end of file diff --git a/src/power/doc/admin/pic/powermanagement.uml b/src/power/doc/admin/pic/powermanagement.uml new file mode 100644 index 0000000..ab4bb63 --- /dev/null +++ b/src/power/doc/admin/pic/powermanagement.uml @@ -0,0 +1,15 @@ +@startuml + +object "CIM_ComputerSystem" as cs + +object "LMI_PowerManagementService" as pms +pms : RequestPowerStateChange() + +object "LMI_PowerManagementCapabilities" as pmc +pmc : PowerStatesSupportedValues = [OffSoftGraceful, OffSoft, ...] + +cs -- pms : LMI_AssociatedPowerManagementService +pms -- cs : LMI_HostedPowerManagementService +pms -- pmc : LMI_ElementCapabilities + +@enduml diff --git a/src/power/doc/admin/usage.rst b/src/power/doc/admin/usage.rst new file mode 100644 index 0000000..67a7f2e --- /dev/null +++ b/src/power/doc/admin/usage.rst @@ -0,0 +1,43 @@ +.. _usage: + +OpenLMI Power Management usage +============================== + +All example scripts are for ``lmishell``. See it's documentation_ on OpenLMI_ +page. + +.. _documentation: https://fedorahosted.org/openlmi/wiki/shell +.. _OpenLMI: https://fedorahosted.org/openlmi/ + +We also assume that ``lmishell`` is connected to the CIMOM and the +connection is stored in ``connection`` variable:: + + connection = connect("server", "username", "password") + ns = connection.root.cimv2 + +Enumeration of available power states +------------------------------------- + +To see the available power states on given managed system, use following:: + + capabilities = ns.LMI_PowerManagementCapabilities.first_instance() + for state in capabilities.PowerStatesSupported: + print ns.LMI_PowerManagementCapabilities.PowerStatesSupportedValues.value_name(state) + +Setting the power state +----------------------- + +Let's say we want to power off the system gracefully:: + + # Check if the power state is available first + capabilities = ns.LMI_PowerManagementCapabilities.first_instance() + if not ns.LMI_PowerManagementCapabilities.PowerStatesSupportedValues.OffSoftGraceful in capabilities.PowerStatesSupported: + print "OffSoftGraceful state is not supported" + return + # Get the PowerManagement service + service = ns.LMI_PowerManagementService.first_instance() + # Invoke the state change + service.RequestPowerStateChange(PowerState=ns.LMI_PowerManagementCapabilities.PowerStatesSupportedValues.OffSoftGraceful) + +Note that the job returned from this function is not much usable because +when system is shutting down, the CIMOM is terminated as well. |