devstack/doc/source/plugins.html
Adrien Cunin eaff3e1b8c Reference git.o.o DevStack repo rather than GitHub
In docs, use git.o.o URLs rather than GitHub URLs for the DevStack repo,
and don't mention GitHub when git.o.o is more appropriate.
Also, replaced GitHub logo with Git logo in quickstart.png.

Change-Id: Iab0006144f008963b8cb5be2d10ce0f360c0e6ca
2014-10-21 13:52:24 +02:00

143 lines
6.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DevStack - Plugins</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le styles -->
<link href="assets/css/bootstrap.css" rel="stylesheet">
<link href="assets/css/local.css" rel="stylesheet">
<style type="text/css">
body { padding-top: 60px; }
dd { padding: 10px; }
</style>
<!-- Le javascripts -->
<script src="assets/js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="/">DevStack</a>
<ul class="nav pull-right">
<li><a href="overview.html">Overview</a></li>
<li><a href="changes.html">Changes</a></li>
<li><a href="faq.html">FAQ</a></li>
<li><a href="https://git.openstack.org/cgit/openstack-dev/devstack">git.openstack.org</a></li>
<li><a href="https://review.openstack.org/#/q/status:open+project:openstack-dev/devstack,n,z">Gerrit</a></li>
</ul>
</div>
</div>
</div>
<div class="container" id="home">
<section id="faq" class="span12">
<div class='row pull-left'>
<h2>Plugins <small>Add stuff</small></h2>
<p>DevStack has a couple of plugin mechanisms to allow easily adding support for additional projects and features.</p>
<h3>Extras.d Hooks</h3>
<p>These relatively new hooks are an extension of the existing calls from <code>stack.sh</code> at the end of its run, plus <code>unstack.sh</code> and <code>clean.sh</code>. A number of the higher-layer projects are implemented in DevStack using this mechanism.</p>
<p>The script in <code>extras.d</code> is expected to be mostly a dispatcher to functions in a <code>lib/*</code> script. The scripts are named with a zero-padded two digits sequence number prefix to control the order that the scripts are called, and with a suffix of <code>.sh</code>. DevSack reserves for itself the sequence numbers 00 through 09 and 90 through 99.</p>
<p>Below is a template that shows handlers for the possible command-line arguments:</p>
<pre>
# template.sh - DevStack extras.d dispatch script template
# check for service enabled
if is_service_enabled template; then
if [[ "$1" == "source" ]]; then
# Initial source of lib script
source $TOP_DIR/lib/template
fi
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
# Set up system services
echo_summary "Configuring system services Template"
install_package cowsay
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
# Perform installation of service source
echo_summary "Installing Template"
install_template
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured
echo_summary "Configuring Template"
configure_template
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize and start the template service
echo_summary "Initializing Template"
##init_template
fi
if [[ "$1" == "unstack" ]]; then
# Shut down template services
# no-op
:
fi
if [[ "$1" == "clean" ]]; then
# Remove state and transient data
# Remember clean.sh first calls unstack.sh
# no-op
:
fi
fi
</pre>
<p>The arguments are:
<ul>
<li><strong>source</strong> - Called by each script that utilizes <code>extras.d</code> hooks; this replaces directly sourcing the <code>lib/*</code> script.</li>
<li><strong>stack</strong> - Called by <code>stack.sh</code> three times for different phases of its run:
<ul>
<li><strong>pre-install</strong> - Called after system (OS) setup is complete and before project source is installed.</li>
<li><strong>install</strong> - Called after the layer 1 and 2 projects source and their dependencies have been installed.</li>
<li><strong>post-config</strong> - Called after the layer 1 and 2 services have been configured. All configuration files for enabled services should exist at this point.</li>
<li><strong>extra</strong> - Called near the end after layer 1 and 2 services have been started. This is the existing hook and has not otherwise changed.</li>
</ul></li>
<li><strong>unstack</strong> - Called by <code>unstack.sh</code> before other services are shut down.</li>
<li><strong>clean</strong> - Called by <code>clean.sh</code> before other services are cleaned, but after <code>unstack.sh</code> has been called.
</ul></p>
<h3>Hypervisor</h3>
<p>Hypervisor plugins are fairly new and condense most hypervisor configuration into one place.</p>
<p>The initial plugin implemented was for Docker support and is a useful template for the required support. Plugins are placed in <code>lib/nova_plugins</code> and named <code>hypervisor-&lt;name&gt;</code> where <code>&lt;name&gt;</code> is the value of <code>VIRT_DRIVER</code>. Plugins must define the following functions:</p>
<ul>
<li><code>install_nova_hypervisor</code> - install any external requirements</li>
<li><code>configure_nova_hypervisor</code> - make configuration changes, including those to other services</li>
<li><code>start_nova_hypervisor</code> - start any external services</li>
<li><code>stop_nova_hypervisor</code> - stop any external services</li>
<li><code>cleanup_nova_hypervisor</code> - remove transient data and cache</li>
</ul>
</div>
</section>
<footer>
<p>&copy; Openstack Foundation 2011-2013 &mdash; An <a href="https://wiki.openstack.org/wiki/Programs">OpenStack program</a> created by <a href="http://www.rackspace.com/cloud/private_edition/">Rackspace Cloud Builders</a></p>
</footer>
</div> <!-- /container -->
</body>
</html>