blob: 3327128dffec9791ff774fac5366b34dc57785f6 [file] [log] [blame]
Dean Troyer54b97322014-06-20 17:53:55 -05001<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <title>DevStack - Plugins</title>
6 <meta name="description" content="">
7 <meta name="author" content="">
8
9 <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
10 <!--[if lt IE 9]>
11 <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
12 <![endif]-->
13
14 <!-- Le styles -->
15 <link href="assets/css/bootstrap.css" rel="stylesheet">
16 <link href="assets/css/local.css" rel="stylesheet">
17 <style type="text/css">
18 body { padding-top: 60px; }
19 dd { padding: 10px; }
20 </style>
21
22 <!-- Le javascripts -->
23 <script src="assets/js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
24 <script src="assets/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
25 </head>
26
27 <body>
28
29 <div class="navbar navbar-fixed-top">
30 <div class="navbar-inner">
31 <div class="container">
32 <a class="brand" href="/">DevStack</a>
33 <ul class="nav pull-right">
34 <li><a href="overview.html">Overview</a></li>
35 <li><a href="changes.html">Changes</a></li>
36 <li><a href="faq.html">FAQ</a></li>
37 <li><a href="http://github.com/openstack-dev/devstack">GitHub</a></li>
38 <li><a href="https://review.openstack.org/#/q/status:open+project:openstack-dev/devstack,n,z">Gerrit</a></li>
39 </ul>
40 </div>
41 </div>
42 </div>
43
44 <div class="container" id="home">
45
46 <section id="faq" class="span12">
47
48 <div class='row pull-left'>
49 <h2>Plugins <small>Add stuff</small></h2>
50 <p>DevStack has a couple of plugin mechanisms to allow easily adding support for additional projects and features.</p>
51
52 <h3>Extras.d Hooks</h3>
53 <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>
54
55 <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>
56
57 <p>Below is a template that shows handlers for the possible command-line arguments:</p>
58
59<pre>
60# template.sh - DevStack extras.d dispatch script template
61
62# check for service enabled
63if is_service_enabled template; then
64
65 if [[ "$1" == "source" ]]; then
66 # Initial source of lib script
67 source $TOP_DIR/lib/template
68 fi
69
Dean Troyer1c425992014-07-28 17:51:13 -050070 if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
71 # Set up system services
72 echo_summary "Configuring system services Template"
73 install_package cowsay
74
75 elif [[ "$1" == "stack" && "$2" == "install" ]]; then
Dean Troyer54b97322014-06-20 17:53:55 -050076 # Perform installation of service source
77 echo_summary "Installing Template"
78 install_template
79
80 elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
81 # Configure after the other layer 1 and 2 services have been configured
82 echo_summary "Configuring Template"
83 configure_template
84
85 elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
86 # Initialize and start the template service
87 echo_summary "Initializing Template"
88 ##init_template
89 fi
90
91 if [[ "$1" == "unstack" ]]; then
92 # Shut down template services
93 # no-op
94 :
95 fi
96
97 if [[ "$1" == "clean" ]]; then
98 # Remove state and transient data
99 # Remember clean.sh first calls unstack.sh
100 # no-op
101 :
102 fi
103fi
104</pre>
105
106 <p>The arguments are:
107 <ul>
108 <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>
109 <li><strong>stack</strong> - Called by <code>stack.sh</code> three times for different phases of its run:
110 <ul>
Dean Troyer1c425992014-07-28 17:51:13 -0500111 <li><strong>pre-install</strong> - Called after system (OS) setup is complete and before project source is installed.</li>
Dean Troyer54b97322014-06-20 17:53:55 -0500112 <li><strong>install</strong> - Called after the layer 1 and 2 projects source and their dependencies have been installed.</li>
113 <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>
114 <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>
115 </ul></li>
116 <li><strong>unstack</strong> - Called by <code>unstack.sh</code> before other services are shut down.</li>
117 <li><strong>clean</strong> - Called by <code>clean.sh</code> before other services are cleaned, but after <code>unstack.sh</code> has been called.
118 </ul></p>
119
120
121 <h3>Hypervisor</h3>
122 <p>Hypervisor plugins are fairly new and condense most hypervisor configuration into one place.</p>
123
124 <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>
125 <ul>
126 <li><code>install_nova_hypervisor</code> - install any external requirements</li>
127 <li><code>configure_nova_hypervisor</code> - make configuration changes, including those to other services</li>
128 <li><code>start_nova_hypervisor</code> - start any external services</li>
129 <li><code>stop_nova_hypervisor</code> - stop any external services</li>
130 <li><code>cleanup_nova_hypervisor</code> - remove transient data and cache</li>
131 </ul>
132 </div>
133
134 </section>
135
136 <footer>
137 <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>
138 </footer>
139
140 </div> <!-- /container -->
141 </body>
142</html>