Merge "Support Router Advertisement Daemon (radvd) for IPv6"
diff --git a/clean.sh b/clean.sh
index e2374e7..db1a1e4 100755
--- a/clean.sh
+++ b/clean.sh
@@ -84,7 +84,6 @@
fi
# Clean projects
-cleanup_oslo
cleanup_cinder
cleanup_glance
cleanup_keystone
diff --git a/docs/source/assets/images/quickstart.png b/docs/source/assets/images/quickstart.png
index 5f01bac..5400a6f 100644
--- a/docs/source/assets/images/quickstart.png
+++ b/docs/source/assets/images/quickstart.png
Binary files differ
diff --git a/docs/source/configuration.html b/docs/source/configuration.html
index c26aee4..fbcead7 100644
--- a/docs/source/configuration.html
+++ b/docs/source/configuration.html
@@ -58,7 +58,7 @@
<h3>local.conf</h3>
<p>The new configuration file is <code>local.conf</code> and resides in the root DevStack directory like the old <code>localrc</code> file. It is a modified INI format file that introduces a meta-section header to carry additional information regarding the configuration files to be changed.</p>
- <p>The new header is similar to a normal INI section header but with two '[[ ]]' chars and two internal fields separated by a pipe ('|'):</p>
+ <p>The new header is similar to a normal INI section header but with double brackets (<code>[[ ... ]]</code>) and two internal fields separated by a pipe (<code>|</code>):</p>
<pre>[[ <phase> | <config-file-name> ]]
</pre>
@@ -67,6 +67,8 @@
<p>The defined phases are:</p>
<ul>
<li><strong>local</strong> - extracts <code>localrc</code> from <code>local.conf</code> before <code>stackrc</code> is sourced</li>
+ <li><strong>pre-install</strong> - runs after the system packages are installed but before any of the source repositories are installed</li>
+ <li><strong>install</strong> - runs immediately after the repo installations are complete</li>
<li><strong>post-config</strong> - runs after the layer 2 services are configured and before they are started</li>
<li><strong>extra</strong> - runs after services are started and before any files in <code>extra.d</code> are executed
</ul>
@@ -96,7 +98,7 @@
<pre>[[post-config|/$Q_PLUGIN_CONF_FILE]]
</pre>
- <p>The existing ``EXTRAS_OPTS`` and similar variables are now deprecated. If used a warning will be printed at the end of the <code>stack.sh</code> run.</p>
+ <p>Also note that the <code>localrc</code> section is sourced as a shell script fragment amd <string>MUST</strong> conform to the shell requirements, specifically no whitespace around <code>=</code> (equals).</p>
<a id="minimal"></a>
<h3>Minimal Configuration</h3>
@@ -205,14 +207,6 @@
<h3>Examples</h3>
<ul>
- <li>Convert EXTRA_OPTS from (<code>localrc</code>):
-<pre>EXTRA_OPTS=api_rate_limit=False
-</pre>
- to (<code>local.conf</code>):
-<pre>[[post-config|$NOVA_CONF]]
-[DEFAULT]
-api_rate_limit = False
-</pre></li>
<li>Eliminate a Cinder pass-through (<code>CINDER_PERIODIC_INTERVAL</code>):
<pre>[[post-config|$CINDER_CONF]]
[DEFAULT]
diff --git a/docs/source/contributing.html b/docs/source/contributing.html
index 8dbd179..f3d4b5a 100644
--- a/docs/source/contributing.html
+++ b/docs/source/contributing.html
@@ -59,20 +59,21 @@
<br /><strong>HACKING.rst</strong>
<p>Like most OpenStack projects, DevStack includes a <code>HACKING.rst</code> file that describes the layout, style and conventions of the project. Because <code>HACKING.rst</code> is in the main DevStack repo it is considered authoritative. Much of the content on this page is taken from there.</p>
- <br /><strong>bash8 Formatting</strong>
- <p>Around the time of the OpenStack Havana release we added a tool to do style checking in DevStack similar to what pep8/flake8 do for Python projects. It is still _very_ simplistic, focusing mostly on stray whitespace to help prevent -1 on reviews that are otherwise acceptable. Oddly enough it is called <code>bash8</code>. It will be expanded to enforce some of the documentation rules in comments that are used in formatting the script pages for devstack.org and possibly even simple code formatting. Run it on the entire project with <code>./run_tests.sh</code>.</p>
+ <br /><strong>bashate Formatting</strong>
+ <p>Around the time of the OpenStack Havana release we added a tool to do style checking in DevStack similar to what pep8/flake8 do for Python projects. It is still _very_ simplistic, focusing mostly on stray whitespace to help prevent -1 on reviews that are otherwise acceptable. Oddly enough it is called <code>bashate</code>. It will be expanded to enforce some of the documentation rules in comments that are used in formatting the script pages for devstack.org and possibly even simple code formatting. Run it on the entire project with <code>./run_tests.sh</code>.</p>
<h3>Code</h3>
<br /><strong>Repo Layout</strong>
<p>The DevStack repo generally keeps all of the primary scripts at the root level.</p>
- <p><code>exercises</code> - contains the test scripts used to validate and demonstrate some OpenStack functions. These scripts know how to exit early or skip services that are not enabled.</p>
- <p><code>extras.d</code> - contains the dispatch scripts called by the hooks in <code>stack.sh</code>, <code>unstack.sh</code> and <code>clean.sh</code>. See <a href="plugins.html">the plugins docs</a> for more information.</p>
- <p><code>files</code> - contains a variety of otherwise lost files used in configuring and operating DevStack. This includes templates for configuration files and the system dependency information. This is also where image files are downloaded and expanded if necessary.</p>
- <p><code>lib</code> - contains the sub-scripts specific to each project. This is where the work of managing a project's services is located. Each top-level project (Keystone, Nova, etc) has a file here. Additionally there are some for system services and project plugins.</p>
- <p><code>samples</code> - contains a sample of the local files not included in the DevStack repo.</p>
+ <p><code>docs</code> - Contains the source for this website. It is built using <code>tools/build_docs.sh</code>.</p>
+ <p><code>exercises</code> - Contains the test scripts used to validate and demonstrate some OpenStack functions. These scripts know how to exit early or skip services that are not enabled.</p>
+ <p><code>extras.d</code> - Contains the dispatch scripts called by the hooks in <code>stack.sh</code>, <code>unstack.sh</code> and <code>clean.sh</code>. See <a href="plugins.html">the plugins docs</a> for more information.</p>
+ <p><code>files</code> - Contains a variety of otherwise lost files used in configuring and operating DevStack. This includes templates for configuration files and the system dependency information. This is also where image files are downloaded and expanded if necessary.</p>
+ <p><code>lib</code> - Contains the sub-scripts specific to each project. This is where the work of managing a project's services is located. Each top-level project (Keystone, Nova, etc) has a file here. Additionally there are some for system services and project plugins.</p>
+ <p><code>samples</code> - Contains a sample of the local files not included in the DevStack repo.</p>
<p><code>tests</code> - the DevStack test suite is rather sparse, mostly consisting of test of specific fragile functions in the <code>functions</code> file.</p>
- <p><code>tools</code> - contains a collection of stand-alone scripts, some of which have aged a bit (does anyone still do pamdisk installs?). While these may reference the top-level DevStack configuration they can generally be run alone. There are also some sub-directories to support specific environments such as XenServer and Docker.</p>
+ <p><code>tools</code> - Contains a collection of stand-alone scripts, some of which have aged a bit (does anyone still do ramdisk installs?). While these may reference the top-level DevStack configuration they can generally be run alone. There are also some sub-directories to support specific environments such as XenServer.</p>
diff --git a/docs/source/guides/multinode-lab.html b/docs/source/guides/multinode-lab.html
index 28a6585..2e52379 100644
--- a/docs/source/guides/multinode-lab.html
+++ b/docs/source/guides/multinode-lab.html
@@ -54,7 +54,7 @@
</div>
<h3>Minimal Install</h3>
- <p>You need to have a fresh install of Linux on all of your nodes. You can download the <a href="https://help.ubuntu.com/community/Installation/MinimalCD">Minimal CD</a> for Ubuntu 12.04 (only 27MB) since DevStack will download & install all the additional dependencies. The netinstall ISO is available for <a href="http://mirrors.kernel.org/fedora/releases/20/Fedora/x86_64/iso/Fedora-20-x86_64-netinst.iso">Fedora</a> and <a href="http://mirrors.kernel.org/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-netinstall.iso">CentOS/RHEL</a>.</p>
+ <p>You need to have a system with a fresh install of Linux. You can download the <a href="https://help.ubuntu.com/community/Installation/MinimalCD">Minimal CD</a> for Ubuntu releases since DevStack will download & install all the additional dependencies. The netinstall ISO is available for <a href="http://mirrors.kernel.org/fedora/releases/18/Fedora/x86_64/iso/Fedora-20-x86_64-netinst.iso">Fedora</a> and <a href="http://mirrors.kernel.org/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-netinstall.iso">CentOS/RHEL</a>.</p>
<p>Install a couple of packages to bootstrap configuration:</p>
<pre>apt-get install -y git sudo || yum install -y git sudo</pre>
diff --git a/docs/source/guides/single-machine.html b/docs/source/guides/single-machine.html
index 2280793..ca9cafa 100644
--- a/docs/source/guides/single-machine.html
+++ b/docs/source/guides/single-machine.html
@@ -53,7 +53,7 @@
</div>
<h3>Minimal Install</h3>
- <p>You need to have a system with a fresh install of Linux. You can download the <a href="https://help.ubuntu.com/community/Installation/MinimalCD">Minimal CD</a> for Ubuntu 12.04 (only 27MB) since DevStack will download & install all the additional dependencies. The netinstall ISO is available for <a href="http://mirrors.kernel.org/fedora/releases/18/Fedora/x86_64/iso/Fedora-18-x86_64-netinst.iso">Fedora</a> and <a href="http://mirrors.kernel.org/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-netinstall.iso">CentOS/RHEL</a>. You may be tempted to use a desktop distro on a laptop, it will probably work but you may need to tell Network Manager to keep its fingers off the interface(s) that OpenStack uses for bridging.</p>
+ <p>You need to have a system with a fresh install of Linux. You can download the <a href="https://help.ubuntu.com/community/Installation/MinimalCD">Minimal CD</a> for Ubuntu releases since DevStack will download & install all the additional dependencies. The netinstall ISO is available for <a href="http://mirrors.kernel.org/fedora/releases/18/Fedora/x86_64/iso/Fedora-20-x86_64-netinst.iso">Fedora</a> and <a href="http://mirrors.kernel.org/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-netinstall.iso">CentOS/RHEL</a>. You may be tempted to use a desktop distro on a laptop, it will probably work but you may need to tell Network Manager to keep its fingers off the interface(s) that OpenStack uses for bridging.</p>
<h3>Network Configuration</h3>
<p>Determine the network configuration on the interface used to integrate your
diff --git a/docs/source/index.html b/docs/source/index.html
index 71c8c98..1a31df1 100644
--- a/docs/source/index.html
+++ b/docs/source/index.html
@@ -76,7 +76,7 @@
<ol>
<li value="0">
<h3>Select a Linux Distribution</h3>
- <p>Only Ubuntu 12.04 (Precise), Fedora 20 and CentOS/RHEL 6.5 are documented here. OpenStack also runs and is packaged on other flavors of Linux such as OpenSUSE and Debian.</p>
+ <p>Only Ubuntu 14.04 (Trusty), Fedora 20 and CentOS/RHEL 6.5 are documented here. OpenStack also runs and is packaged on other flavors of Linux such as OpenSUSE and Debian.</p>
</li>
<li>
<h3>Install Selected OS</h3>
@@ -89,7 +89,7 @@
</li>
<li>
<h3>Configure</h3>
- <p>While optional, we recommend a <a href="configuration.html">minimal configuration</a> be set up as you may not want our default values for everything.</p>
+ <p>We recommend at least a <a href="configuration.html">minimal configuration</a> be set up.</p>
</li>
<li>
<h3>Start the install</h3>
@@ -231,6 +231,10 @@
<td><a href="functions.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
<tr>
+ <td>functions-common</td>
+ <td><a href="functions-common.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <tr>
<td>lib/apache</td>
<td><a href="lib/apache.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
@@ -303,12 +307,12 @@
<td><a href="lib/rpc_backend.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
<tr>
- <td>lib/savanna</td>
- <td><a href="lib/savanna.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ <td>lib/sahara</td>
+ <td><a href="lib/sahara.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
<tr>
- <td>lib/savanna-dashboard</td>
- <td><a href="lib/savanna-dashboard.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ <td>lib/savanna</td>
+ <td><a href="lib/savanna.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
<tr>
<td>lib/stackforge</td>
@@ -343,49 +347,34 @@
<td><a href="run_tests.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
<tr>
+ <td>extras.d/50-ironic.sh</td>
+ <td><a href="extras.d/50-ironic.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <tr>
<td>extras.d/70-marconi.sh</td>
<td><a href="extras.d/70-marconi.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
<tr>
+ <td>extras.d/70-sahara.sh</td>
+ <td><a href="extras.d/70-sahara.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <tr>
<td>extras.d/70-savanna.sh</td>
<td><a href="extras.d/70-savanna.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
<tr>
+ <td>extras.d/70-trove.sh</td>
+ <td><a href="extras.d/70-trove.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <tr>
+ <td>extras.d/80-opendaylight.sh</td>
+ <td><a href="extras.d/80-opendaylight.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <tr>
<td>extras.d/80-tempest.sh</td>
<td><a href="extras.d/80-tempest.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
- <tr>
- <td>tools/info.sh</td>
- <td><a href="tools/info.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
- </tr>
- <tr>
- <td>tools/build_docs.sh</td>
- <td><a href="tools/build_docs.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
- </tr>
- <tr>
- <td>tools/create_userrc.sh</td>
- <td><a href="tools/create_userrc.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
- </tr>
- <tr>
- <td>tools/fixup_stuff.sh</td>
- <td><a href="tools/fixup_stuff.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
- </tr>
- <tr>
- <td>tools/install_prereqs.sh</td>
- <td><a href="tools/install_prereqs.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
- </tr>
- <tr>
- <td>tools/install_pip.sh</td>
- <td><a href="tools/install_pip.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
- </tr>
- <tr>
- <td>tools/upload_image.sh</td>
- <td><a href="tools/upload_image.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
- </tr>
</tbody>
- <tfoot>
- <td colspan="3">40 bash scripts</td>
- </tfoot>
</table>
</div>
@@ -420,9 +409,46 @@
<td><a href="eucarc.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
</tbody>
- <tfoot>
- <td colspan="3">5 configuration files</td>
- </tfoot>
+ </table>
+
+ <h2>Tools <small>Support scripts</small></h2>
+ <table class='table table-striped table-bordered'>
+ <thead>
+ <tr>
+ <th>Filename</th>
+ <th>Link</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>tools/info.sh</td>
+ <td><a href="tools/info.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <tr>
+ <td>tools/build_docs.sh</td>
+ <td><a href="tools/build_docs.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <tr>
+ <td>tools/create_userrc.sh</td>
+ <td><a href="tools/create_userrc.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <tr>
+ <td>tools/fixup_stuff.sh</td>
+ <td><a href="tools/fixup_stuff.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <tr>
+ <td>tools/install_prereqs.sh</td>
+ <td><a href="tools/install_prereqs.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <tr>
+ <td>tools/install_pip.sh</td>
+ <td><a href="tools/install_pip.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <tr>
+ <td>tools/upload_image.sh</td>
+ <td><a href="tools/upload_image.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ </tbody>
</table>
<h2>Samples <small>Generated documentation of DevStack sample files.</small></h2>
@@ -443,9 +469,6 @@
<td><a href="samples/localrc.html" class="btn btn-small btn-success table-action">Read »</a></td>
</tr>
</tbody>
- <tfoot>
- <td colspan="3">2 sample files</td>
- </tfoot>
</table>
<div class='row span5 pull-right'>
@@ -494,10 +517,19 @@
<td>exercises/horizon.sh</td>
<td><a href="exercises/horizon.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
+ <td>exercises/marconi.sh</td>
+ <td><a href="exercises/marconi.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
<tr>
<td>exercises/neutron-adv-test.sh</td>
<td><a href="exercises/neutron-adv-test.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
+ <td>exercises/sahara.sh</td>
+ <td><a href="exercises/sahara.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
+ <td>exercises/savanna.sh</td>
+ <td><a href="exercises/savanna.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
<tr>
<td>exercises/sec_groups.sh</td>
<td><a href="exercises/sec_groups.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
@@ -506,14 +538,14 @@
<td>exercises/swift.sh</td>
<td><a href="exercises/swift.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
+ <td>exercises/trove.sh</td>
+ <td><a href="exercises/trove.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
+ </tr>
<tr>
<td>exercises/volumes.sh</td>
<td><a href="exercises/volumes.sh.html" class="btn btn-small btn-primary table-action">Read »</a></td>
</tr>
</tbody>
- <tfoot>
- <td colspan="3">13 exercise scripts</td>
- </tfoot>
</table>
</div>
diff --git a/docs/source/overview.html b/docs/source/overview.html
index c0b6ea2..baee400 100644
--- a/docs/source/overview.html
+++ b/docs/source/overview.html
@@ -47,8 +47,8 @@
<div class='row pull-left'>
<h2>Overview <small>DevStack from a cloud-height view</small></h2>
- <p>DevStack is not and has never been intended to be a general OpenStack installer. It has evolved to support a large number of configuration options and alternative platforms and support services. However, that evolution has grown well beyond what was originally intended and the majority of configuration combinations are rarely, if ever, tested. DevStack was never meant to be everything to everyone and can not continue in that direction.</p>
- <p>Below is a list of what is specifically is supported (read that as "tested and assumed to work") going forward.</p>
+ <p>DevStack has evolved to support a large number of configuration options and alternative platforms and support services. That evolution has grown well beyond what was originally intended and the majority of configuration combinations are rarely, if ever, tested. DevStack is not a general OpenStack installer and was never meant to be everything to everyone..</p>
+ <p>Below is a list of what is specifically is supported (read that as "tested") going forward.</p>
<h2>Supported Components</h2>
@@ -93,7 +93,7 @@
</ul>
<h3>Services</h3>
- <p>The default services configured by DevStack are Identity (Keystone), Object Storage (Swift), Image Storage (Glance), Block Storage (Cinder), Compute (Nova), Network (Nova), Dashboard (Horizon)</p>
+ <p>The default services configured by DevStack are Identity (Keystone), Object Storage (Swift), Image Storage (Glance), Block Storage (Cinder), Compute (Nova), Network (Nova), Dashboard (Horizon), Orchestration (Heat)</p>
<p>Additional services not included directly in DevStack can be tied in to <code>stack.sh</code> using the <a href="plugins.html">plugin mechanism</a> to call scripts that perform the configuration and startup of the service.</p>
<h3>Node Configurations</h3>
@@ -103,7 +103,7 @@
</ul>
<h3>Exercises</h3>
- <p>The DevStack exercise scripts have been replaced as integration and gating test with Tempest. They will continue to be maintained as they are valuable as demonstrations of using OpenStack from the command line and for quick operational testing.</p>
+ <p>The DevStack exercise scripts are no longer used as integration and gate testing as that job has transitioned to Tempest. They are still maintained as a demonstrations of using OpenStack from the command line and for quick operational testing.</p>
</div>
diff --git a/docs/source/plugins.html b/docs/source/plugins.html
index 85cf8e4..3327128 100644
--- a/docs/source/plugins.html
+++ b/docs/source/plugins.html
@@ -67,7 +67,12 @@
source $TOP_DIR/lib/template
fi
- if [[ "$1" == "stack" && "$2" == "install" ]]; then
+ 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
@@ -103,6 +108,7 @@
<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>
diff --git a/files/apts/general b/files/apts/general
index d65cab3..739fc47 100644
--- a/files/apts/general
+++ b/files/apts/general
@@ -25,3 +25,4 @@
bc
libyaml-dev
libffi-dev
+libssl-dev # for pyOpenSSL
diff --git a/functions b/functions
index cd9e078..1fa6346 100644
--- a/functions
+++ b/functions
@@ -55,26 +55,28 @@
local image_url=$1
local token=$2
+ local image image_fname image_name
+
# Create a directory for the downloaded image tarballs.
mkdir -p $FILES/images
- IMAGE_FNAME=`basename "$image_url"`
+ image_fname=`basename "$image_url"`
if [[ $image_url != file* ]]; then
# Downloads the image (uec ami+akistyle), then extracts it.
- if [[ ! -f $FILES/$IMAGE_FNAME || "$(stat -c "%s" $FILES/$IMAGE_FNAME)" = "0" ]]; then
- wget -c $image_url -O $FILES/$IMAGE_FNAME
+ if [[ ! -f $FILES/$image_fname || "$(stat -c "%s" $FILES/$image_fname)" = "0" ]]; then
+ wget -c $image_url -O $FILES/$image_fname
if [[ $? -ne 0 ]]; then
echo "Not found: $image_url"
return
fi
fi
- IMAGE="$FILES/${IMAGE_FNAME}"
+ image="$FILES/${image_fname}"
else
# File based URL (RFC 1738): file://host/path
# Remote files are not considered here.
# *nix: file:///home/user/path/file
# windows: file:///C:/Documents%20and%20Settings/user/path/file
- IMAGE=$(echo $image_url | sed "s/^file:\/\///g")
- if [[ ! -f $IMAGE || "$(stat -c "%s" $IMAGE)" == "0" ]]; then
+ image=$(echo $image_url | sed "s/^file:\/\///g")
+ if [[ ! -f $image || "$(stat -c "%s" $image)" == "0" ]]; then
echo "Not found: $image_url"
return
fi
@@ -82,14 +84,14 @@
# OpenVZ-format images are provided as .tar.gz, but not decompressed prior to loading
if [[ "$image_url" =~ 'openvz' ]]; then
- IMAGE_NAME="${IMAGE_FNAME%.tar.gz}"
- glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format ami --disk-format ami < "${IMAGE}"
+ image_name="${image_fname%.tar.gz}"
+ glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name" --is-public=True --container-format ami --disk-format ami < "${image}"
return
fi
# vmdk format images
if [[ "$image_url" =~ '.vmdk' ]]; then
- IMAGE_NAME="${IMAGE_FNAME%.vmdk}"
+ image_name="${image_fname%.vmdk}"
# Before we can upload vmdk type images to glance, we need to know it's
# disk type, storage adapter, and networking adapter. These values are
@@ -102,17 +104,17 @@
# If the filename does not follow the above format then the vsphere
# driver will supply default values.
- vmdk_adapter_type=""
- vmdk_disktype=""
- vmdk_net_adapter=""
+ local vmdk_disktype=""
+ local vmdk_net_adapter=""
+ local path_len
# vmdk adapter type
- vmdk_adapter_type="$(head -25 $IMAGE | { grep -a -F -m 1 'ddb.adapterType =' $IMAGE || true; })"
+ local vmdk_adapter_type="$(head -25 $image | { grep -a -F -m 1 'ddb.adapterType =' $image || true; })"
vmdk_adapter_type="${vmdk_adapter_type#*\"}"
vmdk_adapter_type="${vmdk_adapter_type%?}"
# vmdk disk type
- vmdk_create_type="$(head -25 $IMAGE | { grep -a -F -m 1 'createType=' $IMAGE || true; })"
+ local vmdk_create_type="$(head -25 $image | { grep -a -F -m 1 'createType=' $image || true; })"
vmdk_create_type="${vmdk_create_type#*\"}"
vmdk_create_type="${vmdk_create_type%\"*}"
@@ -120,17 +122,16 @@
`"should use a descriptor-data pair."
if [[ "$vmdk_create_type" = "monolithicSparse" ]]; then
vmdk_disktype="sparse"
- elif [[ "$vmdk_create_type" = "monolithicFlat" || \
- "$vmdk_create_type" = "vmfs" ]]; then
+ elif [[ "$vmdk_create_type" = "monolithicFlat" || "$vmdk_create_type" = "vmfs" ]]; then
# Attempt to retrieve the *-flat.vmdk
- flat_fname="$(head -25 $IMAGE | { grep -G 'RW\|RDONLY [0-9]+ FLAT\|VMFS' $IMAGE || true; })"
+ local flat_fname="$(head -25 $image | { grep -G 'RW\|RDONLY [0-9]+ FLAT\|VMFS' $image || true; })"
flat_fname="${flat_fname#*\"}"
flat_fname="${flat_fname%?}"
if [[ -z "$flat_fname" ]]; then
- flat_fname="$IMAGE_NAME-flat.vmdk"
+ flat_fname="$image_name-flat.vmdk"
fi
- path_len=`expr ${#image_url} - ${#IMAGE_FNAME}`
- flat_url="${image_url:0:$path_len}$flat_fname"
+ path_len=`expr ${#image_url} - ${#image_fname}`
+ local flat_url="${image_url:0:$path_len}$flat_fname"
warn $LINENO "$descriptor_data_pair_msg"`
`" Attempt to retrieve the *-flat.vmdk: $flat_url"
if [[ $flat_url != file* ]]; then
@@ -138,29 +139,29 @@
"$(stat -c "%s" $FILES/$flat_fname)" = "0" ]]; then
wget -c $flat_url -O $FILES/$flat_fname
fi
- IMAGE="$FILES/${flat_fname}"
+ image="$FILES/${flat_fname}"
else
- IMAGE=$(echo $flat_url | sed "s/^file:\/\///g")
- if [[ ! -f $IMAGE || "$(stat -c "%s" $IMAGE)" == "0" ]]; then
+ image=$(echo $flat_url | sed "s/^file:\/\///g")
+ if [[ ! -f $image || "$(stat -c "%s" $image)" == "0" ]]; then
echo "Flat disk not found: $flat_url"
return 1
fi
fi
- IMAGE_NAME="${flat_fname}"
+ image_name="${flat_fname}"
vmdk_disktype="preallocated"
elif [[ "$vmdk_create_type" = "streamOptimized" ]]; then
vmdk_disktype="streamOptimized"
elif [[ -z "$vmdk_create_type" ]]; then
# *-flat.vmdk provided: attempt to retrieve the descriptor (*.vmdk)
# to retrieve appropriate metadata
- if [[ ${IMAGE_NAME: -5} != "-flat" ]]; then
+ if [[ ${image_name: -5} != "-flat" ]]; then
warn $LINENO "Expected filename suffix: '-flat'."`
- `" Filename provided: ${IMAGE_NAME}"
+ `" Filename provided: ${image_name}"
else
- descriptor_fname="${IMAGE_NAME:0:${#IMAGE_NAME} - 5}.vmdk"
- path_len=`expr ${#image_url} - ${#IMAGE_FNAME}`
- flat_path="${image_url:0:$path_len}"
- descriptor_url=$flat_path$descriptor_fname
+ descriptor_fname="${image_name:0:${#image_name} - 5}.vmdk"
+ path_len=`expr ${#image_url} - ${#image_fname}`
+ local flat_path="${image_url:0:$path_len}"
+ local descriptor_url=$flat_path$descriptor_fname
warn $LINENO "$descriptor_data_pair_msg"`
`" Attempt to retrieve the descriptor *.vmdk: $descriptor_url"
if [[ $flat_path != file* ]]; then
@@ -189,35 +190,35 @@
# NOTE: For backwards compatibility reasons, colons may be used in place
# of semi-colons for property delimiters but they are not permitted
# characters in NTFS filesystems.
- property_string=`echo "$IMAGE_NAME" | { grep -oP '(?<=-)(?!.*-).*[:;].*[:;].*$' || true; }`
+ property_string=`echo "$image_name" | { grep -oP '(?<=-)(?!.*-).*[:;].*[:;].*$' || true; }`
IFS=':;' read -a props <<< "$property_string"
vmdk_disktype="${props[0]:-$vmdk_disktype}"
vmdk_adapter_type="${props[1]:-$vmdk_adapter_type}"
vmdk_net_adapter="${props[2]:-$vmdk_net_adapter}"
- glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format bare --disk-format vmdk --property vmware_disktype="$vmdk_disktype" --property vmware_adaptertype="$vmdk_adapter_type" --property hw_vif_model="$vmdk_net_adapter" < "${IMAGE}"
+ glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name" --is-public=True --container-format bare --disk-format vmdk --property vmware_disktype="$vmdk_disktype" --property vmware_adaptertype="$vmdk_adapter_type" --property hw_vif_model="$vmdk_net_adapter" < "${image}"
return
fi
# XenServer-vhd-ovf-format images are provided as .vhd.tgz
# and should not be decompressed prior to loading
if [[ "$image_url" =~ '.vhd.tgz' ]]; then
- IMAGE_NAME="${IMAGE_FNAME%.vhd.tgz}"
- FORCE_VM_MODE=""
- if [[ "$IMAGE_NAME" =~ 'cirros' ]]; then
+ image_name="${image_fname%.vhd.tgz}"
+ local force_vm_mode=""
+ if [[ "$image_name" =~ 'cirros' ]]; then
# Cirros VHD image currently only boots in PV mode.
# Nova defaults to PV for all VHD images, but
# the glance setting is needed for booting
# directly from volume.
- FORCE_VM_MODE="--property vm_mode=xen"
+ force_vm_mode="--property vm_mode=xen"
fi
glance \
--os-auth-token $token \
--os-image-url http://$GLANCE_HOSTPORT \
image-create \
- --name "$IMAGE_NAME" --is-public=True \
+ --name "$image_name" --is-public=True \
--container-format=ovf --disk-format=vhd \
- $FORCE_VM_MODE < "${IMAGE}"
+ $force_vm_mode < "${image}"
return
fi
@@ -225,93 +226,94 @@
# and should not be decompressed prior to loading.
# Setting metadata, so PV mode is used.
if [[ "$image_url" =~ '.xen-raw.tgz' ]]; then
- IMAGE_NAME="${IMAGE_FNAME%.xen-raw.tgz}"
+ image_name="${image_fname%.xen-raw.tgz}"
glance \
--os-auth-token $token \
--os-image-url http://$GLANCE_HOSTPORT \
image-create \
- --name "$IMAGE_NAME" --is-public=True \
+ --name "$image_name" --is-public=True \
--container-format=tgz --disk-format=raw \
- --property vm_mode=xen < "${IMAGE}"
+ --property vm_mode=xen < "${image}"
return
fi
- KERNEL=""
- RAMDISK=""
- DISK_FORMAT=""
- CONTAINER_FORMAT=""
- UNPACK=""
- case "$IMAGE_FNAME" in
+ local kernel=""
+ local ramdisk=""
+ local disk_format=""
+ local container_format=""
+ local unpack=""
+ local img_property=""
+ case "$image_fname" in
*.tar.gz|*.tgz)
# Extract ami and aki files
- [ "${IMAGE_FNAME%.tar.gz}" != "$IMAGE_FNAME" ] &&
- IMAGE_NAME="${IMAGE_FNAME%.tar.gz}" ||
- IMAGE_NAME="${IMAGE_FNAME%.tgz}"
- xdir="$FILES/images/$IMAGE_NAME"
+ [ "${image_fname%.tar.gz}" != "$image_fname" ] &&
+ image_name="${image_fname%.tar.gz}" ||
+ image_name="${image_fname%.tgz}"
+ local xdir="$FILES/images/$image_name"
rm -Rf "$xdir";
mkdir "$xdir"
- tar -zxf $IMAGE -C "$xdir"
- KERNEL=$(for f in "$xdir/"*-vmlinuz* "$xdir/"aki-*/image; do
+ tar -zxf $image -C "$xdir"
+ kernel=$(for f in "$xdir/"*-vmlinuz* "$xdir/"aki-*/image; do
[ -f "$f" ] && echo "$f" && break; done; true)
- RAMDISK=$(for f in "$xdir/"*-initrd* "$xdir/"ari-*/image; do
+ ramdisk=$(for f in "$xdir/"*-initrd* "$xdir/"ari-*/image; do
[ -f "$f" ] && echo "$f" && break; done; true)
- IMAGE=$(for f in "$xdir/"*.img "$xdir/"ami-*/image; do
+ image=$(for f in "$xdir/"*.img "$xdir/"ami-*/image; do
[ -f "$f" ] && echo "$f" && break; done; true)
- if [[ -z "$IMAGE_NAME" ]]; then
- IMAGE_NAME=$(basename "$IMAGE" ".img")
+ if [[ -z "$image_name" ]]; then
+ image_name=$(basename "$image" ".img")
fi
;;
*.img)
- IMAGE_NAME=$(basename "$IMAGE" ".img")
- format=$(qemu-img info ${IMAGE} | awk '/^file format/ { print $3; exit }')
+ image_name=$(basename "$image" ".img")
+ local format=$(qemu-img info ${image} | awk '/^file format/ { print $3; exit }')
if [[ ",qcow2,raw,vdi,vmdk,vpc," =~ ",$format," ]]; then
- DISK_FORMAT=$format
+ disk_format=$format
else
- DISK_FORMAT=raw
+ disk_format=raw
fi
- CONTAINER_FORMAT=bare
+ container_format=bare
;;
*.img.gz)
- IMAGE_NAME=$(basename "$IMAGE" ".img.gz")
- DISK_FORMAT=raw
- CONTAINER_FORMAT=bare
- UNPACK=zcat
+ image_name=$(basename "$image" ".img.gz")
+ disk_format=raw
+ container_format=bare
+ unpack=zcat
;;
*.qcow2)
- IMAGE_NAME=$(basename "$IMAGE" ".qcow2")
- DISK_FORMAT=qcow2
- CONTAINER_FORMAT=bare
+ image_name=$(basename "$image" ".qcow2")
+ disk_format=qcow2
+ container_format=bare
;;
*.iso)
- IMAGE_NAME=$(basename "$IMAGE" ".iso")
- DISK_FORMAT=iso
- CONTAINER_FORMAT=bare
+ image_name=$(basename "$image" ".iso")
+ disk_format=iso
+ container_format=bare
;;
- *) echo "Do not know what to do with $IMAGE_FNAME"; false;;
+ *) echo "Do not know what to do with $image_fname"; false;;
esac
if is_arch "ppc64"; then
- IMG_PROPERTY="--property hw_cdrom_bus=scsi"
+ img_property="--property hw_cdrom_bus=scsi"
fi
- if [ "$CONTAINER_FORMAT" = "bare" ]; then
- if [ "$UNPACK" = "zcat" ]; then
- glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" $IMG_PROPERTY --is-public True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < <(zcat --force "${IMAGE}")
+ if [ "$container_format" = "bare" ]; then
+ if [ "$unpack" = "zcat" ]; then
+ glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name" $img_property --is-public True --container-format=$container_format --disk-format $disk_format < <(zcat --force "${image}")
else
- glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" $IMG_PROPERTY --is-public True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < "${IMAGE}"
+ glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name" $img_property --is-public True --container-format=$container_format --disk-format $disk_format < "${image}"
fi
else
# Use glance client to add the kernel the root filesystem.
# We parse the results of the first upload to get the glance ID of the
# kernel for use when uploading the root filesystem.
- KERNEL_ID=""; RAMDISK_ID="";
- if [ -n "$KERNEL" ]; then
- KERNEL_ID=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME-kernel" $IMG_PROPERTY --is-public True --container-format aki --disk-format aki < "$KERNEL" | grep ' id ' | get_field 2)
+ local kernel_id="" ramdisk_id="";
+ if [ -n "$kernel" ]; then
+ kernel_id=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name-kernel" $img_property --is-public True --container-format aki --disk-format aki < "$kernel" | grep ' id ' | get_field 2)
fi
- if [ -n "$RAMDISK" ]; then
- RAMDISK_ID=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME-ramdisk" $IMG_PROPERTY --is-public True --container-format ari --disk-format ari < "$RAMDISK" | grep ' id ' | get_field 2)
+ if [ -n "$ramdisk" ]; then
+ ramdisk_id=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name-ramdisk" $img_property --is-public True --container-format ari --disk-format ari < "$ramdisk" | grep ' id ' | get_field 2)
fi
- glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "${IMAGE_NAME%.img}" $IMG_PROPERTY --is-public True --container-format ami --disk-format ami ${KERNEL_ID:+--property kernel_id=$KERNEL_ID} ${RAMDISK_ID:+--property ramdisk_id=$RAMDISK_ID} < "${IMAGE}"
+ glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "${image_name%.img}" $img_property --is-public True --container-format ami --disk-format ami ${kernel_id:+--property kernel_id=$kernel_id} ${ramdisk_id:+--property ramdisk_id=$ramdisk_id} < "${image}"
fi
}
diff --git a/functions-common b/functions-common
index 2df5e1d..5284056 100644
--- a/functions-common
+++ b/functions-common
@@ -49,6 +49,7 @@
local section=$2
local option=$3
shift 3
+
local values="$(iniget_multiline $file $section $option) $@"
iniset_multiline $file $section $option $values
$xtrace
@@ -62,6 +63,7 @@
local file=$1
local section=$2
local option=$3
+
sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=.*$\)|#\1|" "$file"
$xtrace
}
@@ -75,6 +77,7 @@
local section=$2
local option=$3
local line
+
line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
echo ${line#*=}
$xtrace
@@ -89,6 +92,7 @@
local section=$2
local option=$3
local values
+
values=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { s/^$option[ \t]*=[ \t]*//gp; }" "$file")
echo ${values}
$xtrace
@@ -103,6 +107,7 @@
local section=$2
local option=$3
local line
+
line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
$xtrace
[ -n "$line" ]
@@ -145,6 +150,7 @@
local file=$1
local section=$2
local option=$3
+
shift 3
local values
for v in $@; do
@@ -237,28 +243,28 @@
# die_if_not_set $LINENO env-var "message"
function die_if_not_set {
local exitcode=$?
- FXTRACE=$(set +o | grep xtrace)
+ local xtrace=$(set +o | grep xtrace)
set +o xtrace
local line=$1; shift
local evar=$1; shift
if ! is_set $evar || [ $exitcode != 0 ]; then
die $line "$*"
fi
- $FXTRACE
+ $xtrace
}
# Prints line number and "message" in error format
# err $LINENO "message"
function err {
local exitcode=$?
- errXTRACE=$(set +o | grep xtrace)
+ local xtrace=$(set +o | grep xtrace)
set +o xtrace
local msg="[ERROR] ${BASH_SOURCE[2]}:$1 $2"
echo $msg 1>&2;
if [[ -n ${SCREEN_LOGDIR} ]]; then
echo $msg >> "${SCREEN_LOGDIR}/error.log"
fi
- $errXTRACE
+ $xtrace
return $exitcode
}
@@ -268,14 +274,14 @@
# err_if_not_set $LINENO env-var "message"
function err_if_not_set {
local exitcode=$?
- errinsXTRACE=$(set +o | grep xtrace)
+ local xtrace=$(set +o | grep xtrace)
set +o xtrace
local line=$1; shift
local evar=$1; shift
if ! is_set $evar || [ $exitcode != 0 ]; then
err $line "$*"
fi
- $errinsXTRACE
+ $xtrace
return $exitcode
}
@@ -304,14 +310,14 @@
# warn $LINENO "message"
function warn {
local exitcode=$?
- errXTRACE=$(set +o | grep xtrace)
+ local xtrace=$(set +o | grep xtrace)
set +o xtrace
local msg="[WARNING] ${BASH_SOURCE[2]}:$1 $2"
echo $msg 1>&2;
if [[ -n ${SCREEN_LOGDIR} ]]; then
echo $msg >> "${SCREEN_LOGDIR}/error.log"
fi
- $errXTRACE
+ $xtrace
return $exitcode
}
@@ -322,13 +328,16 @@
# Determine OS Vendor, Release and Update
# Tested with OS/X, Ubuntu, RedHat, CentOS, Fedora
# Returns results in global variables:
-# os_VENDOR - vendor name
-# os_RELEASE - release
-# os_UPDATE - update
-# os_PACKAGE - package type
-# os_CODENAME - vendor's codename for release
+# ``os_VENDOR`` - vendor name: ``Ubuntu``, ``Fedora``, etc
+# ``os_RELEASE`` - major release: ``14.04`` (Ubuntu), ``20`` (Fedora)
+# ``os_UPDATE`` - update: ex. the ``5`` in ``RHEL6.5``
+# ``os_PACKAGE`` - package type: ``deb`` or ``rpm``
+# ``os_CODENAME`` - vendor's codename for release: ``snow leopard``, ``trusty``
+declare os_VENDOR os_RELEASE os_UPDATE os_PACKAGE os_CODENAME
+
# GetOSVersion
function GetOSVersion {
+
# Figure out which vendor we are
if [[ -x "`which sw_vers 2>/dev/null`" ]]; then
# OS/X
@@ -418,6 +427,8 @@
# Translate the OS version values into common nomenclature
# Sets global ``DISTRO`` from the ``os_*`` values
+declare DISTRO
+
function GetDistro {
GetOSVersion
if [[ "$os_VENDOR" =~ (Ubuntu) || "$os_VENDOR" =~ (Debian) ]]; then
@@ -452,9 +463,7 @@
# Utility function for checking machine architecture
# is_arch arch-type
function is_arch {
- ARCH_TYPE=$1
-
- [[ "$(uname -m)" == "$ARCH_TYPE" ]]
+ [[ "$(uname -m)" == "$1" ]]
}
# Determine if current distribution is a Fedora-based distribution
@@ -661,16 +670,17 @@
# Search for an IP unless an explicit is set by ``HOST_IP`` environment variable
if [ -z "$host_ip" -o "$host_ip" == "dhcp" ]; then
host_ip=""
- host_ips=`LC_ALL=C ip -f inet addr show ${host_ip_iface} | awk '/inet/ {split($2,parts,"/"); print parts[1]}'`
- for IP in $host_ips; do
+ local host_ips=$(LC_ALL=C ip -f inet addr show ${host_ip_iface} | awk '/inet/ {split($2,parts,"/"); print parts[1]}')
+ local ip
+ for ip in $host_ips; do
# Attempt to filter out IP addresses that are part of the fixed and
# floating range. Note that this method only works if the ``netaddr``
# python library is installed. If it is not installed, an error
# will be printed and the first IP from the interface will be used.
# If that is not correct set ``HOST_IP`` in ``localrc`` to the correct
# address.
- if ! (address_in_net $IP $fixed_range || address_in_net $IP $floating_range); then
- host_ip=$IP
+ if ! (address_in_net $ip $fixed_range || address_in_net $ip $floating_range); then
+ host_ip=$ip
break;
fi
done
@@ -683,6 +693,7 @@
# Reverse syntax is supported: -1 is the last field, -2 is second to last, etc.
# get_field field-number
function get_field {
+ local data field
while read data; do
if [ "$1" -lt 0 ]; then
field="(\$(NF$1))"
@@ -725,12 +736,12 @@
# Usage: get_or_create_user <username> <password> <project> [<email>]
function get_or_create_user {
if [[ ! -z "$4" ]]; then
- local EMAIL="--email=$4"
+ local email="--email=$4"
else
- local EMAIL=""
+ local email=""
fi
# Gets user id
- USER_ID=$(
+ local user_id=$(
# Gets user id
openstack user show $1 -f value -c id 2>/dev/null ||
# Creates new user
@@ -738,63 +749,63 @@
$1 \
--password "$2" \
--project $3 \
- $EMAIL \
+ $email \
-f value -c id
)
- echo $USER_ID
+ echo $user_id
}
# Gets or creates project
# Usage: get_or_create_project <name>
function get_or_create_project {
# Gets project id
- PROJECT_ID=$(
+ local project_id=$(
# Gets project id
openstack project show $1 -f value -c id 2>/dev/null ||
# Creates new project if not exists
openstack project create $1 -f value -c id
)
- echo $PROJECT_ID
+ echo $project_id
}
# Gets or creates role
# Usage: get_or_create_role <name>
function get_or_create_role {
- ROLE_ID=$(
+ local role_id=$(
# Gets role id
openstack role show $1 -f value -c id 2>/dev/null ||
# Creates role if not exists
openstack role create $1 -f value -c id
)
- echo $ROLE_ID
+ echo $role_id
}
# Gets or adds user role
# Usage: get_or_add_user_role <role> <user> <project>
function get_or_add_user_role {
# Gets user role id
- USER_ROLE_ID=$(openstack user role list \
+ local user_role_id=$(openstack user role list \
$2 \
--project $3 \
--column "ID" \
--column "Name" \
| grep " $1 " | get_field 1)
- if [[ -z "$USER_ROLE_ID" ]]; then
+ if [[ -z "$user_role_id" ]]; then
# Adds role to user
- USER_ROLE_ID=$(openstack role add \
+ user_role_id=$(openstack role add \
$1 \
--user $2 \
--project $3 \
| grep " id " | get_field 2)
fi
- echo $USER_ROLE_ID
+ echo $user_role_id
}
# Gets or creates service
# Usage: get_or_create_service <name> <type> <description>
function get_or_create_service {
# Gets service id
- SERVICE_ID=$(
+ local service_id=$(
# Gets service id
openstack service show $1 -f value -c id 2>/dev/null ||
# Creates new service if not exists
@@ -804,22 +815,22 @@
--description="$3" \
-f value -c id
)
- echo $SERVICE_ID
+ echo $service_id
}
# Gets or creates endpoint
# Usage: get_or_create_endpoint <service> <region> <publicurl> <adminurl> <internalurl>
function get_or_create_endpoint {
# Gets endpoint id
- ENDPOINT_ID=$(openstack endpoint list \
+ local endpoint_id=$(openstack endpoint list \
--column "ID" \
--column "Region" \
--column "Service Name" \
| grep " $2 " \
| grep " $1 " | get_field 1)
- if [[ -z "$ENDPOINT_ID" ]]; then
+ if [[ -z "$endpoint_id" ]]; then
# Creates new endpoint
- ENDPOINT_ID=$(openstack endpoint create \
+ endpoint_id=$(openstack endpoint create \
$1 \
--region $2 \
--publicurl $3 \
@@ -827,9 +838,10 @@
--internalurl $5 \
| grep " id " | get_field 2)
fi
- echo $ENDPOINT_ID
+ echo $endpoint_id
}
+
# Package Functions
# =================
@@ -990,6 +1002,7 @@
}
# Distro-agnostic package installer
+# Uses globals ``NO_UPDATE_REPOS``, ``REPOS_UPDATED``, ``RETRY_UPDATE``
# install_package package [package ...]
function update_package_repo {
if [[ "$NO_UPDATE_REPOS" = "True" ]]; then
@@ -1090,6 +1103,7 @@
}
# zypper wrapper to set arguments correctly
+# Uses globals ``OFFLINE``, ``*_proxy``
# zypper_install package [package ...]
function zypper_install {
[[ "$OFFLINE" = "True" ]] && return
@@ -1106,7 +1120,8 @@
# _run_process() is designed to be backgrounded by run_process() to simulate a
# fork. It includes the dirty work of closing extra filehandles and preparing log
# files to produce the same logs as screen_it(). The log filename is derived
-# from the service name and global-and-now-misnamed SCREEN_LOGDIR
+# from the service name and global-and-now-misnamed ``SCREEN_LOGDIR``
+# Uses globals ``CURRENT_LOG_TIME``, ``SCREEN_LOGDIR``
# _run_process service "command-line"
function _run_process {
local service=$1
@@ -1132,6 +1147,7 @@
# Helper to remove the ``*.failure`` files under ``$SERVICE_DIR/$SCREEN_NAME``.
# This is used for ``service_check`` when all the ``screen_it`` are called finished
+# Uses globals ``SCREEN_NAME``, ``SERVICE_DIR``
# init_service_check
function init_service_check {
SCREEN_NAME=${SCREEN_NAME:-stack}
@@ -1149,15 +1165,15 @@
function is_running {
local name=$1
ps auxw | grep -v grep | grep ${name} > /dev/null
- RC=$?
+ local exitcode=$?
# some times I really hate bash reverse binary logic
- return $RC
+ return $exitcode
}
# run_process() launches a child process that closes all file descriptors and
# then exec's the passed in command. This is meant to duplicate the semantics
# of screen_it() without screen. PIDs are written to
-# $SERVICE_DIR/$SCREEN_NAME/$service.pid
+# ``$SERVICE_DIR/$SCREEN_NAME/$service.pid``
# run_process service "command-line"
function run_process {
local service=$1
@@ -1169,6 +1185,8 @@
}
# Helper to launch a service in a named screen
+# Uses globals ``CURRENT_LOG_TIME``, ``SCREEN_NAME``, ``SCREEN_LOGDIR``,
+# ``SERVICE_DIR``, ``USE_SCREEN``
# screen_it service "command-line"
function screen_it {
SCREEN_NAME=${SCREEN_NAME:-stack}
@@ -1211,6 +1229,7 @@
}
# Screen rc file builder
+# Uses globals ``SCREEN_NAME``, ``SCREENRC``
# screen_rc service "command-line"
function screen_rc {
SCREEN_NAME=${SCREEN_NAME:-stack}
@@ -1241,6 +1260,7 @@
# If a PID is available use it, kill the whole process group via TERM
# If screen is being used kill the screen window; this will catch processes
# that did not leave a PID behind
+# Uses globals ``SCREEN_NAME``, ``SERVICE_DIR``, ``USE_SCREEN``
# screen_stop service
function screen_stop {
SCREEN_NAME=${SCREEN_NAME:-stack}
@@ -1261,6 +1281,7 @@
}
# Helper to get the status of each running service
+# Uses globals ``SCREEN_NAME``, ``SERVICE_DIR``
# service_check
function service_check {
local service
@@ -1328,20 +1349,24 @@
if [[ -z "$os_PACKAGE" ]]; then
GetOSVersion
fi
- if [[ $TRACK_DEPENDS = True ]]; then
+ if [[ $TRACK_DEPENDS = True && ! "$@" =~ virtualenv ]]; then
+ # TRACK_DEPENDS=True installation creates a circular dependency when
+ # we attempt to install virtualenv into a virualenv, so we must global
+ # that installation.
source $DEST/.venv/bin/activate
- CMD_PIP=$DEST/.venv/bin/pip
- SUDO_PIP="env"
+ local cmd_pip=$DEST/.venv/bin/pip
+ local sudo_pip="env"
else
- SUDO_PIP="sudo"
- CMD_PIP=$(get_pip_command)
+ local cmd_pip=$(get_pip_command)
+ local sudo_pip="sudo"
fi
# Mirror option not needed anymore because pypi has CDN available,
# but it's useful in certain circumstances
PIP_USE_MIRRORS=${PIP_USE_MIRRORS:-False}
+ local pip_mirror_opt=""
if [[ "$PIP_USE_MIRRORS" != "False" ]]; then
- PIP_MIRROR_OPT="--use-mirrors"
+ pip_mirror_opt="--use-mirrors"
fi
# pip < 1.4 has a bug where it will use an already existing build
@@ -1354,13 +1379,13 @@
local pip_build_tmp=$(mktemp --tmpdir -d pip-build.XXXXX)
$xtrace
- $SUDO_PIP PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-/var/cache/pip} \
+ $sudo_pip PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-/var/cache/pip} \
http_proxy=$http_proxy \
https_proxy=$https_proxy \
no_proxy=$no_proxy \
- $CMD_PIP install --build=${pip_build_tmp} \
- $PIP_MIRROR_OPT $@ \
- && $SUDO_PIP rm -rf ${pip_build_tmp}
+ $cmd_pip install --build=${pip_build_tmp} \
+ $pip_mirror_opt $@ \
+ && $sudo_pip rm -rf ${pip_build_tmp}
}
# this should be used if you want to install globally, all libraries should
@@ -1395,7 +1420,7 @@
if [[ $update_requirements != "changed" ]]; then
(cd $REQUIREMENTS_DIR; \
- $SUDO_CMD python update.py $project_dir)
+ python update.py $project_dir)
fi
setup_package $project_dir $flags
@@ -1502,6 +1527,7 @@
# enable_service service [service ...]
function enable_service {
local tmpsvcs="${ENABLED_SERVICES}"
+ local service
for service in $@; do
if ! is_service_enabled $service; then
tmpsvcs+=",$service"
@@ -1538,7 +1564,8 @@
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local enabled=1
- services=$@
+ local services=$@
+ local service
for service in ${services}; do
[[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && enabled=0
@@ -1574,8 +1601,9 @@
function use_exclusive_service {
local options=${!1}
local selection=$3
- out=$2
+ local out=$2
[ -z $selection ] || [[ ! "$options" =~ "$selection" ]] && return 1
+ local opt
for opt in $options;do
[[ "$opt" = "$selection" ]] && enable_service $opt || disable_service $opt
done
@@ -1599,7 +1627,7 @@
let last="${#args[*]} - 1"
- dir_to_check=${args[$last]}
+ local dir_to_check=${args[$last]}
if [ ! -d "$dir_to_check" ]; then
dir_to_check=`dirname "$dir_to_check"`
fi
diff --git a/lib/databases/mysql b/lib/databases/mysql
index 0ccfce5..67bf85a 100644
--- a/lib/databases/mysql
+++ b/lib/databases/mysql
@@ -47,22 +47,22 @@
}
function configure_database_mysql {
- local slow_log
+ local my_conf mysql slow_log
echo_summary "Configuring and starting MySQL"
if is_ubuntu; then
- MY_CONF=/etc/mysql/my.cnf
- MYSQL=mysql
+ my_conf=/etc/mysql/my.cnf
+ mysql=mysql
elif is_fedora; then
if [[ $DISTRO =~ (rhel7) ]]; then
- MYSQL=mariadb
+ mysql=mariadb
else
- MYSQL=mysqld
+ mysql=mysqld
fi
- MY_CONF=/etc/my.cnf
+ my_conf=/etc/my.cnf
elif is_suse; then
- MY_CONF=/etc/my.cnf
- MYSQL=mysql
+ my_conf=/etc/my.cnf
+ mysql=mysql
else
exit_distro_not_supported "mysql configuration"
fi
@@ -70,7 +70,7 @@
# Start mysql-server
if is_fedora || is_suse; then
# service is not started by default
- start_service $MYSQL
+ start_service $mysql
fi
# Set the root password - only works the first time. For Ubuntu, we already
@@ -87,9 +87,9 @@
# Change ‘bind-address’ from localhost (127.0.0.1) to any (0.0.0.0) and
# set default db type to InnoDB
sudo bash -c "source $TOP_DIR/functions && \
- iniset $MY_CONF mysqld bind-address 0.0.0.0 && \
- iniset $MY_CONF mysqld sql_mode STRICT_ALL_TABLES && \
- iniset $MY_CONF mysqld default-storage-engine InnoDB"
+ iniset $my_conf mysqld bind-address 0.0.0.0 && \
+ iniset $my_conf mysqld sql_mode STRICT_ALL_TABLES && \
+ iniset $my_conf mysqld default-storage-engine InnoDB"
if [[ "$DATABASE_QUERY_LOGGING" == "True" ]]; then
@@ -102,19 +102,19 @@
sudo sed -e '/log.slow.queries/d' \
-e '/long.query.time/d' \
-e '/log.queries.not.using.indexes/d' \
- -i $MY_CONF
+ -i $my_conf
# Turn on slow query log, log all queries (any query taking longer than
# 0 seconds) and log all non-indexed queries
sudo bash -c "source $TOP_DIR/functions && \
- iniset $MY_CONF mysqld slow-query-log 1 && \
- iniset $MY_CONF mysqld slow-query-log-file $slow_log && \
- iniset $MY_CONF mysqld long-query-time 0 && \
- iniset $MY_CONF mysqld log-queries-not-using-indexes 1"
+ iniset $my_conf mysqld slow-query-log 1 && \
+ iniset $my_conf mysqld slow-query-log-file $slow_log && \
+ iniset $my_conf mysqld long-query-time 0 && \
+ iniset $my_conf mysqld log-queries-not-using-indexes 1"
fi
- restart_service $MYSQL
+ restart_service $mysql
}
function install_database_mysql {
diff --git a/lib/databases/postgresql b/lib/databases/postgresql
index 6e85d6e..fb6d304 100644
--- a/lib/databases/postgresql
+++ b/lib/databases/postgresql
@@ -42,11 +42,12 @@
}
function configure_database_postgresql {
+ local pg_conf pg_dir pg_hba root_roles
echo_summary "Configuring and starting PostgreSQL"
if is_fedora; then
- PG_HBA=/var/lib/pgsql/data/pg_hba.conf
- PG_CONF=/var/lib/pgsql/data/postgresql.conf
- if ! sudo [ -e $PG_HBA ]; then
+ pg_hba=/var/lib/pgsql/data/pg_hba.conf
+ pg_conf=/var/lib/pgsql/data/postgresql.conf
+ if ! sudo [ -e $pg_hba ]; then
if ! [[ $DISTRO =~ (rhel6) ]]; then
sudo postgresql-setup initdb
else
@@ -54,25 +55,25 @@
fi
fi
elif is_ubuntu; then
- PG_DIR=`find /etc/postgresql -name pg_hba.conf|xargs dirname`
- PG_HBA=$PG_DIR/pg_hba.conf
- PG_CONF=$PG_DIR/postgresql.conf
+ pg_dir=`find /etc/postgresql -name pg_hba.conf|xargs dirname`
+ pg_hba=$pg_dir/pg_hba.conf
+ pg_conf=$pg_dir/postgresql.conf
elif is_suse; then
- PG_HBA=/var/lib/pgsql/data/pg_hba.conf
- PG_CONF=/var/lib/pgsql/data/postgresql.conf
+ pg_hba=/var/lib/pgsql/data/pg_hba.conf
+ pg_conf=/var/lib/pgsql/data/postgresql.conf
# initdb is called when postgresql is first started
- sudo [ -e $PG_HBA ] || start_service postgresql
+ sudo [ -e $pg_hba ] || start_service postgresql
else
exit_distro_not_supported "postgresql configuration"
fi
# Listen on all addresses
- sudo sed -i "/listen_addresses/s/.*/listen_addresses = '*'/" $PG_CONF
+ sudo sed -i "/listen_addresses/s/.*/listen_addresses = '*'/" $pg_conf
# Set max_connections
- sudo sed -i "/max_connections/s/.*/max_connections = $MAX_DB_CONNECTIONS/" $PG_CONF
+ sudo sed -i "/max_connections/s/.*/max_connections = $MAX_DB_CONNECTIONS/" $pg_conf
# Do password auth from all IPv4 clients
- sudo sed -i "/^host/s/all\s\+127.0.0.1\/32\s\+ident/$DATABASE_USER\t0.0.0.0\/0\tpassword/" $PG_HBA
+ sudo sed -i "/^host/s/all\s\+127.0.0.1\/32\s\+ident/$DATABASE_USER\t0.0.0.0\/0\tpassword/" $pg_hba
# Do password auth for all IPv6 clients
- sudo sed -i "/^host/s/all\s\+::1\/128\s\+ident/$DATABASE_USER\t::0\/0\tpassword/" $PG_HBA
+ sudo sed -i "/^host/s/all\s\+::1\/128\s\+ident/$DATABASE_USER\t::0\/0\tpassword/" $pg_hba
restart_service postgresql
# Create the role if it's not here or else alter it.
@@ -86,14 +87,14 @@
function install_database_postgresql {
echo_summary "Installing postgresql"
- PGPASS=$HOME/.pgpass
- if [[ ! -e $PGPASS ]]; then
- cat <<EOF > $PGPASS
+ local pgpass=$HOME/.pgpass
+ if [[ ! -e $pgpass ]]; then
+ cat <<EOF > $pgpass
*:*:*:$DATABASE_USER:$DATABASE_PASSWORD
EOF
- chmod 0600 $PGPASS
+ chmod 0600 $pgpass
else
- sed -i "s/:root:\w\+/:root:$DATABASE_PASSWORD/" $PGPASS
+ sed -i "s/:root:\w\+/:root:$DATABASE_PASSWORD/" $pgpass
fi
if is_ubuntu; then
install_package postgresql
diff --git a/lib/heat b/lib/heat
index 510b683..b6124c0 100644
--- a/lib/heat
+++ b/lib/heat
@@ -190,6 +190,7 @@
# stop_heat() - Stop running processes
function stop_heat {
# Kill the screen windows
+ local serv
for serv in h-eng h-api h-api-cfn h-api-cw; do
screen_stop $serv
done
@@ -213,26 +214,26 @@
# create_heat_accounts() - Set up common required heat accounts
function create_heat_accounts {
# migrated from files/keystone_data.sh
- SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
- ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
+ local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
+ local admin_role=$(openstack role list | awk "/ admin / { print \$2 }")
- HEAT_USER=$(get_or_create_user "heat" \
- "$SERVICE_PASSWORD" $SERVICE_TENANT)
- get_or_add_user_role $ADMIN_ROLE $HEAT_USER $SERVICE_TENANT
+ local heat_user=$(get_or_create_user "heat" \
+ "$SERVICE_PASSWORD" $service_tenant)
+ get_or_add_user_role $admin_role $heat_user $service_tenant
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
- HEAT_SERVICE=$(get_or_create_service "heat" \
+ local heat_service=$(get_or_create_service "heat" \
"orchestration" "Heat Orchestration Service")
- get_or_create_endpoint $HEAT_SERVICE \
+ get_or_create_endpoint $heat_service \
"$REGION_NAME" \
"$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s" \
"$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s" \
"$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s"
- HEAT_CFN_SERVICE=$(get_or_create_service "heat-cfn" \
+ local heat_cfn_service=$(get_or_create_service "heat-cfn" \
"cloudformation" "Heat CloudFormation Service")
- get_or_create_endpoint $HEAT_CFN_SERVICE \
+ get_or_create_endpoint $heat_cfn_service \
"$REGION_NAME" \
"$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \
"$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \
@@ -247,36 +248,36 @@
# heat_stack_owner role is given to users who create Heat stacks,
# it's the default role used by heat to delegate to the heat service
# user (for performing deferred operations via trusts), see heat.conf
- HEAT_OWNER_ROLE=$(get_or_create_role "heat_stack_owner")
+ local heat_owner_role=$(get_or_create_role "heat_stack_owner")
# Give the role to the demo and admin users so they can create stacks
# in either of the projects created by devstack
- get_or_add_user_role $HEAT_OWNER_ROLE demo demo
- get_or_add_user_role $HEAT_OWNER_ROLE admin demo
- get_or_add_user_role $HEAT_OWNER_ROLE admin admin
+ get_or_add_user_role $heat_owner_role demo demo
+ get_or_add_user_role $heat_owner_role admin demo
+ get_or_add_user_role $heat_owner_role admin admin
iniset $HEAT_CONF DEFAULT deferred_auth_method trusts
fi
if [[ "$HEAT_STACK_DOMAIN" == "True" ]]; then
# Note we have to pass token/endpoint here because the current endpoint and
# version negotiation in OSC means just --os-identity-api-version=3 won't work
- KS_ENDPOINT_V3="$KEYSTONE_SERVICE_URI/v3"
+ local ks_endpoint_v3="$KEYSTONE_SERVICE_URI/v3"
- D_ID=$(openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
+ D_ID=$(openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
--os-identity-api-version=3 domain list | grep ' heat ' | get_field 1)
if [[ -z "$D_ID" ]]; then
- D_ID=$(openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
+ D_ID=$(openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
--os-identity-api-version=3 domain create heat \
--description "Owns users and projects created by heat" \
| grep ' id ' | get_field 2)
iniset $HEAT_CONF DEFAULT stack_user_domain ${D_ID}
- openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
+ openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
--os-identity-api-version=3 user create --password $SERVICE_PASSWORD \
--domain $D_ID heat_domain_admin \
--description "Manages users and projects created by heat"
- openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
+ openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
--os-identity-api-version=3 role add \
--user heat_domain_admin --domain ${D_ID} admin
iniset $HEAT_CONF DEFAULT stack_domain_admin heat_domain_admin
diff --git a/lib/ironic b/lib/ironic
index b56abcb..8b5bdec 100644
--- a/lib/ironic
+++ b/lib/ironic
@@ -175,15 +175,15 @@
function configure_ironic_conductor {
cp $IRONIC_DIR/etc/ironic/rootwrap.conf $IRONIC_ROOTWRAP_CONF
cp -r $IRONIC_DIR/etc/ironic/rootwrap.d $IRONIC_CONF_DIR
- IRONIC_ROOTWRAP=$(get_rootwrap_location ironic)
- ROOTWRAP_ISUDOER_CMD="$IRONIC_ROOTWRAP $IRONIC_CONF_DIR/rootwrap.conf *"
+ local ironic_rootwrap=$(get_rootwrap_location ironic)
+ local rootwrap_isudoer_cmd="$ironic_rootwrap $IRONIC_CONF_DIR/rootwrap.conf *"
# Set up the rootwrap sudoers for ironic
- TEMPFILE=`mktemp`
- echo "$STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_ISUDOER_CMD" >$TEMPFILE
- chmod 0440 $TEMPFILE
- sudo chown root:root $TEMPFILE
- sudo mv $TEMPFILE /etc/sudoers.d/ironic-rootwrap
+ local tempfile=`mktemp`
+ echo "$STACK_USER ALL=(root) NOPASSWD: $rootwrap_isudoer_cmd" >$tempfile
+ chmod 0440 $tempfile
+ sudo chown root:root $tempfile
+ sudo mv $tempfile /etc/sudoers.d/ironic-rootwrap
iniset $IRONIC_CONF_FILE DEFAULT rootwrap_config $IRONIC_ROOTWRAP_CONF
iniset $IRONIC_CONF_FILE DEFAULT enabled_drivers $IRONIC_ENABLED_DRIVERS
@@ -214,22 +214,22 @@
# service ironic admin # if enabled
function create_ironic_accounts {
- SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
- ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
+ local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
+ local admin_role=$(openstack role list | awk "/ admin / { print \$2 }")
# Ironic
if [[ "$ENABLED_SERVICES" =~ "ir-api" ]]; then
# Get ironic user if exists
- IRONIC_USER=$(get_or_create_user "ironic" \
- "$SERVICE_PASSWORD" $SERVICE_TENANT)
- get_or_add_user_role $ADMIN_ROLE $IRONIC_USER $SERVICE_TENANT
+ local ironic_user=$(get_or_create_user "ironic" \
+ "$SERVICE_PASSWORD" $service_tenant)
+ get_or_add_user_role $admin_role $ironic_user $service_tenant
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
- IRONIC_SERVICE=$(get_or_create_service "ironic" \
+ local ironic_service=$(get_or_create_service "ironic" \
"baremetal" "Ironic baremetal provisioning service")
- get_or_create_endpoint $IRONIC_SERVICE \
+ get_or_create_endpoint $ironic_service \
"$REGION_NAME" \
"$IRONIC_SERVICE_PROTOCOL://$IRONIC_HOSTPORT" \
"$IRONIC_SERVICE_PROTOCOL://$IRONIC_HOSTPORT" \
@@ -301,15 +301,15 @@
sudo chown -R $STACK_USER $IRONIC_DATA_DIR $IRONIC_STATE_PATH
sudo chown -R $STACK_USER:$LIBVIRT_GROUP $IRONIC_TFTPBOOT_DIR
if is_ubuntu; then
- PXEBIN=/usr/lib/syslinux/pxelinux.0
+ local pxebin=/usr/lib/syslinux/pxelinux.0
elif is_fedora; then
- PXEBIN=/usr/share/syslinux/pxelinux.0
+ local pxebin=/usr/share/syslinux/pxelinux.0
fi
- if [ ! -f $PXEBIN ]; then
+ if [ ! -f $pxebin ]; then
die $LINENO "pxelinux.0 (from SYSLINUX) not found."
fi
- cp $PXEBIN $IRONIC_TFTPBOOT_DIR
+ cp $pxebin $IRONIC_TFTPBOOT_DIR
mkdir -p $IRONIC_TFTPBOOT_DIR/pxelinux.cfg
}
@@ -317,20 +317,20 @@
# Call libvirt setup scripts in a new shell to ensure any new group membership
sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/setup-network"
if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] ; then
- LOG_ARG="$IRONIC_VM_LOG_DIR"
+ local log_arg="$IRONIC_VM_LOG_DIR"
else
- LOG_ARG=""
+ local log_arg=""
fi
sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/create-nodes \
$IRONIC_VM_SPECS_CPU $IRONIC_VM_SPECS_RAM $IRONIC_VM_SPECS_DISK \
amd64 $IRONIC_VM_COUNT $IRONIC_VM_NETWORK_BRIDGE $IRONIC_VM_EMULATOR \
- $LOG_ARG" >> $IRONIC_VM_MACS_CSV_FILE
+ $log_arg" >> $IRONIC_VM_MACS_CSV_FILE
}
function enroll_vms {
- CHASSIS_ID=$(ironic chassis-create -d "ironic test chassis" | grep " uuid " | get_field 2)
- IRONIC_NET_ID=$(neutron net-list | grep private | get_field 1)
+ local chassis_id=$(ironic chassis-create -d "ironic test chassis" | grep " uuid " | get_field 2)
+ local ironic_net_id=$(neutron net-list | grep private | get_field 1)
local idx=0
# work around; need to know what netns neutron uses for private network.
@@ -339,11 +339,11 @@
# the instances operation. If we don't do this, the first port creation
# only happens in the middle of fake baremetal instance's spawning by nova,
# so we'll end up with unbootable fake baremetal VM due to broken PXE.
- PORT_ID=$(neutron port-create private | grep " id " | get_field 2)
+ local port_id=$(neutron port-create private | grep " id " | get_field 2)
while read MAC; do
- NODE_ID=$(ironic node-create --chassis_uuid $CHASSIS_ID --driver pxe_ssh \
+ local node_id=$(ironic node-create --chassis_uuid $chassis_id --driver pxe_ssh \
-i pxe_deploy_kernel=$IRONIC_DEPLOY_KERNEL_ID \
-i pxe_deploy_ramdisk=$IRONIC_DEPLOY_RAMDISK_ID \
-i ssh_virt_type=$IRONIC_SSH_VIRT_TYPE \
@@ -357,14 +357,14 @@
-p cpu_arch=x86_64 \
| grep " uuid " | get_field 2)
- ironic port-create --address $MAC --node_uuid $NODE_ID
+ ironic port-create --address $MAC --node_uuid $node_id
idx=$((idx+1))
done < $IRONIC_VM_MACS_CSV_FILE
# create the nova flavor
- adjusted_disk=$(($IRONIC_VM_SPECS_DISK - $IRONIC_VM_EPHEMERAL_DISK))
+ local adjusted_disk=$(($IRONIC_VM_SPECS_DISK - $IRONIC_VM_EPHEMERAL_DISK))
nova flavor-create --ephemeral $IRONIC_VM_EPHEMERAL_DISK baremetal auto $IRONIC_VM_SPECS_RAM $adjusted_disk $IRONIC_VM_SPECS_CPU
# TODO(lucasagomes): Remove the 'baremetal:deploy_kernel_id'
# and 'baremetal:deploy_ramdisk_id' parameters
@@ -374,8 +374,8 @@
# intentional sleep to make sure the tag has been set to port
sleep 10
- TAPDEV=$(sudo ip netns exec qdhcp-${IRONIC_NET_ID} ip link list | grep tap | cut -d':' -f2 | cut -b2-)
- TAG_ID=$(sudo ovs-vsctl show |grep ${TAPDEV} -A1 -m1 | grep tag | cut -d':' -f2 | cut -b2-)
+ local tapdev=$(sudo ip netns exec qdhcp-${ironic_net_id} ip link list | grep tap | cut -d':' -f2 | cut -b2-)
+ local tag_id=$(sudo ovs-vsctl show |grep ${tapdev} -A1 -m1 | grep tag | cut -d':' -f2 | cut -b2-)
# make sure veth pair is not existing, otherwise delete its links
sudo ip link show ovs-tap1 && sudo ip link delete ovs-tap1
@@ -385,12 +385,12 @@
sudo ip link set dev brbm-tap1 up
sudo ip link set dev ovs-tap1 up
- sudo ovs-vsctl -- --if-exists del-port ovs-tap1 -- add-port br-int ovs-tap1 tag=$TAG_ID
+ sudo ovs-vsctl -- --if-exists del-port ovs-tap1 -- add-port br-int ovs-tap1 tag=$tag_id
sudo ovs-vsctl -- --if-exists del-port brbm-tap1 -- add-port $IRONIC_VM_NETWORK_BRIDGE brbm-tap1
# Remove the port needed only for workaround. For additional info read the
# comment at the beginning of this function
- neutron port-delete $PORT_ID
+ neutron port-delete $port_id
}
function configure_iptables {
@@ -404,11 +404,11 @@
function configure_tftpd {
if is_ubuntu; then
- PXEBIN=/usr/lib/syslinux/pxelinux.0
+ local pxebin=/usr/lib/syslinux/pxelinux.0
elif is_fedora; then
- PXEBIN=/usr/share/syslinux/pxelinux.0
+ local pxebin=/usr/share/syslinux/pxelinux.0
fi
- if [ ! -f $PXEBIN ]; then
+ if [ ! -f $pxebin ]; then
die $LINENO "pxelinux.0 (from SYSLINUX) not found."
fi
@@ -441,12 +441,12 @@
}
function ironic_ssh_check {
- local KEY_FILE=$1
- local FLOATING_IP=$2
- local PORT=$3
- local DEFAULT_INSTANCE_USER=$4
- local ACTIVE_TIMEOUT=$5
- if ! timeout $ACTIVE_TIMEOUT sh -c "while ! ssh -p $PORT -o StrictHostKeyChecking=no -i $KEY_FILE ${DEFAULT_INSTANCE_USER}@$FLOATING_IP echo success; do sleep 1; done"; then
+ local key_file=$1
+ local floating_ip=$2
+ local port=$3
+ local default_instance_user=$4
+ local active_timeout=$5
+ if ! timeout $active_timeout sh -c "while ! ssh -p $port -o StrictHostKeyChecking=no -i $key_file ${default_instance_user}@$floating_ip echo success; do sleep 1; done"; then
die $LINENO "server didn't become ssh-able!"
fi
}
@@ -458,16 +458,17 @@
}
# build deploy kernel+ramdisk, then upload them to glance
-# this function sets IRONIC_DEPLOY_KERNEL_ID and IRONIC_DEPLOY_RAMDISK_ID
+# this function sets ``IRONIC_DEPLOY_KERNEL_ID``, ``IRONIC_DEPLOY_RAMDISK_ID``
function upload_baremetal_ironic_deploy {
- token=$1
+ local token=$1
+ declare -g IRONIC_DEPLOY_KERNEL_ID IRONIC_DEPLOY_RAMDISK_ID
if [ -z "$IRONIC_DEPLOY_KERNEL" -o -z "$IRONIC_DEPLOY_RAMDISK" ]; then
- IRONIC_DEPLOY_KERNEL_PATH=$TOP_DIR/files/ir-deploy.kernel
- IRONIC_DEPLOY_RAMDISK_PATH=$TOP_DIR/files/ir-deploy.initramfs
+ local IRONIC_DEPLOY_KERNEL_PATH=$TOP_DIR/files/ir-deploy.kernel
+ local IRONIC_DEPLOY_RAMDISK_PATH=$TOP_DIR/files/ir-deploy.initramfs
else
- IRONIC_DEPLOY_KERNEL_PATH=$IRONIC_DEPLOY_KERNEL
- IRONIC_DEPLOY_RAMDISK_PATH=$IRONIC_DEPLOY_RAMDISK
+ local IRONIC_DEPLOY_KERNEL_PATH=$IRONIC_DEPLOY_KERNEL
+ local IRONIC_DEPLOY_RAMDISK_PATH=$IRONIC_DEPLOY_RAMDISK
fi
if [ ! -e "$IRONIC_DEPLOY_RAMDISK_PATH" -o ! -e "$IRONIC_DEPLOY_KERNEL_PATH" ]; then
@@ -508,19 +509,20 @@
git_clone $DIB_REPO $DIB_DIR $DIB_BRANCH
# make sure all needed service were enabled
+ local srv
for srv in nova glance key neutron; do
if ! is_service_enabled "$srv"; then
die $LINENO "$srv should be enabled for ironic tests"
fi
done
- TOKEN=$(keystone token-get | grep ' id ' | get_field 2)
- die_if_not_set $LINENO TOKEN "Keystone fail to get token"
+ local token=$(keystone token-get | grep ' id ' | get_field 2)
+ die_if_not_set $LINENO token "Keystone fail to get token"
echo_summary "Creating and uploading baremetal images for ironic"
# build and upload separate deploy kernel & ramdisk
- upload_baremetal_ironic_deploy $TOKEN
+ upload_baremetal_ironic_deploy $token
create_bridge_and_vms
enroll_vms
@@ -536,9 +538,9 @@
function cleanup_baremetal_basic_ops {
rm -f $IRONIC_VM_MACS_CSV_FILE
if [ -f $IRONIC_KEY_FILE ]; then
- KEY=`cat $IRONIC_KEY_FILE.pub`
+ local key=$(cat $IRONIC_KEY_FILE.pub)
# remove public key from authorized_keys
- grep -v "$KEY" $IRONIC_AUTHORIZED_KEYS_FILE > temp && mv temp $IRONIC_AUTHORIZED_KEYS_FILE
+ grep -v "$key" $IRONIC_AUTHORIZED_KEYS_FILE > temp && mv temp $IRONIC_AUTHORIZED_KEYS_FILE
chmod 0600 $IRONIC_AUTHORIZED_KEYS_FILE
fi
sudo rm -rf $IRONIC_DATA_DIR $IRONIC_STATE_PATH
diff --git a/lib/marconi b/lib/marconi
index 063ed3d..e05518c 100644
--- a/lib/marconi
+++ b/lib/marconi
@@ -42,7 +42,7 @@
MARCONI_BIN_DIR=$(get_python_exec_prefix)
# Set up database backend
-MARCONI_BACKEND=${MARCONI_BACKEND:-sqlite}
+MARCONI_BACKEND=${MARCONI_BACKEND:-mongodb}
# Set Marconi repository
@@ -77,6 +77,13 @@
function cleanup_marconi {
if ! timeout $SERVICE_TIMEOUT sh -c "while ! mongo marconi --eval 'db.dropDatabase();'; do sleep 1; done"; then
die $LINENO "Mongo DB did not start"
+ else
+ full_version=$(mongo marconi --eval 'db.dropDatabase();')
+ mongo_version=`echo $full_version | cut -d' ' -f4`
+ required_mongo_version='2.2'
+ if [[ $mongo_version < $required_mongo_version ]]; then
+ die $LINENO "Marconi needs Mongo DB version >= 2.2 to run."
+ fi
fi
}
diff --git a/lib/neutron b/lib/neutron
index 4d0a7e1..0c4db25 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -166,10 +166,10 @@
# remote connectivity), and no physical resources will be
# available for the allocation of provider networks.
-# To use GRE tunnels for tenant networks, set to True in
-# ``localrc``. GRE tunnels are only supported by the openvswitch
-# plugin, and currently only on Ubuntu.
-ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-False}
+# To disable tunnels (GRE or VXLAN) for tenant networks,
+# set to False in ``local.conf``.
+# GRE tunnels are only supported by the openvswitch.
+ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-True}
# If using GRE tunnels for tenant networks, specify the range of
# tunnel IDs from which tenant networks are allocated. Can be
diff --git a/lib/neutron_plugins/ml2 b/lib/neutron_plugins/ml2
index f7f7838..d270015 100644
--- a/lib/neutron_plugins/ml2
+++ b/lib/neutron_plugins/ml2
@@ -7,9 +7,9 @@
# Enable this to simply and quickly enable tunneling with ML2.
# Select either 'gre', 'vxlan', or '(gre vxlan)'
-Q_ML2_TENANT_NETWORK_TYPE=${Q_ML2_TENANT_NETWORK_TYPE:-}
+Q_ML2_TENANT_NETWORK_TYPE=${Q_ML2_TENANT_NETWORK_TYPE:-"vxlan"}
# This has to be set here since the agent will set this in the config file
-if [[ "$Q_ML2_TENANT_NETWORK_TYPE" != "" ]]; then
+if [[ "$Q_ML2_TENANT_NETWORK_TYPE" != "local" ]]; then
Q_AGENT_EXTRA_AGENT_OPTS+=(tunnel_types=$Q_ML2_TENANT_NETWORK_TYPE)
elif [[ "$ENABLE_TENANT_TUNNELS" == "True" ]]; then
Q_AGENT_EXTRA_AGENT_OPTS+=(tunnel_types=gre)
@@ -57,7 +57,7 @@
}
function neutron_plugin_configure_service {
- if [[ "$Q_ML2_TENANT_NETWORK_TYPE" != "" ]]; then
+ if [[ "$Q_ML2_TENANT_NETWORK_TYPE" != "local" ]]; then
Q_SRV_EXTRA_OPTS+=(tenant_network_types=$Q_ML2_TENANT_NETWORK_TYPE)
elif [[ "$ENABLE_TENANT_TUNNELS" == "True" ]]; then
# This assumes you want a simple configuration, and will overwrite
diff --git a/lib/neutron_plugins/vmware_nsx b/lib/neutron_plugins/vmware_nsx
index 5802ebf..f4eb82d 100644
--- a/lib/neutron_plugins/vmware_nsx
+++ b/lib/neutron_plugins/vmware_nsx
@@ -105,9 +105,6 @@
if [[ "$NSX_PASSWORD" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_password $NSX_PASSWORD
fi
- if [[ "$NSX_REQ_TIMEOUT" != "" ]]; then
- iniset /$Q_PLUGIN_CONF_FILE DEFAULT req_timeout $NSX_REQ_TIMEOUT
- fi
if [[ "$NSX_HTTP_TIMEOUT" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT http_timeout $NSX_HTTP_TIMEOUT
fi
diff --git a/lib/oslo b/lib/oslo
index 421fbce..025815c 100644
--- a/lib/oslo
+++ b/lib/oslo
@@ -39,10 +39,6 @@
# install_oslo() - Collect source and prepare
function install_oslo {
- # TODO(sdague): remove this once we get to Icehouse, this just makes
- # for a smoother transition of existing users.
- cleanup_oslo
-
git_clone $CLIFF_REPO $CLIFF_DIR $CLIFF_BRANCH
setup_install $CLIFF_DIR
@@ -74,17 +70,6 @@
setup_install $TASKFLOW_DIR
}
-# cleanup_oslo() - purge possibly old versions of oslo
-function cleanup_oslo {
- # this means we've got an old oslo installed, lets get rid of it
- if ! python -c 'import oslo.config' 2>/dev/null; then
- echo "Found old oslo.config... removing to ensure consistency"
- local PIP_CMD=$(get_pip_command)
- pip_install oslo.config
- sudo $PIP_CMD uninstall -y oslo.config
- fi
-}
-
# Restore xtrace
$XTRACE
diff --git a/lib/rpc_backend b/lib/rpc_backend
index a62d4e7..38da50c 100644
--- a/lib/rpc_backend
+++ b/lib/rpc_backend
@@ -26,6 +26,8 @@
# Make sure we only have one rpc backend enabled.
# Also check the specified rpc backend is available on your platform.
function check_rpc_backend {
+ local c svc
+
local rpc_needed=1
# We rely on the fact that filenames in lib/* match the service names
# that can be passed as arguments to is_service_enabled.
@@ -138,6 +140,7 @@
# NOTE(bnemec): Retry initial rabbitmq configuration to deal with
# the fact that sometimes it fails to start properly.
# Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1059028
+ local i
for i in `seq 10`; do
if is_fedora || is_suse; then
# service is not started by default
diff --git a/lib/tempest b/lib/tempest
index 5ad2572..bedf9f9 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -354,7 +354,7 @@
fi
if [ $TEMPEST_VOLUME_DRIVER != "default" ]; then
- iniset $TEMPEST_CONFIG volume vendor_name $TEMPEST_VOLUME_VENDOR
+ iniset $TEMPEST_CONFIG volume vendor_name "$TEMPEST_VOLUME_VENDOR"
iniset $TEMPEST_CONFIG volume storage_protocol $TEMPEST_STORAGE_PROTOCOL
fi
@@ -371,6 +371,15 @@
# Baremetal
if [ "$VIRT_DRIVER" = "ironic" ] ; then
iniset $TEMPEST_CONFIG baremetal driver_enabled True
+ iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
+ iniset $TEMPEST_CONFIG compute-feature-enabled console_output False
+ iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False
+ iniset $TEMPEST_CONFIG compute-feature-enabled live_migration False
+ iniset $TEMPEST_CONFIG compute-feature-enabled pause False
+ iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
+ iniset $TEMPEST_CONFIG compute-feature-enabled resize False
+ iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
+ iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
fi
# service_available
diff --git a/lib/trove b/lib/trove
index f6a933e..6877d0f 100644
--- a/lib/trove
+++ b/lib/trove
@@ -204,10 +204,21 @@
# Initialize the trove database
$TROVE_BIN_DIR/trove-manage db_sync
- # Upload the trove-guest image to glance
- TROVE_GUEST_IMAGE_ID=$(upload_image $TROVE_GUEST_IMAGE_URL $TOKEN | grep ' id ' | get_field 2)
+ # If no guest image is specified, skip remaining setup
+ [ -z "$TROVE_GUEST_IMAGE_URL"] && return 0
- # Initialize appropriate datastores / datastore versions
+ # Find the glance id for the trove guest image
+ # The image is uploaded by stack.sh -- see $IMAGE_URLS handling
+ GUEST_IMAGE_NAME=$(basename "$TROVE_GUEST_IMAGE_URL")
+ GUEST_IMAGE_NAME=${GUEST_IMAGE_NAME%.*}
+ TROVE_GUEST_IMAGE_ID=$(glance --os-auth-token $TOKEN --os-image-url http://$GLANCE_HOSTPORT image-list | grep "${GUEST_IMAGE_NAME}" | get_field 1)
+ if [ -z "$TROVE_GUEST_IMAGE_ID" ]; then
+ # If no glance id is found, skip remaining setup
+ echo "Datastore ${TROVE_DATASTORE_TYPE} will not be created: guest image ${GUEST_IMAGE_NAME} not found."
+ return 1
+ fi
+
+ # Now that we have the guest image id, initialize appropriate datastores / datastore versions
$TROVE_BIN_DIR/trove-manage datastore_update "$TROVE_DATASTORE_TYPE" ""
$TROVE_BIN_DIR/trove-manage datastore_version_update "$TROVE_DATASTORE_TYPE" "$TROVE_DATASTORE_VERSION" "$TROVE_DATASTORE_TYPE" \
"$TROVE_GUEST_IMAGE_ID" "$TROVE_DATASTORE_PACKAGE" 1
diff --git a/stack.sh b/stack.sh
index 77b577a..03ecf28 100755
--- a/stack.sh
+++ b/stack.sh
@@ -95,7 +95,7 @@
# ``stackrc`` sources ``localrc`` to allow you to safely override those settings.
if [[ ! -r $TOP_DIR/stackrc ]]; then
- log_error $LINENO "missing $TOP_DIR/stackrc - did you grab more than just stack.sh?"
+ die $LINENO "missing $TOP_DIR/stackrc - did you grab more than just stack.sh?"
fi
source $TOP_DIR/stackrc
@@ -122,13 +122,13 @@
# templates and other useful files in the ``files`` subdirectory
FILES=$TOP_DIR/files
if [ ! -d $FILES ]; then
- log_error $LINENO "missing devstack/files"
+ die $LINENO "missing devstack/files"
fi
# ``stack.sh`` keeps function libraries here
# Make sure ``$TOP_DIR/lib`` directory is present
if [ ! -d $TOP_DIR/lib ]; then
- log_error $LINENO "missing devstack/lib"
+ die $LINENO "missing devstack/lib"
fi
# Import common services (database, message queue) configuration
diff --git a/stackrc b/stackrc
index 7f13232..fb84366 100644
--- a/stackrc
+++ b/stackrc
@@ -386,7 +386,7 @@
# Trove needs a custom image for it's work
if [[ "$ENABLED_SERVICES" =~ 'tr-api' ]]; then
case "$VIRT_DRIVER" in
- libvirt|baremetal|ironic)
+ libvirt|baremetal|ironic|xenapi)
TROVE_GUEST_IMAGE_URL=${TROVE_GUEST_IMAGE_URL:-"http://tarballs.openstack.org/trove/images/ubuntu_mysql.qcow2/ubuntu_mysql.qcow2"}
IMAGE_URLS+=",${TROVE_GUEST_IMAGE_URL}"
;;
diff --git a/tools/build_bm.sh b/tools/build_bm.sh
deleted file mode 100755
index ab0ba0e..0000000
--- a/tools/build_bm.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env bash
-
-# **build_bm.sh**
-
-# Build an OpenStack install on a bare metal machine.
-set +x
-
-# Keep track of the current directory
-TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
-
-# Import common functions
-source $TOP_DIR/functions
-
-# Source params
-source ./stackrc
-
-# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova"
-STACKSH_PARAMS=${STACKSH_PARAMS:-}
-
-# Option to use the version of devstack on which we are currently working
-USE_CURRENT_DEVSTACK=${USE_CURRENT_DEVSTACK:-1}
-
-# Configure the runner
-RUN_SH=`mktemp`
-cat > $RUN_SH <<EOF
-#!/usr/bin/env bash
-# Install and run stack.sh
-cd devstack
-$STACKSH_PARAMS ./stack.sh
-EOF
-
-# Make the run.sh executable
-chmod 755 $RUN_SH
-
-scp -r . root@$CONTAINER_IP:devstack
-scp $RUN_SH root@$CONTAINER_IP:$RUN_SH
-ssh root@$CONTAINER_IP $RUN_SH
diff --git a/tools/build_bm_multi.sh b/tools/build_bm_multi.sh
deleted file mode 100755
index 328d576..0000000
--- a/tools/build_bm_multi.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-
-# **build_bm_multi.sh**
-
-# Build an OpenStack install on several bare metal machines.
-SHELL_AFTER_RUN=no
-
-# Variables common amongst all hosts in the cluster
-COMMON_VARS="MYSQL_HOST=$HEAD_HOST RABBIT_HOST=$HEAD_HOST GLANCE_HOSTPORT=$HEAD_HOST:9292 NETWORK_MANAGER=FlatDHCPManager FLAT_INTERFACE=eth0 FLOATING_RANGE=$FLOATING_RANGE MULTI_HOST=1 SHELL_AFTER_RUN=$SHELL_AFTER_RUN"
-
-# Helper to launch containers
-function run_bm {
- # For some reason container names with periods can cause issues :/
- CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_NETMASK=$NETMASK CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $3" ./tools/build_bm.sh
-}
-
-# Launch the head node - headnode uses a non-ip domain name,
-# because rabbit won't launch with an ip addr hostname :(
-run_bm STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,horizon,mysql,rabbit"
-
-# Wait till the head node is up
-if [ ! "$TERMINATE" = "1" ]; then
- echo "Waiting for head node ($HEAD_HOST) to start..."
- if ! timeout 60 sh -c "while ! wget -q -O- http://$HEAD_HOST | grep -q username; do sleep 1; done"; then
- echo "Head node did not start"
- exit 1
- fi
-fi
-
-PIDS=""
-# Launch the compute hosts in parallel
-for compute_host in ${COMPUTE_HOSTS//,/ }; do
- run_bm $compute_host $compute_host "ENABLED_SERVICES=n-cpu,n-net,n-api" &
- PIDS="$PIDS $!"
-done
-
-for x in $PIDS; do
- wait $x
-done
-echo "build_bm_multi complete"
diff --git a/tools/build_pxe_env.sh b/tools/build_pxe_env.sh
deleted file mode 100755
index 50d91d0..0000000
--- a/tools/build_pxe_env.sh
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/bin/bash -e
-
-# **build_pxe_env.sh**
-
-# Create a PXE boot environment
-#
-# build_pxe_env.sh destdir
-#
-# Requires Ubuntu Oneiric
-#
-# Only needs to run as root if the destdir permissions require it
-
-dpkg -l syslinux || apt-get install -y syslinux
-
-DEST_DIR=${1:-/tmp}/tftpboot
-PXEDIR=${PXEDIR:-/opt/ramstack/pxe}
-PROGDIR=`dirname $0`
-
-# Clean up any resources that may be in use
-function cleanup {
- set +o errexit
-
- # Mop up temporary files
- if [ -n "$MNTDIR" -a -d "$MNTDIR" ]; then
- umount $MNTDIR
- rmdir $MNTDIR
- fi
-
- # Kill ourselves to signal any calling process
- trap 2; kill -2 $$
-}
-
-trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
-
-# Keep track of the current directory
-TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=`cd $TOOLS_DIR/..; pwd`
-
-mkdir -p $DEST_DIR/pxelinux.cfg
-cd $DEST_DIR
-for i in memdisk menu.c32 pxelinux.0; do
- cp -pu /usr/lib/syslinux/$i $DEST_DIR
-done
-
-CFG=$DEST_DIR/pxelinux.cfg/default
-cat >$CFG <<EOF
-default menu.c32
-prompt 0
-timeout 0
-
-MENU TITLE devstack PXE Boot Menu
-
-EOF
-
-# Setup devstack boot
-mkdir -p $DEST_DIR/ubuntu
-if [ ! -d $PXEDIR ]; then
- mkdir -p $PXEDIR
-fi
-
-# Get image into place
-if [ ! -r $PXEDIR/stack-initrd.img ]; then
- cd $TOP_DIR
- $PROGDIR/build_ramdisk.sh $PXEDIR/stack-initrd.img
-fi
-if [ ! -r $PXEDIR/stack-initrd.gz ]; then
- gzip -1 -c $PXEDIR/stack-initrd.img >$PXEDIR/stack-initrd.gz
-fi
-cp -pu $PXEDIR/stack-initrd.gz $DEST_DIR/ubuntu
-
-if [ ! -r $PXEDIR/vmlinuz-*-generic ]; then
- MNTDIR=`mktemp -d --tmpdir mntXXXXXXXX`
- mount -t ext4 -o loop $PXEDIR/stack-initrd.img $MNTDIR
-
- if [ ! -r $MNTDIR/boot/vmlinuz-*-generic ]; then
- echo "No kernel found"
- umount $MNTDIR
- rmdir $MNTDIR
- exit 1
- else
- cp -pu $MNTDIR/boot/vmlinuz-*-generic $PXEDIR
- fi
- umount $MNTDIR
- rmdir $MNTDIR
-fi
-
-# Get generic kernel version
-KNAME=`basename $PXEDIR/vmlinuz-*-generic`
-KVER=${KNAME#vmlinuz-}
-cp -pu $PXEDIR/vmlinuz-$KVER $DEST_DIR/ubuntu
-cat >>$CFG <<EOF
-
-LABEL devstack
- MENU LABEL ^devstack
- MENU DEFAULT
- KERNEL ubuntu/vmlinuz-$KVER
- APPEND initrd=ubuntu/stack-initrd.gz ramdisk_size=2109600 root=/dev/ram0
-EOF
-
-# Get Ubuntu
-if [ -d $PXEDIR -a -r $PXEDIR/natty-base-initrd.gz ]; then
- cp -pu $PXEDIR/natty-base-initrd.gz $DEST_DIR/ubuntu
- cat >>$CFG <<EOF
-
-LABEL ubuntu
- MENU LABEL ^Ubuntu Natty
- KERNEL ubuntu/vmlinuz-$KVER
- APPEND initrd=ubuntu/natty-base-initrd.gz ramdisk_size=419600 root=/dev/ram0
-EOF
-fi
-
-# Local disk boot
-cat >>$CFG <<EOF
-
-LABEL local
- MENU LABEL ^Local disk
- LOCALBOOT 0
-EOF
-
-trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
diff --git a/tools/build_ramdisk.sh b/tools/build_ramdisk.sh
deleted file mode 100755
index 50ba8ef..0000000
--- a/tools/build_ramdisk.sh
+++ /dev/null
@@ -1,230 +0,0 @@
-#!/bin/bash
-
-# **build_ramdisk.sh**
-
-# Build RAM disk images
-
-# Exit on error to stop unexpected errors
-set -o errexit
-
-if [ ! "$#" -eq "1" ]; then
- echo "$0 builds a gziped Ubuntu OpenStack install"
- echo "usage: $0 dest"
- exit 1
-fi
-
-# Clean up any resources that may be in use
-function cleanup {
- set +o errexit
-
- # Mop up temporary files
- if [ -n "$MNTDIR" -a -d "$MNTDIR" ]; then
- umount $MNTDIR
- rmdir $MNTDIR
- fi
- if [ -n "$DEV_FILE_TMP" -a -e "$DEV_FILE_TMP" ]; then
- rm -f $DEV_FILE_TMP
- fi
- if [ -n "$IMG_FILE_TMP" -a -e "$IMG_FILE_TMP" ]; then
- rm -f $IMG_FILE_TMP
- fi
-
- # Release NBD devices
- if [ -n "$NBD" ]; then
- qemu-nbd -d $NBD
- fi
-
- # Kill ourselves to signal any calling process
- trap 2; kill -2 $$
-}
-
-trap cleanup SIGHUP SIGINT SIGTERM
-
-# Set up nbd
-modprobe nbd max_part=63
-
-# Echo commands
-set -o xtrace
-
-IMG_FILE=$1
-
-# Keep track of the current directory
-TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
-
-# Import common functions
-. $TOP_DIR/functions
-
-# Store cwd
-CWD=`pwd`
-
-cd $TOP_DIR
-
-# Source params
-source ./stackrc
-
-CACHEDIR=${CACHEDIR:-/opt/stack/cache}
-
-DEST=${DEST:-/opt/stack}
-
-# Configure the root password of the vm to be the same as ``ADMIN_PASSWORD``
-ROOT_PASSWORD=${ADMIN_PASSWORD:-password}
-
-# Base image (natty by default)
-DIST_NAME=${DIST_NAME:-natty}
-
-# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova"
-STACKSH_PARAMS=${STACKSH_PARAMS:-}
-
-# Option to use the version of devstack on which we are currently working
-USE_CURRENT_DEVSTACK=${USE_CURRENT_DEVSTACK:-1}
-
-# clean install
-if [ ! -r $CACHEDIR/$DIST_NAME-base.img ]; then
- $TOOLS_DIR/get_uec_image.sh $DIST_NAME $CACHEDIR/$DIST_NAME-base.img
-fi
-
-# Finds and returns full device path for the next available NBD device.
-# Exits script if error connecting or none free.
-# map_nbd image
-function map_nbd {
- for i in `seq 0 15`; do
- if [ ! -e /sys/block/nbd$i/pid ]; then
- NBD=/dev/nbd$i
- # Connect to nbd and wait till it is ready
- qemu-nbd -c $NBD $1
- if ! timeout 60 sh -c "while ! [ -e ${NBD}p1 ]; do sleep 1; done"; then
- echo "Couldn't connect $NBD"
- exit 1
- fi
- break
- fi
- done
- if [ -z "$NBD" ]; then
- echo "No free NBD slots"
- exit 1
- fi
- echo $NBD
-}
-
-# Prime image with as many apt as we can
-DEV_FILE=$CACHEDIR/$DIST_NAME-dev.img
-DEV_FILE_TMP=`mktemp $DEV_FILE.XXXXXX`
-if [ ! -r $DEV_FILE ]; then
- cp -p $CACHEDIR/$DIST_NAME-base.img $DEV_FILE_TMP
-
- NBD=`map_nbd $DEV_FILE_TMP`
- MNTDIR=`mktemp -d --tmpdir mntXXXXXXXX`
- mount -t ext4 ${NBD}p1 $MNTDIR
- cp -p /etc/resolv.conf $MNTDIR/etc/resolv.conf
-
- chroot $MNTDIR apt-get install -y --download-only `cat files/apts/* | grep NOPRIME | cut -d\# -f1`
- chroot $MNTDIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1`
-
- # Create a stack user that is a member of the libvirtd group so that stack
- # is able to interact with libvirt.
- chroot $MNTDIR groupadd libvirtd
- chroot $MNTDIR useradd $STACK_USER -s /bin/bash -d $DEST -G libvirtd
- mkdir -p $MNTDIR/$DEST
- chroot $MNTDIR chown $STACK_USER $DEST
-
- # A simple password - pass
- echo $STACK_USER:pass | chroot $MNTDIR chpasswd
- echo root:$ROOT_PASSWORD | chroot $MNTDIR chpasswd
-
- # And has sudo ability (in the future this should be limited to only what
- # stack requires)
- echo "$STACK_USER ALL=(ALL) NOPASSWD: ALL" >> $MNTDIR/etc/sudoers
-
- umount $MNTDIR
- rmdir $MNTDIR
- qemu-nbd -d $NBD
- NBD=""
- mv $DEV_FILE_TMP $DEV_FILE
-fi
-rm -f $DEV_FILE_TMP
-
-
-# Clone git repositories onto the system
-# ======================================
-
-IMG_FILE_TMP=`mktemp $IMG_FILE.XXXXXX`
-
-if [ ! -r $IMG_FILE ]; then
- NBD=`map_nbd $DEV_FILE`
-
- # Pre-create the image file
- # FIXME(dt): This should really get the partition size to
- # pre-create the image file
- dd if=/dev/zero of=$IMG_FILE_TMP bs=1 count=1 seek=$((2*1024*1024*1024))
- # Create filesystem image for RAM disk
- dd if=${NBD}p1 of=$IMG_FILE_TMP bs=1M
-
- qemu-nbd -d $NBD
- NBD=""
- mv $IMG_FILE_TMP $IMG_FILE
-fi
-rm -f $IMG_FILE_TMP
-
-MNTDIR=`mktemp -d --tmpdir mntXXXXXXXX`
-mount -t ext4 -o loop $IMG_FILE $MNTDIR
-cp -p /etc/resolv.conf $MNTDIR/etc/resolv.conf
-
-# We need to install a non-virtual kernel and modules to boot from
-if [ ! -r "`ls $MNTDIR/boot/vmlinuz-*-generic | head -1`" ]; then
- chroot $MNTDIR apt-get install -y linux-generic
-fi
-
-git_clone $NOVA_REPO $DEST/nova $NOVA_BRANCH
-git_clone $GLANCE_REPO $DEST/glance $GLANCE_BRANCH
-git_clone $KEYSTONE_REPO $DEST/keystone $KEYSTONE_BRANCH
-git_clone $NOVNC_REPO $DEST/novnc $NOVNC_BRANCH
-git_clone $HORIZON_REPO $DEST/horizon $HORIZON_BRANCH
-git_clone $NOVACLIENT_REPO $DEST/python-novaclient $NOVACLIENT_BRANCH
-git_clone $OPENSTACKX_REPO $DEST/openstackx $OPENSTACKX_BRANCH
-
-# Use this version of devstack
-rm -rf $MNTDIR/$DEST/devstack
-cp -pr $CWD $MNTDIR/$DEST/devstack
-chroot $MNTDIR chown -R $STACK_USER $DEST/devstack
-
-# Configure host network for DHCP
-mkdir -p $MNTDIR/etc/network
-cat > $MNTDIR/etc/network/interfaces <<EOF
-auto lo
-iface lo inet loopback
-
-auto eth0
-iface eth0 inet dhcp
-EOF
-
-# Set hostname
-echo "ramstack" >$MNTDIR/etc/hostname
-echo "127.0.0.1 localhost ramstack" >$MNTDIR/etc/hosts
-
-# Configure the runner
-RUN_SH=$MNTDIR/$DEST/run.sh
-cat > $RUN_SH <<EOF
-#!/usr/bin/env bash
-
-# Get IP range
-set \`ip addr show dev eth0 | grep inet\`
-PREFIX=\`echo \$2 | cut -d. -f1,2,3\`
-export FLOATING_RANGE="\$PREFIX.224/27"
-
-# Kill any existing screens
-killall screen
-
-# Run stack.sh
-cd $DEST/devstack && \$STACKSH_PARAMS ./stack.sh > $DEST/run.sh.log
-echo >> $DEST/run.sh.log
-echo >> $DEST/run.sh.log
-echo "All done! Time to start clicking." >> $DEST/run.sh.log
-EOF
-
-# Make the run.sh executable
-chmod 755 $RUN_SH
-chroot $MNTDIR chown $STACK_USER $DEST/run.sh
-
-umount $MNTDIR
-rmdir $MNTDIR
diff --git a/tools/build_uec_ramdisk.sh b/tools/build_uec_ramdisk.sh
deleted file mode 100755
index 5f3acc5..0000000
--- a/tools/build_uec_ramdisk.sh
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/usr/bin/env bash
-
-# **build_uec_ramdisk.sh**
-
-# Build RAM disk images based on UEC image
-
-# Exit on error to stop unexpected errors
-set -o errexit
-
-if [ ! "$#" -eq "1" ]; then
- echo "$0 builds a gziped Ubuntu OpenStack install"
- echo "usage: $0 dest"
- exit 1
-fi
-
-# Make sure that we have the proper version of ubuntu (only works on oneiric)
-if ! egrep -q "oneiric" /etc/lsb-release; then
- echo "This script only works with ubuntu oneiric."
- exit 1
-fi
-
-# Clean up resources that may be in use
-function cleanup {
- set +o errexit
-
- if [ -n "$MNT_DIR" ]; then
- umount $MNT_DIR/dev
- umount $MNT_DIR
- fi
-
- if [ -n "$DEST_FILE_TMP" ]; then
- rm $DEST_FILE_TMP
- fi
-
- # Kill ourselves to signal parents
- trap 2; kill -2 $$
-}
-
-trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
-
-# Output dest image
-DEST_FILE=$1
-
-# Keep track of the current directory
-TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
-
-# Import common functions
-. $TOP_DIR/functions
-
-cd $TOP_DIR
-
-# Source params
-source ./stackrc
-
-DEST=${DEST:-/opt/stack}
-
-# Ubuntu distro to install
-DIST_NAME=${DIST_NAME:-oneiric}
-
-# Configure how large the VM should be
-GUEST_SIZE=${GUEST_SIZE:-2G}
-
-# Exit on error to stop unexpected errors
-set -o errexit
-set -o xtrace
-
-# Abort if localrc is not set
-if [ ! -e $TOP_DIR/localrc ]; then
- echo "You must have a localrc with ALL necessary passwords defined before proceeding."
- echo "See stack.sh for required passwords."
- exit 1
-fi
-
-# Install deps if needed
-DEPS="kvm libvirt-bin kpartx cloud-utils curl"
-apt_get install -y --force-yes $DEPS
-
-# Where to store files and instances
-CACHEDIR=${CACHEDIR:-/opt/stack/cache}
-WORK_DIR=${WORK_DIR:-/opt/ramstack}
-
-# Where to store images
-image_dir=$WORK_DIR/images/$DIST_NAME
-mkdir -p $image_dir
-
-# Get the base image if it does not yet exist
-if [ ! -e $image_dir/disk ]; then
- $TOOLS_DIR/get_uec_image.sh -r 2000M $DIST_NAME $image_dir/disk
-fi
-
-# Configure the root password of the vm to be the same as ``ADMIN_PASSWORD``
-ROOT_PASSWORD=${ADMIN_PASSWORD:-password}
-
-# Name of our instance, used by libvirt
-GUEST_NAME=${GUEST_NAME:-devstack}
-
-# Pre-load the image with basic environment
-if [ ! -e $image_dir/disk-primed ]; then
- cp $image_dir/disk $image_dir/disk-primed
- $TOOLS_DIR/warm_apts_for_uec.sh $image_dir/disk-primed
- $TOOLS_DIR/copy_dev_environment_to_uec.sh $image_dir/disk-primed
-fi
-
-# Back to devstack
-cd $TOP_DIR
-
-DEST_FILE_TMP=`mktemp $DEST_FILE.XXXXXX`
-MNT_DIR=`mktemp -d --tmpdir mntXXXXXXXX`
-cp $image_dir/disk-primed $DEST_FILE_TMP
-mount -t ext4 -o loop $DEST_FILE_TMP $MNT_DIR
-mount -o bind /dev /$MNT_DIR/dev
-cp -p /etc/resolv.conf $MNT_DIR/etc/resolv.conf
-echo root:$ROOT_PASSWORD | chroot $MNT_DIR chpasswd
-touch $MNT_DIR/$DEST/.ramdisk
-
-# We need to install a non-virtual kernel and modules to boot from
-if [ ! -r "`ls $MNT_DIR/boot/vmlinuz-*-generic | head -1`" ]; then
- chroot $MNT_DIR apt-get install -y linux-generic
-fi
-
-git_clone $NOVA_REPO $DEST/nova $NOVA_BRANCH
-git_clone $GLANCE_REPO $DEST/glance $GLANCE_BRANCH
-git_clone $KEYSTONE_REPO $DEST/keystone $KEYSTONE_BRANCH
-git_clone $NOVNC_REPO $DEST/novnc $NOVNC_BRANCH
-git_clone $HORIZON_REPO $DEST/horizon $HORIZON_BRANCH
-git_clone $NOVACLIENT_REPO $DEST/python-novaclient $NOVACLIENT_BRANCH
-git_clone $OPENSTACKX_REPO $DEST/openstackx $OPENSTACKX_BRANCH
-git_clone $TEMPEST_REPO $DEST/tempest $TEMPEST_BRANCH
-
-# Use this version of devstack
-rm -rf $MNT_DIR/$DEST/devstack
-cp -pr $TOP_DIR $MNT_DIR/$DEST/devstack
-chroot $MNT_DIR chown -R stack $DEST/devstack
-
-# Configure host network for DHCP
-mkdir -p $MNT_DIR/etc/network
-cat > $MNT_DIR/etc/network/interfaces <<EOF
-auto lo
-iface lo inet loopback
-
-auto eth0
-iface eth0 inet dhcp
-EOF
-
-# Set hostname
-echo "ramstack" >$MNT_DIR/etc/hostname
-echo "127.0.0.1 localhost ramstack" >$MNT_DIR/etc/hosts
-
-# Configure the runner
-RUN_SH=$MNT_DIR/$DEST/run.sh
-cat > $RUN_SH <<EOF
-#!/usr/bin/env bash
-
-# Get IP range
-set \`ip addr show dev eth0 | grep inet\`
-PREFIX=\`echo \$2 | cut -d. -f1,2,3\`
-export FLOATING_RANGE="\$PREFIX.224/27"
-
-# Kill any existing screens
-killall screen
-
-# Run stack.sh
-cd $DEST/devstack && \$STACKSH_PARAMS ./stack.sh > $DEST/run.sh.log
-echo >> $DEST/run.sh.log
-echo >> $DEST/run.sh.log
-echo "All done! Time to start clicking." >> $DEST/run.sh.log
-EOF
-
-# Make the run.sh executable
-chmod 755 $RUN_SH
-chroot $MNT_DIR chown stack $DEST/run.sh
-
-umount $MNT_DIR/dev
-umount $MNT_DIR
-rmdir $MNT_DIR
-mv $DEST_FILE_TMP $DEST_FILE
-rm -f $DEST_FILE_TMP
-
-trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT
diff --git a/tools/build_usb_boot.sh b/tools/build_usb_boot.sh
deleted file mode 100755
index c97e0a1..0000000
--- a/tools/build_usb_boot.sh
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/bin/bash -e
-
-# **build_usb_boot.sh**
-
-# Create a syslinux boot environment
-#
-# build_usb_boot.sh destdev
-#
-# Assumes syslinux is installed
-# Needs to run as root
-
-DEST_DIR=${1:-/tmp/syslinux-boot}
-PXEDIR=${PXEDIR:-/opt/ramstack/pxe}
-
-# Clean up any resources that may be in use
-function cleanup {
- set +o errexit
-
- # Mop up temporary files
- if [ -n "$DEST_DEV" ]; then
- umount $DEST_DIR
- rmdir $DEST_DIR
- fi
- if [ -n "$MNTDIR" -a -d "$MNTDIR" ]; then
- umount $MNTDIR
- rmdir $MNTDIR
- fi
-
- # Kill ourselves to signal any calling process
- trap 2; kill -2 $$
-}
-
-trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
-
-# Keep track of the current directory
-TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=`cd $TOOLS_DIR/..; pwd`
-
-if [ -b $DEST_DIR ]; then
- # We have a block device, install syslinux and mount it
- DEST_DEV=$DEST_DIR
- DEST_DIR=`mktemp -d --tmpdir mntXXXXXX`
- mount $DEST_DEV $DEST_DIR
-
- if [ ! -d $DEST_DIR/syslinux ]; then
- mkdir -p $DEST_DIR/syslinux
- fi
-
- # Install syslinux on the device
- syslinux --install --directory syslinux $DEST_DEV
-else
- # We have a directory (for sanity checking output)
- DEST_DEV=""
- if [ ! -d $DEST_DIR/syslinux ]; then
- mkdir -p $DEST_DIR/syslinux
- fi
-fi
-
-# Get some more stuff from syslinux
-for i in memdisk menu.c32; do
- cp -pu /usr/lib/syslinux/$i $DEST_DIR/syslinux
-done
-
-CFG=$DEST_DIR/syslinux/syslinux.cfg
-cat >$CFG <<EOF
-default /syslinux/menu.c32
-prompt 0
-timeout 0
-
-MENU TITLE devstack Boot Menu
-
-EOF
-
-# Setup devstack boot
-mkdir -p $DEST_DIR/ubuntu
-if [ ! -d $PXEDIR ]; then
- mkdir -p $PXEDIR
-fi
-
-# Get image into place
-if [ ! -r $PXEDIR/stack-initrd.img ]; then
- cd $TOP_DIR
- $TOOLS_DIR/build_uec_ramdisk.sh $PXEDIR/stack-initrd.img
-fi
-if [ ! -r $PXEDIR/stack-initrd.gz ]; then
- gzip -1 -c $PXEDIR/stack-initrd.img >$PXEDIR/stack-initrd.gz
-fi
-cp -pu $PXEDIR/stack-initrd.gz $DEST_DIR/ubuntu
-
-if [ ! -r $PXEDIR/vmlinuz-*-generic ]; then
- MNTDIR=`mktemp -d --tmpdir mntXXXXXXXX`
- mount -t ext4 -o loop $PXEDIR/stack-initrd.img $MNTDIR
-
- if [ ! -r $MNTDIR/boot/vmlinuz-*-generic ]; then
- echo "No kernel found"
- umount $MNTDIR
- rmdir $MNTDIR
- if [ -n "$DEST_DEV" ]; then
- umount $DEST_DIR
- rmdir $DEST_DIR
- fi
- exit 1
- else
- cp -pu $MNTDIR/boot/vmlinuz-*-generic $PXEDIR
- fi
- umount $MNTDIR
- rmdir $MNTDIR
-fi
-
-# Get generic kernel version
-KNAME=`basename $PXEDIR/vmlinuz-*-generic`
-KVER=${KNAME#vmlinuz-}
-cp -pu $PXEDIR/vmlinuz-$KVER $DEST_DIR/ubuntu
-cat >>$CFG <<EOF
-
-LABEL devstack
- MENU LABEL ^devstack
- MENU DEFAULT
- KERNEL /ubuntu/vmlinuz-$KVER
- APPEND initrd=/ubuntu/stack-initrd.gz ramdisk_size=2109600 root=/dev/ram0
-EOF
-
-# Get Ubuntu
-if [ -d $PXEDIR -a -r $PXEDIR/natty-base-initrd.gz ]; then
- cp -pu $PXEDIR/natty-base-initrd.gz $DEST_DIR/ubuntu
- cat >>$CFG <<EOF
-
-LABEL ubuntu
- MENU LABEL ^Ubuntu Natty
- KERNEL /ubuntu/vmlinuz-$KVER
- APPEND initrd=/ubuntu/natty-base-initrd.gz ramdisk_size=419600 root=/dev/ram0
-EOF
-fi
-
-# Local disk boot
-cat >>$CFG <<EOF
-
-LABEL local
- MENU LABEL ^Local disk
- LOCALBOOT 0
-EOF
-
-if [ -n "$DEST_DEV" ]; then
- umount $DEST_DIR
- rmdir $DEST_DIR
-fi
-
-trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT
diff --git a/tools/copy_dev_environment_to_uec.sh b/tools/copy_dev_environment_to_uec.sh
deleted file mode 100755
index 94a4926..0000000
--- a/tools/copy_dev_environment_to_uec.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env bash
-
-# **copy_dev_environment_to_uec.sh**
-
-# Echo commands
-set -o xtrace
-
-# Exit on error to stop unexpected errors
-set -o errexit
-
-# Keep track of the current directory
-TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
-
-# Import common functions
-. $TOP_DIR/functions
-
-# Change dir to top of devstack
-cd $TOP_DIR
-
-# Source params
-source ./stackrc
-
-# Echo usage
-function usage {
- echo "Add stack user and keys"
- echo ""
- echo "Usage: $0 [full path to raw uec base image]"
-}
-
-# Make sure this is a raw image
-if ! qemu-img info $1 | grep -q "file format: raw"; then
- usage
- exit 1
-fi
-
-# Mount the image
-DEST=/opt/stack
-STAGING_DIR=/tmp/`echo $1 | sed "s/\//_/g"`.stage.user
-mkdir -p $STAGING_DIR
-umount $STAGING_DIR || true
-sleep 1
-mount -t ext4 -o loop $1 $STAGING_DIR
-mkdir -p $STAGING_DIR/$DEST
-
-# Create a stack user that is a member of the libvirtd group so that stack
-# is able to interact with libvirt.
-chroot $STAGING_DIR groupadd libvirtd || true
-chroot $STAGING_DIR useradd $STACK_USER -s /bin/bash -d $DEST -G libvirtd || true
-
-# Add a simple password - pass
-echo $STACK_USER:pass | chroot $STAGING_DIR chpasswd
-
-# Configure sudo
-( umask 226 && echo "$STACK_USER ALL=(ALL) NOPASSWD:ALL" \
- > $STAGING_DIR/etc/sudoers.d/50_stack_sh )
-
-# Copy over your ssh keys and env if desired
-cp_it ~/.ssh $STAGING_DIR/$DEST/.ssh
-cp_it ~/.ssh/id_rsa.pub $STAGING_DIR/$DEST/.ssh/authorized_keys
-cp_it ~/.gitconfig $STAGING_DIR/$DEST/.gitconfig
-cp_it ~/.vimrc $STAGING_DIR/$DEST/.vimrc
-cp_it ~/.bashrc $STAGING_DIR/$DEST/.bashrc
-
-# Copy devstack
-rm -rf $STAGING_DIR/$DEST/devstack
-cp_it . $STAGING_DIR/$DEST/devstack
-
-# Give stack ownership over $DEST so it may do the work needed
-chroot $STAGING_DIR chown -R $STACK_USER $DEST
-
-# Unmount
-umount $STAGING_DIR
diff --git a/tools/fixup_stuff.sh b/tools/fixup_stuff.sh
index f1dc76a..8b1e4df 100755
--- a/tools/fixup_stuff.sh
+++ b/tools/fixup_stuff.sh
@@ -124,6 +124,14 @@
if [[ $DISTRO =~ (rhel6) ]]; then
+ # install_pip.sh installs the latest setuptools over the packaged
+ # version. We can't really uninstall the packaged version if it
+ # is there, because it may remove other important things like
+ # cloud-init. Things work, but there can be an old egg file left
+ # around from the package that causes some really strange
+ # setuptools errors. Remove it, if it is there
+ sudo rm -f /usr/lib/python2.6/site-packages/setuptools-0.6*.egg-info
+
# If the ``dbus`` package was installed by DevStack dependencies the
# uuid may not be generated because the service was never started (PR#598200),
# causing Nova to stop later on complaining that ``/var/lib/dbus/machine-id``
diff --git a/tools/get_uec_image.sh b/tools/get_uec_image.sh
deleted file mode 100755
index 225742c..0000000
--- a/tools/get_uec_image.sh
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/bin/bash
-
-# **get_uec_image.sh**
-
-# Download and prepare Ubuntu UEC images
-
-CACHEDIR=${CACHEDIR:-/opt/stack/cache}
-ROOTSIZE=${ROOTSIZE:-2000M}
-
-# Keep track of the current directory
-TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
-
-# Import common functions
-. $TOP_DIR/functions
-
-# Exit on error to stop unexpected errors
-set -o errexit
-set -o xtrace
-
-function usage {
- echo "Usage: $0 - Download and prepare Ubuntu UEC images"
- echo ""
- echo "$0 [-r rootsize] release imagefile [kernel]"
- echo ""
- echo "-r size - root fs size (min 2000MB)"
- echo "release - Ubuntu release: lucid - quantal"
- echo "imagefile - output image file"
- echo "kernel - output kernel"
- exit 1
-}
-
-# Clean up any resources that may be in use
-function cleanup {
- set +o errexit
-
- # Mop up temporary files
- if [ -n "$IMG_FILE_TMP" -a -e "$IMG_FILE_TMP" ]; then
- rm -f $IMG_FILE_TMP
- fi
-
- # Kill ourselves to signal any calling process
- trap 2; kill -2 $$
-}
-
-while getopts hr: c; do
- case $c in
- h) usage
- ;;
- r) ROOTSIZE=$OPTARG
- ;;
- esac
-done
-shift `expr $OPTIND - 1`
-
-if [[ ! "$#" -eq "2" && ! "$#" -eq "3" ]]; then
- usage
-fi
-
-# Default args
-DIST_NAME=$1
-IMG_FILE=$2
-IMG_FILE_TMP=`mktemp $IMG_FILE.XXXXXX`
-KERNEL=$3
-
-case $DIST_NAME in
- saucy) ;;
- raring) ;;
- quantal) ;;
- precise) ;;
- *) echo "Unknown release: $DIST_NAME"
- usage
- ;;
-esac
-
-trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
-
-# Check dependencies
-if [ ! -x "`which qemu-img`" -o -z "`dpkg -l | grep cloud-utils`" ]; then
- # Missing KVM?
- apt_get install qemu-kvm cloud-utils
-fi
-
-# Find resize script
-RESIZE=`which resize-part-image || which uec-resize-image`
-if [ -z "$RESIZE" ]; then
- echo "resize tool from cloud-utils not found"
- exit 1
-fi
-
-# Get the UEC image
-UEC_NAME=$DIST_NAME-server-cloudimg-amd64
-if [ ! -d $CACHEDIR/$DIST_NAME ]; then
- mkdir -p $CACHEDIR/$DIST_NAME
-fi
-if [ ! -e $CACHEDIR/$DIST_NAME/$UEC_NAME.tar.gz ]; then
- (cd $CACHEDIR/$DIST_NAME && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz)
- (cd $CACHEDIR/$DIST_NAME && tar Sxvzf $UEC_NAME.tar.gz)
-fi
-
-$RESIZE $CACHEDIR/$DIST_NAME/$UEC_NAME.img ${ROOTSIZE} $IMG_FILE_TMP
-mv $IMG_FILE_TMP $IMG_FILE
-
-# Copy kernel to destination
-if [ -n "$KERNEL" ]; then
- cp -p $CACHEDIR/$DIST_NAME/*-vmlinuz-virtual $KERNEL
-fi
-
-trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT
diff --git a/tools/install_openvpn.sh b/tools/install_openvpn.sh
deleted file mode 100755
index 9a4f036..0000000
--- a/tools/install_openvpn.sh
+++ /dev/null
@@ -1,221 +0,0 @@
-#!/bin/bash
-
-# **install_openvpn.sh**
-
-# Install OpenVPN and generate required certificates
-#
-# install_openvpn.sh --client name
-# install_openvpn.sh --server [name]
-#
-# name is used on the CN of the generated cert, and the filename of
-# the configuration, certificate and key files.
-#
-# --server mode configures the host with a running OpenVPN server instance
-# --client mode creates a tarball of a client configuration for this server
-
-# Get config file
-if [ -e localrc ]; then
- . localrc
-fi
-if [ -e vpnrc ]; then
- . vpnrc
-fi
-
-# Do some IP manipulation
-function cidr2netmask {
- set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
- if [[ $1 -gt 1 ]]; then
- shift $1
- else
- shift
- fi
- echo ${1-0}.${2-0}.${3-0}.${4-0}
-}
-
-FIXED_NET=`echo $FIXED_RANGE | cut -d'/' -f1`
-FIXED_CIDR=`echo $FIXED_RANGE | cut -d'/' -f2`
-FIXED_MASK=`cidr2netmask $FIXED_CIDR`
-
-# VPN Config
-VPN_SERVER=${VPN_SERVER:-`ifconfig eth0 | awk "/inet addr:/ { print \$2 }" | cut -d: -f2`} # 50.56.12.212
-VPN_PROTO=${VPN_PROTO:-tcp}
-VPN_PORT=${VPN_PORT:-6081}
-VPN_DEV=${VPN_DEV:-tap0}
-VPN_BRIDGE=${VPN_BRIDGE:-br100}
-VPN_BRIDGE_IF=${VPN_BRIDGE_IF:-$FLAT_INTERFACE}
-VPN_CLIENT_NET=${VPN_CLIENT_NET:-$FIXED_NET}
-VPN_CLIENT_MASK=${VPN_CLIENT_MASK:-$FIXED_MASK}
-VPN_CLIENT_DHCP="${VPN_CLIENT_DHCP:-net.1 net.254}"
-
-VPN_DIR=/etc/openvpn
-CA_DIR=$VPN_DIR/easy-rsa
-
-function usage {
- echo "$0 - OpenVPN install and certificate generation"
- echo ""
- echo "$0 --client name"
- echo "$0 --server [name]"
- echo ""
- echo " --server mode configures the host with a running OpenVPN server instance"
- echo " --client mode creates a tarball of a client configuration for this server"
- exit 1
-}
-
-if [ -z $1 ]; then
- usage
-fi
-
-# Install OpenVPN
-VPN_EXEC=`which openvpn`
-if [ -z "$VPN_EXEC" -o ! -x "$VPN_EXEC" ]; then
- apt-get install -y openvpn bridge-utils
-fi
-if [ ! -d $CA_DIR ]; then
- cp -pR /usr/share/doc/openvpn/examples/easy-rsa/2.0/ $CA_DIR
-fi
-
-# Keep track of the current directory
-TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=$(cd $TOOLS_DIR/.. && pwd)
-
-WEB_DIR=$TOP_DIR/../vpn
-if [[ ! -d $WEB_DIR ]]; then
- mkdir -p $WEB_DIR
-fi
-WEB_DIR=$(cd $TOP_DIR/../vpn && pwd)
-
-cd $CA_DIR
-source ./vars
-
-# Override the defaults
-export KEY_COUNTRY="US"
-export KEY_PROVINCE="TX"
-export KEY_CITY="SanAntonio"
-export KEY_ORG="Cloudbuilders"
-export KEY_EMAIL="rcb@lists.rackspace.com"
-
-if [ ! -r $CA_DIR/keys/dh1024.pem ]; then
- # Initialize a new CA
- $CA_DIR/clean-all
- $CA_DIR/build-dh
- $CA_DIR/pkitool --initca
- openvpn --genkey --secret $CA_DIR/keys/ta.key ## Build a TLS key
-fi
-
-function do_server {
- NAME=$1
- # Generate server certificate
- $CA_DIR/pkitool --server $NAME
-
- (cd $CA_DIR/keys;
- cp $NAME.crt $NAME.key ca.crt dh1024.pem ta.key $VPN_DIR
- )
- cat >$VPN_DIR/br-up <<EOF
-#!/bin/bash
-
-BR="$VPN_BRIDGE"
-TAP="\$1"
-
-if [[ ! -d /sys/class/net/\$BR ]]; then
- brctl addbr \$BR
-fi
-
-for t in \$TAP; do
- openvpn --mktun --dev \$t
- brctl addif \$BR \$t
- ifconfig \$t 0.0.0.0 promisc up
-done
-EOF
- chmod +x $VPN_DIR/br-up
- cat >$VPN_DIR/br-down <<EOF
-#!/bin/bash
-
-BR="$VPN_BRIDGE"
-TAP="\$1"
-
-for i in \$TAP; do
- brctl delif \$BR $t
- openvpn --rmtun --dev \$i
-done
-EOF
- chmod +x $VPN_DIR/br-down
- cat >$VPN_DIR/$NAME.conf <<EOF
-proto $VPN_PROTO
-port $VPN_PORT
-dev $VPN_DEV
-up $VPN_DIR/br-up
-down $VPN_DIR/br-down
-cert $NAME.crt
-key $NAME.key # This file should be kept secret
-ca ca.crt
-dh dh1024.pem
-duplicate-cn
-server-bridge $VPN_CLIENT_NET $VPN_CLIENT_MASK $VPN_CLIENT_DHCP
-ifconfig-pool-persist ipp.txt
-comp-lzo
-user nobody
-group nogroup
-persist-key
-persist-tun
-status openvpn-status.log
-EOF
- /etc/init.d/openvpn restart
-}
-
-function do_client {
- NAME=$1
- # Generate a client certificate
- $CA_DIR/pkitool $NAME
-
- TMP_DIR=`mktemp -d`
- (cd $CA_DIR/keys;
- cp -p ca.crt ta.key $NAME.key $NAME.crt $TMP_DIR
- )
- if [ -r $VPN_DIR/hostname ]; then
- HOST=`cat $VPN_DIR/hostname`
- else
- HOST=`hostname`
- fi
- cat >$TMP_DIR/$HOST.conf <<EOF
-proto $VPN_PROTO
-port $VPN_PORT
-dev $VPN_DEV
-cert $NAME.crt
-key $NAME.key # This file should be kept secret
-ca ca.crt
-client
-remote $VPN_SERVER $VPN_PORT
-resolv-retry infinite
-nobind
-user nobody
-group nogroup
-persist-key
-persist-tun
-comp-lzo
-verb 3
-EOF
- (cd $TMP_DIR; tar cf $WEB_DIR/$NAME.tar *)
- rm -rf $TMP_DIR
- echo "Client certificate and configuration is in $WEB_DIR/$NAME.tar"
-}
-
-# Process command line args
-case $1 in
- --client) if [ -z $2 ]; then
- usage
- fi
- do_client $2
- ;;
- --server) if [ -z $2 ]; then
- NAME=`hostname`
- else
- NAME=$2
- # Save for --client use
- echo $NAME >$VPN_DIR/hostname
- fi
- do_server $NAME
- ;;
- --clean) $CA_DIR/clean-all
- ;;
- *) usage
-esac
diff --git a/tools/warm_apts_for_uec.sh b/tools/warm_apts_for_uec.sh
deleted file mode 100755
index c57fc2e..0000000
--- a/tools/warm_apts_for_uec.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env bash
-
-# **warm_apts_for_uec.sh**
-
-# Echo commands
-set -o xtrace
-
-# Exit on error to stop unexpected errors
-set -o errexit
-
-# Keep track of the current directory
-TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=`cd $TOOLS_DIR/..; pwd`
-
-# Change dir to top of devstack
-cd $TOP_DIR
-
-# Echo usage
-function usage {
- echo "Cache OpenStack dependencies on a uec image to speed up performance."
- echo ""
- echo "Usage: $0 [full path to raw uec base image]"
-}
-
-# Make sure this is a raw image
-if ! qemu-img info $1 | grep -q "file format: raw"; then
- usage
- exit 1
-fi
-
-# Make sure we are in the correct dir
-if [ ! -d files/apts ]; then
- echo "Please run this script from devstack/tools/"
- exit 1
-fi
-
-# Mount the image
-STAGING_DIR=/tmp/`echo $1 | sed "s/\//_/g"`.stage
-mkdir -p $STAGING_DIR
-umount $STAGING_DIR || true
-sleep 1
-mount -t ext4 -o loop $1 $STAGING_DIR
-
-# Make sure that base requirements are installed
-cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf
-
-# Perform caching on the base image to speed up subsequent runs
-chroot $STAGING_DIR apt-get update
-chroot $STAGING_DIR apt-get install -y --download-only `cat files/apts/* | grep NOPRIME | cut -d\# -f1`
-chroot $STAGING_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1` || true
-
-# Unmount
-umount $STAGING_DIR