Dean Troyer | 54b9732 | 2014-06-20 17:53:55 -0500 | [diff] [blame] | 1 | <!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 |
| 63 | if 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 | |
| 70 | if [[ "$1" == "stack" && "$2" == "install" ]]; then |
| 71 | # Perform installation of service source |
| 72 | echo_summary "Installing Template" |
| 73 | install_template |
| 74 | |
| 75 | elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then |
| 76 | # Configure after the other layer 1 and 2 services have been configured |
| 77 | echo_summary "Configuring Template" |
| 78 | configure_template |
| 79 | |
| 80 | elif [[ "$1" == "stack" && "$2" == "extra" ]]; then |
| 81 | # Initialize and start the template service |
| 82 | echo_summary "Initializing Template" |
| 83 | ##init_template |
| 84 | fi |
| 85 | |
| 86 | if [[ "$1" == "unstack" ]]; then |
| 87 | # Shut down template services |
| 88 | # no-op |
| 89 | : |
| 90 | fi |
| 91 | |
| 92 | if [[ "$1" == "clean" ]]; then |
| 93 | # Remove state and transient data |
| 94 | # Remember clean.sh first calls unstack.sh |
| 95 | # no-op |
| 96 | : |
| 97 | fi |
| 98 | fi |
| 99 | </pre> |
| 100 | |
| 101 | <p>The arguments are: |
| 102 | <ul> |
| 103 | <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> |
| 104 | <li><strong>stack</strong> - Called by <code>stack.sh</code> three times for different phases of its run: |
| 105 | <ul> |
| 106 | <li><strong>install</strong> - Called after the layer 1 and 2 projects source and their dependencies have been installed.</li> |
| 107 | <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> |
| 108 | <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> |
| 109 | </ul></li> |
| 110 | <li><strong>unstack</strong> - Called by <code>unstack.sh</code> before other services are shut down.</li> |
| 111 | <li><strong>clean</strong> - Called by <code>clean.sh</code> before other services are cleaned, but after <code>unstack.sh</code> has been called. |
| 112 | </ul></p> |
| 113 | |
| 114 | |
| 115 | <h3>Hypervisor</h3> |
| 116 | <p>Hypervisor plugins are fairly new and condense most hypervisor configuration into one place.</p> |
| 117 | |
| 118 | <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-<name></code> where <code><name></code> is the value of <code>VIRT_DRIVER</code>. Plugins must define the following functions:</p> |
| 119 | <ul> |
| 120 | <li><code>install_nova_hypervisor</code> - install any external requirements</li> |
| 121 | <li><code>configure_nova_hypervisor</code> - make configuration changes, including those to other services</li> |
| 122 | <li><code>start_nova_hypervisor</code> - start any external services</li> |
| 123 | <li><code>stop_nova_hypervisor</code> - stop any external services</li> |
| 124 | <li><code>cleanup_nova_hypervisor</code> - remove transient data and cache</li> |
| 125 | </ul> |
| 126 | </div> |
| 127 | |
| 128 | </section> |
| 129 | |
| 130 | <footer> |
| 131 | <p>© Openstack Foundation 2011-2013 — 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> |
| 132 | </footer> |
| 133 | |
| 134 | </div> <!-- /container --> |
| 135 | </body> |
| 136 | </html> |