diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index efc336a5..00000000
--- a/.gitignore
+++ /dev/null
@@ -1,72 +0,0 @@
-*.py[cod]
-
-# C extensions
-*.so
-
-# Packages
-*.egg
-*.egg-info
-dist
-build
-.eggs
-eggs
-parts
-bin
-var
-sdist
-develop-eggs
-.installed.cfg
-.DS_Store
-
-# Installer logs
-pip-log.txt
-
-# Unit test / coverage reports
-.coverage
-.tox
-nosetests.xml
-.testrepository
-.venv
-
-# Translations
-*.mo
-
-# Mr Developer
-.mr.developer.cfg
-.project
-.pydevproject
-
-# Complexity
-output/*.html
-output/*/index.html
-
-# Sphinx
-doc/build
-
-# pbr generates these
-AUTHORS
-ChangeLog
-
-# Editors
-*~
-.*.swp
-.*sw?
-
-# Others
-*.log
-*.sqlite
-tenvironment
-.ropeproject/
-
-# Labs artifacts
-labs/osbash/autostart/
-labs/osbash/img/
-labs/osbash/log/
-labs/osbash/wbatch/
-labs/osbash/lib/vagrant-ssh-keys/
-labs/osbash/test_tmp/
-
-labs/autostart/
-labs/img/
-labs/log/
-labs/wbatch/
diff --git a/.zuul.yaml b/.zuul.yaml
deleted file mode 100644
index 554a9f7c..00000000
--- a/.zuul.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-- project:
- check:
- jobs:
- - training-labs-scripts
- gate:
- jobs:
- - training-labs-scripts
-
- post:
- jobs:
- - publish-training-labs-scripts
-- job:
- name: training-labs-scripts
- description: |
- Build scripts for training-labs repository.
- parent: unittests
- run: playbooks/scripts/run.yaml
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
deleted file mode 100644
index 8d0fc61f..00000000
--- a/CONTRIBUTING.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-If you would like to contribute to the development of OpenStack, you must
-follow the steps in this page:
-
- http://docs.openstack.org/infra/manual/developers.html
-
-If you already have a good understanding of how the system works and your
-OpenStack accounts are set up, you can skip to the development workflow
-section of this documentation to learn how changes to OpenStack should be
-submitted for review via the Gerrit tool:
-
- http://docs.openstack.org/infra/manual/developers.html#development-workflow
-
-Pull requests submitted through GitHub will be ignored.
-
-Bugs should be filed on Launchpad, not GitHub:
-
- https://bugs.launchpad.net/labs
diff --git a/HACKING.rst b/HACKING.rst
deleted file mode 100644
index 1b324a30..00000000
--- a/HACKING.rst
+++ /dev/null
@@ -1,134 +0,0 @@
-Contributing to replace-labs scripts
-====================================
-
-First things first
-------------------
-
-Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/
-
-General
--------
-
-Contributing code to replace labs scripts follows the usual OpenStack process
-as described in `How To Contribute`__ in the OpenStack wiki.
-Our `main blueprint`__ contains the usual links for blueprints, bugs, etc.
-
-__ contribute_
-.. _contribute: http://docs.openstack.org/infra/manual/developers.html
-
-__ spec_
-.. _spec: http://specs.openstack.org/openstack/docs-specs/specs/liberty/traininglabs.html
-
-Getting started
----------------
-
-.. TODO(psalunke): Fix Me. Add more content here.
-
-Prerequisites
--------------
-
-.. TODO(psalunke): Fix Me. Add more content here.
-
-Coding style
-------------
-
-We follow the conventions of other OpenStack projects.
-
-StackTrain
-~~~~~~~~~~
-
-.. TODO(psalunke): Fix me. Add more content here.
-
-Osbash
-~~~~~~
-
-Osbash is written in BASH and follows conventions of DevStack:
-`devstack `_.
-
-DevStack bash style guidelines can be found at the bottom of:
-https://opendev.org/openstack/devstack/src/branch/master/HACKING.rst
-
-Structure
----------
-
-
-.. TODO(psalunke): Add more information as the repo gets merged.
-
-OSBASH:
-~~~~~~~
-
-**autostart**
-
-osbash/wbatch copy shell scripts (\*.sh) into this directory to have them
-automatically executed (and removed) upon boot.
-
-**config**
-
-Contains the configuration files for all the scripts. The setup can be customized here.
-
-**img**
-
-By default osbash will put into this directory its base disk images
-(base-\*-.vdi), the VM export images (labs-.ova),
-and all installation ISO images it may download.
-
-**lib**
-
-This directory contains bash libraries used by scripts.
-
-**log**
-
-Contains the log files written (and removed) by osbash/wbatch and
-the scripts running within the VMs.
-
-**scripts**
-
-All scripts in this directory run within the VMs.
-
-**wbatch**
-
-Files in this directory are Windows batch files generated by osbash to
-configure host-only networks, produce a base disk, and build OpenStack
-replace-labs VMs as configured when osbash created them.
-
-Testing
--------
-
-Useful tools for checking scripts:
-
-- `bashate `_ (must pass)
-- `shellcheck `_ (optional)
-
-.. TODO (psalunke): Add Python checks etc.
-
-Submitting patches
-------------------
-
-These documents will help you submit patches to OpenStack projects (including
-this one):
-
-- https://docs.openstack.org/infra/manual/developers.html#development-workflow
-- https://wiki.openstack.org/wiki/GitCommitMessages
-
-If you change the behavior of the scripts as documented in the replace-guides,
-add a DocImpact flag to alert the documentation team. For instance, add a line
-like this to your commit message:
-
-DocImpact new option added to osbash.sh
-
-- https://wiki.openstack.org/wiki/Documentation/DocImpact
-
-Reviewing
----------
-
-Learn how to review (or what to expect when having your patches reviewed) here:
-- https://docs.openstack.org/infra/manual/developers.html#development-workflow
-
-TODO
-----
-
-Anything not covered here
--------------------------
-
-Check README.md and get in touch with other scripts developers.
-
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 67db8588..00000000
--- a/LICENSE
+++ /dev/null
@@ -1,175 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
diff --git a/README.rst b/README.rst
index e25da183..6080cfbb 100644
--- a/README.rst
+++ b/README.rst
@@ -1,209 +1,14 @@
-========================
-Team and repository tags
-========================
+This project is no longer maintained.
-.. image:: https://governance.openstack.org/tc/badges/training-labs.svg
- :target: https://governance.openstack.org/tc/reference/tags/index.html
+The contents of this repository are still available in the Git
+source code management system. To see the contents of this
+repository before it reached its end of life, please check out the
+previous commit with "git checkout HEAD^1".
-.. Change things from this point on
+(Optional:)
+For an alternative project, please see at
+.
-=============
-Training labs
-=============
-
-About
------
-
-Training-labs provides an automated way to deploy Vanilla OpenStack, closely
-following the
-`OpenStack Install Guide `_.
-
-Training-labs offers an easy way to set up an OpenStack cluster which is a good
-starting point for beginners to learn OpenStack, and for advanced users to test
-out new features, and check out different capabilities of OpenStack.
-
-On top of that training-labs is also a good way to test the installation
-instructions on a regular basis.
-
-Training-labs is a project under OpenStack Documentation. For more information
-see the
-`OpenStack wiki `_.
-
-* Free software: Apache license
-* `Documentation:openstack-training-labs `_
-* `Source:openstack/training-labs `_
-* `Bugs:openstack-training-labs `_
-* `Release Notes:openstack-training-labs `_
-
-Pre-requisite
--------------
-
-* Download and install `VirtualBox `_.
-
-VirtualBox is the default hypervisor used by training-labs. Alternatively, you can use KVM (just set ``PROVIDER=kvm`` in ``labs/config/localrc``).
-
-
-Getting the Code for an OpenStack Release
------------------------------------------
-
-The current release is master which usually deploys the current stable
-OpenStack release. Unless you have a reason to go with an older release,
-we recommend using master.
-
-For non-development purposes (training, etc.), the easiest way to get the code is through downloading the desired archive from
-`OpenStack Training Labs `_.
-Unpack the archive and you are good to go.
-
-How to run the scripts for GNU/Linux and macOS
-----------------------------------------------
-
-Change directory::
-
- $ cd training-labs/labs/
-
-By default, the cluster is built on Virtualbox VMs.
-
-Run the script by::
-
- $ ./st.py -b cluster
-
-How to run the scripts for Windows
-----------------------------------
-
-The easiest and recommended way to get everything you need besides
-VirtualBox is to download a zip file for Windows from the
-`Training Labs page `_.
-
-The zip files include pre-generated Windows batch files.
-
-Creates the host-only networks used by the node VMs to communicate::
-
- > create_hostnet.bat
-
-Creates the base disk::
-
- > create_base.bat
-
-Creates the node VMs based on the base disk::
-
- > create_ubuntu_cluster_node.bat
-
-What the script installs
-------------------------
-
-Running this will automatically spin up 2 virtual machines in VirtualBox/KVM:
-
-* Controller node
-* Compute node
-
-Now you have a multi-node deployment of OpenStack running with the following services installed.
-
-* Keystone
-* Nova
-* Neutron
-* Glance
-* Cinder
-* Horizon
-
-How to access the services
---------------------------
-
-There are two ways to access the services:
-
-* OpenStack Dashboard (horizon)
-
-You can access the dashboard at: http://10.0.0.11/horizon
-
-Admin Login:
-
-* Username: ``admin``
-* Password: ``admin_pass``
-
-Demo User Login:
-
-* Username: ``demo``
-* Password: ``demo_pass``
-
-You can ssh to each of the nodes by::
-
- # Controller node
- $ ssh osbash@10.0.0.11
-
- # Compute node
- $ ssh osbash@10.0.0.31
-
-Credentials for all nodes:
-
-* Username: ``osbash``
-* Password: ``osbash``
-
-After you have ssh access, you need to source the OpenStack credentials in order to access the services.
-
-Two credential files are present on each of the nodes:
-
-* ``demo-openstackrc.sh``
-* ``admin-openstackrc.sh``
-
-Source the following credential files
-
-For Admin user privileges::
-
- $ source admin-openstackrc.sh
-
-For Demo user privileges::
-
- $ source demo-openstackrc.sh
-
-Note: Instead 'source' you can use '.', or you define an alias.
-Now you can access the OpenStack services via CLI.
-
-Specs
------
-
-To review specifications, see `Training-labs
-`_
-
-Mailing lists, IRC
-------------------
-
-To contribute, join the IRC channel, ``#openstack-doc``, on IRC freenode
-or write an e-mail to the OpenStack Development Mailing List
-``openstack-discuss@lists.openstack.org``. Please use ``[training-labs]`` tag in the
-subject of the email message.
-
-You may have to
-`subscribe to the OpenStack Development Mailing List `_
-to have your mail accepted by the mailing list software.
-
-Sub-team leads
---------------
-
-Feel free to ping Roger, Julen, or Pranav via email or on the IRC channel
-``#openstack-doc`` regarding any queries about training-labs.
-
-* Roger Luethi
-
- * Email: ``rl@patchworkscience.org``
- * IRC: ``rluethi``
-
-* Pranav Salunke
-
- * Email: ``dguitarbite@gmail.com``
- * IRC: ``dguitarbite``
-
-* Julen Larrucea
-
- * Email: ``julen@larrucea.eu``
- * IRC: julen, julenl
-
-Meetings
---------
-
-Training-labs uses the Doc Team Meeting:
-https://wiki.openstack.org/wiki/Meetings/DocTeamMeeting
-
-Wiki
-----
-
-Follow various links on training-labs here:
-https://wiki.openstack.org/wiki/Documentation/training-labs
+For any further questions, please email
+openstack-discuss@lists.openstack.org or join #openstack-dev on
+OFTC.
diff --git a/bindep.txt b/bindep.txt
deleted file mode 100644
index d40e3c3d..00000000
--- a/bindep.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-# Edit this one. Remove all the non-required deps.
-
-asciidoc
-build-essential [platform:dpkg]
-curl
-gawk
-# gettext and graphviz are needed by doc builds only. For transition,
-# have them in both doc and test.
-gettext [doc test]
-graphviz [doc test]
-language-pack-en [platform:ubuntu]
-libcurl-devel [platform:rpm]
-libcurl4-gnutls-dev [platform:dpkg]
-liberasurecode-dev [platform:dpkg]
-liberasurecode-devel [platform:rpm]
-libevent-dev [platform:dpkg]
-libevent-devel [platform:rpm]
-libffi-dev [platform:dpkg]
-libffi-devel [platform:rpm]
-libjerasure-dev [platform:ubuntu-trusty]
-libjpeg-dev [platform:dpkg]
-libjpeg-turbo-devel [platform:rpm]
-libldap2-dev [platform:dpkg]
-libmysqlclient-dev [platform:dpkg]
-libpcap-dev [platform:dpkg]
-libpcap-devel [platform:rpm]
-libpq-dev [platform:dpkg]
-librrd-dev [platform:dpkg]
-libsasl2-dev [platform:dpkg]
-libselinux-python [platform:rpm]
-libsqlite3-dev [platform:dpkg]
-libuuid-devel [platform:rpm]
-libvirt-dev [platform:dpkg]
-libvirt-devel [platform:rpm]
-libvirt-python [platform:rpm]
-libxml2-dev [platform:dpkg]
-libxml2-devel [platform:rpm]
-libxml2-utils [platform:dpkg]
-libxslt-devel [platform:rpm]
-libxslt1-dev [platform:dpkg]
-locales [platform:debian]
-pkg-config [platform:dpkg]
-pkgconfig [platform:rpm]
-pypy [platform:ubuntu-trusty]
-pypy-dev [platform:ubuntu-trusty]
-python-dev [platform:dpkg]
-python-devel [platform:rpm]
-python-libvirt [platform:dpkg]
-python-lxml
-python-zmq
-python3-all-dev [platform:ubuntu-trusty]
-python3-dev [platform:dpkg]
-python3-devel [platform:fedora]
-python3.4 [platform:ubuntu-trusty]
-python34-devel [platform:centos]
-sqlite [platform:rpm]
-sqlite-devel [platform:rpm]
-sqlite3 [platform:dpkg]
-unzip
-uuid-dev [platform:dpkg]
-xsltproc [platform:dpkg]
-zip
-zlib-devel [platform:rpm]
-zlib1g-dev [platform:dpkg]
diff --git a/doc/README.rst b/doc/README.rst
deleted file mode 100644
index 161ebc55..00000000
--- a/doc/README.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-Documentation for training-labs
-===============================
-
-See the "Building the Dcumenation" section of
-doc/source/development.environment.rst.
diff --git a/doc/requirements.txt b/doc/requirements.txt
deleted file mode 100644
index 1189e351..00000000
--- a/doc/requirements.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# The order of packages is significant, because pip processes them in the order
-# of appearance. Changing the order has an impact on the overall integration
-# process, which may cause wedges in the gate later.
-
-sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2 # BSD
-sphinx-testing # BSD
-openstackdocstheme>=1.31.2 # Apache-2.0
diff --git a/doc/source/conf.py b/doc/source/conf.py
deleted file mode 100755
index d1ec67f8..00000000
--- a/doc/source/conf.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- coding: utf-8 -*-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# -- General configuration ----------------------------------------------------
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = [
- 'sphinx.ext.autodoc',
- 'openstackdocs'
-]
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = u'OpenStack Training Labs'
-copyright = u'2013, OpenStack Foundation'
-
-
-# -- Options for HTML output --------------------------------------------------
-
-html_theme = 'openstackdocs'
diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst
deleted file mode 100644
index 1728a61c..00000000
--- a/doc/source/contributing.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-============
-Contributing
-============
-.. include:: ../../CONTRIBUTING.rst
diff --git a/doc/source/index.rst b/doc/source/index.rst
deleted file mode 100644
index fe1b3f40..00000000
--- a/doc/source/index.rst
+++ /dev/null
@@ -1,25 +0,0 @@
-.. labs documentation master file, created by
- sphinx-quickstart on Tue Jul 9 22:26:36 2013.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
-Welcome to labs's documentation!
-========================================================
-
-Contents:
-
-.. toctree::
- :maxdepth: 2
-
- readme
- installation
- usage
- contributing
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
diff --git a/doc/source/installation.rst b/doc/source/installation.rst
deleted file mode 100644
index 34d3e94e..00000000
--- a/doc/source/installation.rst
+++ /dev/null
@@ -1,11 +0,0 @@
-============
-Installation
-============
-
-At the command line::
-
- $ git clone https://git.openstack.org/openstack/training-labs
- $ cd training-labs/labs
- $ ./st.py -h
-
-Make sure that you have VirtualBox installed on your system.
diff --git a/doc/source/readme.rst b/doc/source/readme.rst
deleted file mode 100644
index e69de29b..00000000
diff --git a/doc/source/usage.rst b/doc/source/usage.rst
deleted file mode 100644
index 8124ce43..00000000
--- a/doc/source/usage.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-========
-Usage
-========
-
-
diff --git a/labs.py b/labs.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/labs/.pylintrc b/labs/.pylintrc
deleted file mode 100644
index 6dee9089..00000000
--- a/labs/.pylintrc
+++ /dev/null
@@ -1,55 +0,0 @@
-# The format of this file isn't really documented; just use --generate-rcfile
-[MASTER]
-# Add to the black list. It should be a base name, not a
-# path. You may set this option multiple times.
-ignore=.git,tests
-
-[Messages Control]
-# NOTE(justinsb): We might want to have a 2nd strict pylintrc in future
-# C0111: Don't require docstrings on every method
-# W0511: TODOs in code comments are fine.
-# W0142: *args and **kwargs are fine.
-# W0622: Redefining id is fine.
-disable=C0111,W0511,W0142,W0622
-
-[Basic]
-# Variable names can be 1 to 31 characters long, with lowercase and underscores
-variable-rgx=[a-z_][a-z0-9_]{0,30}$
-
-# Argument names can be 2 to 31 characters long, with lowercase and underscores
-argument-rgx=[a-z_][a-z0-9_]{1,30}$
-
-# Method names should be at least 3 characters long
-# and be lowercased with underscores
-method-rgx=([a-z_][a-z0-9_]{2,50}|setUp|tearDown)$
-
-# Module names
-module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
-
-# Don't require docstrings on tests.
-no-docstring-rgx=((__.*__)|([tT]est.*)|setUp|tearDown)$
-
-[Miscellaneous]
-
-# List of note tags to take in consideration, separated by a comma.
-notes=FIXME
-
-[Format]
-# Maximum number of characters on a single line.
-max-line-length=79
-
-[Design]
-max-public-methods=100
-min-public-methods=0
-max-args=6
-
-[Variables]
-
-# List of additional names supposed to be defined in builtins. Remember that
-# you should avoid to define new builtins when possible.
-# _ is used by our localization
-additional-builtins=_
-
-[REPORTS]
-# Tells whether to display a full report or only the messages
-reports=no
diff --git a/labs/autostart b/labs/autostart
deleted file mode 120000
index bc4b005c..00000000
--- a/labs/autostart
+++ /dev/null
@@ -1 +0,0 @@
-osbash/autostart
\ No newline at end of file
diff --git a/labs/config b/labs/config
deleted file mode 120000
index 0f7441a6..00000000
--- a/labs/config
+++ /dev/null
@@ -1 +0,0 @@
-osbash/config
\ No newline at end of file
diff --git a/labs/lib b/labs/lib
deleted file mode 120000
index 0677a25f..00000000
--- a/labs/lib
+++ /dev/null
@@ -1 +0,0 @@
-osbash/lib
\ No newline at end of file
diff --git a/labs/osbash/autostart/README.rst b/labs/osbash/autostart/README.rst
deleted file mode 100644
index eff56aca..00000000
--- a/labs/osbash/autostart/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-osbash/wbatch copy shell scripts (*.sh) into this directory to have them
-automatically executed (and removed) upon boot.
diff --git a/labs/osbash/config/README.rst b/labs/osbash/config/README.rst
deleted file mode 100644
index 7251284c..00000000
--- a/labs/osbash/config/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-The configuration files in this directory are used by osbash/wbatch and
-by scripts running inside the VMs (scripts directory).
diff --git a/labs/osbash/config/admin-openstackrc.sh b/labs/osbash/config/admin-openstackrc.sh
deleted file mode 100644
index 3351cb38..00000000
--- a/labs/osbash/config/admin-openstackrc.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-# The variables in this file are exported for use by OpenStack client
-# applications.
-
-# Use BASH_SOURCE so the file works when sourced from a shell, too; use
-# $0 to make it work on zsh
-CONFIG_DIR=$(dirname "${BASH_SOURCE[0]:-$0}")
-source "$CONFIG_DIR/openstack"
-source "$CONFIG_DIR/credentials"
-
-#------------------------------------------------------------------------------
-# OpenStack client environment scripts
-# https://docs.openstack.org/keystone/train/install/keystone-openrc-ubuntu.html
-#------------------------------------------------------------------------------
-export OS_USERNAME=$ADMIN_USER_NAME
-export OS_PASSWORD=$ADMIN_PASS
-export OS_PROJECT_NAME=$ADMIN_PROJECT_NAME
-export OS_USER_DOMAIN_NAME=Default
-export OS_PROJECT_DOMAIN_NAME=Default
-export OS_AUTH_URL=http://controller:5000/v3
-export OS_IDENTITY_API_VERSION=3
-export OS_IMAGE_API_VERSION=2
diff --git a/labs/osbash/config/config.base b/labs/osbash/config/config.base
deleted file mode 100644
index d583589e..00000000
--- a/labs/osbash/config/config.base
+++ /dev/null
@@ -1,7 +0,0 @@
-# Base disk VM configuration. Used by osbash/wbatch (host and guest).
-
-# Port forwarding
-VM_SSH_PORT=2229
-
-# Our default RAM size (512 MB) is not sufficient for installation
-VM_MEM=1024
diff --git a/labs/osbash/config/config.compute1 b/labs/osbash/config/config.compute1
deleted file mode 100644
index bc231db4..00000000
--- a/labs/osbash/config/config.compute1
+++ /dev/null
@@ -1,32 +0,0 @@
-# Node VM configuration. Used by osbash/wbatch (host and guest).
-
-# Port forwarding
-# ssh access to compute1: 127.0.0.1:2232
-VM_SSH_PORT=2232
-
-# Assign network interfaces to networks
-NET_IF_0=dhcp
-#------------------------------------------------------------------------------
-# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment-networking-compute.html
-#------------------------------------------------------------------------------
-# Mgmt network (elevate interface boot priority to 1; set when PXE booting)
-NET_IF_1="static 10.0.0.31 1"
-# Public network (select network, IP address configured manually)
-NET_IF_2="manual 203.0.113.0"
-
-#------------------------------------------------------------------------------
-# Size of second disk in MB (/dev/sdb)
-# Test volume is 1 GB; backing volume must be bigger
-SECOND_DISK_SIZE=1280
-
-#------------------------------------------------------------------------------
-# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment.html
-#------------------------------------------------------------------------------
-# Controller node is running many services.
-# A default instance within compute uses 512 MB RAM. The install-guide
-# demands 2048 MB of RAM, but 1024 MB is enough for one CirrOS instance.
-VM_MEM=1024
-
-# Override number of virtual CPUs (default is 1)
-# To edit uncomment the line below
-# VM_CPUS=1
diff --git a/labs/osbash/config/config.controller b/labs/osbash/config/config.controller
deleted file mode 100644
index f3eaa6d7..00000000
--- a/labs/osbash/config/config.controller
+++ /dev/null
@@ -1,27 +0,0 @@
-# Node VM configuration. Used by osbash/wbatch (host and guest).
-
-# Port forwarding
-# ssh access to controller: 127.0.0.1:2230
-VM_SSH_PORT=2230
-# Dashboard access: 127.0.0.1:8888
-VM_WWW_PORT=8888
-
-# Assign network interfaces to networks
-NET_IF_0=dhcp
-#------------------------------------------------------------------------------
-# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment-networking-controller.html
-#------------------------------------------------------------------------------
-# Mgmt network (elevate interface boot priority to 1; set when PXE booting)
-NET_IF_1="static 10.0.0.11 1"
-# Public network (select network, IP address configured manually)
-NET_IF_2="manual 203.0.113.0"
-
-#------------------------------------------------------------------------------
-# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment.html
-#------------------------------------------------------------------------------
-# Controller node is running many services.
-VM_MEM=5120
-
-# Override number of virtual CPUs (default is 1)
-# To edit uncomment the line below
-# VM_CPUS=1
diff --git a/labs/osbash/config/config.pxeserver b/labs/osbash/config/config.pxeserver
deleted file mode 100644
index faecb752..00000000
--- a/labs/osbash/config/config.pxeserver
+++ /dev/null
@@ -1,14 +0,0 @@
-# Node VM configuration. Used by osbash/wbatch (host and guest).
-
-# Port forwarding
-# ssh access to controller: 127.0.0.1:2250
-VM_SSH_PORT=2250
-
-# Assign network interfaces to networks
-NET_IF_0=dhcp
-
-#------------------------------------------------------------------------------
-# Mgmt network
-NET_IF_1="static 10.0.0.100"
-
-PXE_GATEWAY="10.0.0.101"
diff --git a/labs/osbash/config/credentials b/labs/osbash/config/credentials
deleted file mode 100644
index cee6171c..00000000
--- a/labs/osbash/config/credentials
+++ /dev/null
@@ -1,81 +0,0 @@
-# This file contains user names, passwords, and tokens that are set and used
-# by OpenStack applications and related software running in the VMs.
-
-# Note that the VM shell user and its password are not set here. By default,
-# those are hard-coded in the preseed/kickstart files. The scripts get the
-# shell user name from deploy.{osbash} and don't need a password
-# (they use password-less sudo and -- if configured -- ssh keys).
-
-# Used for MySQL or whatever other DBMS is configured
-: ${DATABASE_PASSWORD:=secrete}
-
-# Used for MySQL or whatever other DBMS is configured
-: ${RABBIT_PASS:=rabbitPass}
-
-# Project and role for admin accounts
-: ${ADMIN_ROLE_NAME:=admin}
-: ${ADMIN_PROJECT_NAME:=admin}
-
-# Member role for generic use
-: ${MEMBER_ROLE_NAME:=_member_}
-
-# User name and password for administrator
-: ${ADMIN_USER_NAME:=admin}
-
-#------------------------------------------------------------------------------
-# Passwords for OpenStack services
-# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment-security.html
-#------------------------------------------------------------------------------
-: ${ADMIN_PASS:=admin_user_secret}
-
-: ${CINDER_DB_USER:=cinder}
-: ${CINDER_DBPASS:=cinder_db_secret}
-: ${CINDER_PASS:=cinder_user_secret}
-
-: ${GLANCE_DB_USER:=glance}
-: ${GLANCE_DBPASS:=glance_db_secret}
-: ${GLANCE_PASS:=glance_user_secret}
-
-: ${HEAT_DB_USER:=heat}
-: ${HEAT_DBPASS:=heat_db_secret}
-: ${HEAT_DOMAIN_PASS:=heat_dom_pw}
-: ${HEAT_PASS:=heat_user_secret}
-
-: ${KEYSTONE_DB_USER:=keystone}
-: ${KEYSTONE_DBPASS:=keystone_db_secret}
-
-: ${NEUTRON_DB_USER:=neutron}
-: ${NEUTRON_DBPASS:=neutron_db_secret}
-: ${NEUTRON_PASS:=neutron_user_secret}
-
-: ${NOVA_DB_USER:=nova}
-: ${NOVA_DBPASS:=nova_db_secret}
-: ${NOVA_PASS:=nova_user_secret}
-
-: ${PLACEMENT_DB_USER:=placement}
-: ${PLACEMENT_DBPASS:=placement_db_secret}
-: ${PLACEMENT_PASS:=placement_user_secret}
-
-# Project name, user name and password for normal (demo) user
-: ${DEMO_PROJECT_NAME:=myproject}
-: ${DEMO_USER_NAME:=myuser}
-: ${DEMO_PASS:=myuser_user_pass}
-
-# User role
-: ${USER_ROLE_NAME:=myrole}
-
-# OpenStack Services needs to be affiliated with a tenant to provide
-# authentication to other OpenStack services. We create a "service" tenant for
-# the OpenStack services. All the OpenStack services will be registered via
-# service tenant.
-
-# Project and role for service accounts.
-: ${SERVICE_PROJECT_NAME:=service}
-
-# Domain to use for email addresses (e.g. admin@example.com)
-: ${MAIL_DOMAIN:=example.com}
-
-# Metadata secret used by neutron and nova.
-: ${METADATA_SECRET:=osbash_training}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/config/demo-openstackrc.sh b/labs/osbash/config/demo-openstackrc.sh
deleted file mode 100644
index f8dfd1e7..00000000
--- a/labs/osbash/config/demo-openstackrc.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-# The variables in this file are exported for use by OpenStack client
-# applications.
-
-# Use BASH_SOURCE so the file works when sourced from a shell, too; use
-# $0 to make it work on zsh
-CONFIG_DIR=$(dirname "${BASH_SOURCE[0]:-$0}")
-source "$CONFIG_DIR/openstack"
-source "$CONFIG_DIR/credentials"
-
-#------------------------------------------------------------------------------
-# OpenStack client environment scripts
-# https://docs.openstack.org/keystone/train/install/keystone-openrc-ubuntu.html
-#------------------------------------------------------------------------------
-export OS_USERNAME=$DEMO_USER_NAME
-export OS_PASSWORD=$DEMO_PASS
-export OS_PROJECT_NAME=$DEMO_PROJECT_NAME
-export OS_USER_DOMAIN_NAME=Default
-export OS_PROJECT_DOMAIN_NAME=Default
-export OS_AUTH_URL=http://controller:5000/v3
-export OS_IDENTITY_API_VERSION=3
-export OS_IMAGE_API_VERSION=2
diff --git a/labs/osbash/config/deploy.osbash b/labs/osbash/config/deploy.osbash
deleted file mode 100644
index 113a94d8..00000000
--- a/labs/osbash/config/deploy.osbash
+++ /dev/null
@@ -1,17 +0,0 @@
-# Used by osbash.sh and guest scripts
-
-: ${OSBASH_LIB_DIR:=$LIB_DIR/osbash}
-: ${OSBASH_SCRIPTS_DIR:=$SCRIPTS_DIR/osbash}
-
-: ${TEMPLATE_DIR:=$LIB_DIR/osbash/templates}
-
-# Name of VirtualBox shared folder
-: ${SHARE_NAME:=osbash}
-
-# Note: shell user name and password are set in preseed.cfg
-VM_SHELL_USER=osbash
-
-# Override disk size in MB (default is 10000 MB, inherited by node VMs)
-# BASE_DISK_SIZE=10000
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/config/hosts.multi b/labs/osbash/config/hosts.multi
deleted file mode 100644
index 2018059e..00000000
--- a/labs/osbash/config/hosts.multi
+++ /dev/null
@@ -1,17 +0,0 @@
-#------------------------------------------------------------------------------
-# http://docs.openstack.org/mitaka/install-guide-ubuntu/environment-networking-controller.html
-#------------------------------------------------------------------------------
-# controller
-10.0.0.11 controller
-
-# compute1
-10.0.0.31 compute1
-
-# block1
-10.0.0.41 block1
-
-# object1
-10.0.0.51 object1
-
-# object2
-10.0.0.52 object2
diff --git a/labs/osbash/config/localrc b/labs/osbash/config/localrc
deleted file mode 100644
index 23f2989d..00000000
--- a/labs/osbash/config/localrc
+++ /dev/null
@@ -1,30 +0,0 @@
-# Set this if you already have the install ISO, but in a location other
-# than IMG_DIR (which defaults to TOP_DIR/img)
-#INSTALL_ISO=/data/iso/ubuntu/ubuntu-12.04.4-server-amd64.iso
-
-# VM_PROXY will be used by osbash to get the ISO image and by apt/yum/wget once
-# the operating system is installed (i.e. for software updates and
-# installation). It should be sufficient to build a base disk if you have to
-# use a proxy to connect to the Internet. Building the cluster itself does not
-# require an Internet connection at all.
-#VM_PROXY="http://192.168.178.20:3128"
-
-# Options:
-# ubuntu-18.04-server-amd64 (default)
-# ubuntu-18.04-server-i386
-# ubuntu-16.04-server-amd64
-# ubuntu-16.04-server-i386
-# ubuntu-14.04-server-amd64
-# ubuntu-14.04-server-i386
-#
-# example: DISTRO=ubuntu-18.04-server-i386
-: ${DISTRO:=ubuntu-18.04-server-amd64}
-
-# PROVIDER: virtualbox or kvm (defaults to virtualbox)
-# KVM tends to give better performance (on Linux), but may be harder to set up
-# and osbash does not (yet) support all features with a KVM backend.
-#
-# example: PROVIDER=kvm
-: ${PROVIDER:=virtualbox}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/config/openstack b/labs/osbash/config/openstack
deleted file mode 100644
index cdf05e5a..00000000
--- a/labs/osbash/config/openstack
+++ /dev/null
@@ -1,58 +0,0 @@
-# This file contains OpenStack configuration data. It is used by both
-# host (osbash, Windows batch) and VM guest scripts.
-
-# train (production release; cloud-archive:train)
-# train-proposed (pre-release testing: cloud-archive:train-proposed)
-# train-staging (ppa:openstack-ubuntu-testing/train)
-: ${OPENSTACK_RELEASE:=train}
-
-# CirrOS image URL
-if [ "$(uname -m)" = "x86_64" ]; then
- arch=x86_64
-else
- arch=i386
-fi
-CIRROS_URL="http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-$arch-disk.img"
-unset arch
-
-# Name used for CirrOS image in glance
-CIRROS_IMG_NAME="cirros"
-
-#------------------------------------------------------------------------------
-# https://docs.openstack.org/install-guide/environment-networking.html
-#------------------------------------------------------------------------------
-
-# Networks used by OpenStack training-labs setup
-NETWORK_1="mgmt 10.0.0.0"
-NETWORK_2="provider 203.0.113.0"
-
-# Static IP used temporarily by PXE booted machines before being reconfigured
-# by osbash
-PXE_INITIAL_NODE_IP="10.0.0.240"
-
-#------------------------------------------------------------------------------
-# https://docs.openstack.org/install-guide/launch-instance-networks-provider.html
-#------------------------------------------------------------------------------
-
-# Public network
-: ${PROVIDER_NETWORK_CIDR:=203.0.113.0/24}
-: ${PROVIDER_NETWORK_GATEWAY:=203.0.113.1}
-# Floating IP addresses
-: ${START_IP_ADDRESS:=203.0.113.101}
-: ${END_IP_ADDRESS:=203.0.113.200}
-
-#------------------------------------------------------------------------------
-# https://docs.openstack.org/install-guide/launch-instance-selfservice.html
-#------------------------------------------------------------------------------
-
-# Private demo network
-: ${SELFSERVICE_NETWORK_CIDR:=172.16.1.0/24}
-: ${SELFSERVICE_NETWORK_GATEWAY:=172.16.1.1}
-
-# DNS name server used by instance VMs.
-# Default is Google Public DNS (8.8.4.4).
-: ${DNS_RESOLVER:=8.8.4.4}
-
-: ${REGION:=RegionOne}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/config/paths b/labs/osbash/config/paths
deleted file mode 100644
index 58d0285d..00000000
--- a/labs/osbash/config/paths
+++ /dev/null
@@ -1,33 +0,0 @@
-# This file is used by all scripts to find the directories for the files they
-# read or write. They find this file as "$TOP_DIR/config/paths".
-
-# Configuration files
-: ${CONFIG_DIR:=$TOP_DIR/config}
-
-# Installation ISO images, basedisk images, exported VM cluster images, etc.
-#
-# TODO(rluethi): merge these directories in the code, the option to have them
-# in separate directories doesn't seem very useful
-: ${DISK_DIR:=$TOP_DIR/img}
-: ${IMG_DIR:=$TOP_DIR/img}
-: ${ISO_DIR:=$TOP_DIR/img}
-
-# Code libraries, templates, preseed/kickstart files
-: ${LIB_DIR:=$TOP_DIR/lib}
-
-# Log files
-: ${LOG_DIR:=$TOP_DIR/log}
-
-# Status files (progress indicator for running scripts)
-: ${STATUS_DIR:=$LOG_DIR/status}
-
-# Scripts that run within the basedisk and node VMs
-: ${SCRIPTS_DIR:=$TOP_DIR/scripts}
-
-# Directory shared with VM guest
-: ${SHARE_DIR:=$TOP_DIR}
-
-# Autostart directory; files placed here are executed within the VM
-: ${AUTOSTART_DIR:=$SHARE_DIR/autostart}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/config/provider.kvm b/labs/osbash/config/provider.kvm
deleted file mode 100644
index ad1eb482..00000000
--- a/labs/osbash/config/provider.kvm
+++ /dev/null
@@ -1,14 +0,0 @@
-# KVM specific settings; used by osbash
-
-: ${KVM_VOL_POOL:=default}
-: ${LIBVIRT_CONNECT_URI:=qemu:///system}
-: ${VIRSH_CALL:=sudo virsh --connect=$LIBVIRT_CONNECT_URI}
-: ${VIRT_INSTALL_CALL:=sudo virt-install --connect=$LIBVIRT_CONNECT_URI}
-
-# KVM VM group (stored in VM description)
-: ${VM_GROUP:=OpenStack training-labs}
-
-# VM GUI type (one of headless, gui, vnc)
-: ${VM_UI:=vnc}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/config/provider.virtualbox b/labs/osbash/config/provider.virtualbox
deleted file mode 100644
index d846facc..00000000
--- a/labs/osbash/config/provider.virtualbox
+++ /dev/null
@@ -1,21 +0,0 @@
-# VirtualBox specific settings; used by osbash
-
-# Type of NIC to use for network interfaces, one of:
-# 82540EM for Intel PRO/1000 MT Desktop
-# 82543GC for Intel PRO/1000 T Server
-# 82545EM for Intel PRO/1000 MT Server
-# Am79C970A for PCnet-PCI II
-# Am79C973 for PCnet-FAST III
-# virtio for Paravirtualized network
-: ${NICTYPE:=virtio}
-
-# Location of VBoxManage binary
-: ${VBM_EXE:=$(which VBoxManage)}
-
-# VirtualBox VM group
-: ${VM_GROUP:=labs}
-
-# VirtualBox VM GUI type
-: ${VM_UI:=headless}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/config/scripts.centos_base b/labs/osbash/config/scripts.centos_base
deleted file mode 100644
index dbf9aa75..00000000
--- a/labs/osbash/config/scripts.centos_base
+++ /dev/null
@@ -1,3 +0,0 @@
-# Scripts for CentOS installations
-cmd queue centos/yum_init.sh
-cmd queue centos/yum_update.sh
diff --git a/labs/osbash/config/scripts.centos_cluster b/labs/osbash/config/scripts.centos_cluster
deleted file mode 100644
index e69de29b..00000000
diff --git a/labs/osbash/config/scripts.ubuntu_base b/labs/osbash/config/scripts.ubuntu_base
deleted file mode 100644
index 12ce27d0..00000000
--- a/labs/osbash/config/scripts.ubuntu_base
+++ /dev/null
@@ -1,6 +0,0 @@
-# Scripts for Ubuntu installations
-cmd queue ubuntu/apt_init.sh
-cmd queue ubuntu/apt_upgrade.sh
-cmd queue pre-download.sh
-cmd queue ubuntu/apt_pre-download.sh
-cmd queue osbash/enable_osbash_ssh_keys.sh
diff --git a/labs/osbash/config/scripts.ubuntu_cluster b/labs/osbash/config/scripts.ubuntu_cluster
deleted file mode 100644
index 052c5e90..00000000
--- a/labs/osbash/config/scripts.ubuntu_cluster
+++ /dev/null
@@ -1,102 +0,0 @@
-#==============================================================================
-# Scripts for controller node
-cmd create_node -n controller
-cmd queue_renamed -n controller osbash/init_xxx_node.sh
-
-cmd queue etc_hosts.sh
-cmd queue osbash/enable_osbash_ssh_keys.sh
-cmd queue osbash/copy_openrc.sh
-cmd snapshot_cycle -n controller controller_node_init
-
-# Environment
-cmd queue ubuntu/apt_install_mysql.sh
-cmd queue ubuntu/install_rabbitmq.sh
-cmd queue ubuntu/install_memcached.sh
-cmd snapshot_cycle -n controller pre-openstack_installed
-
-# Identity
-cmd queue ubuntu/setup_keystone.sh
-cmd queue test/get_auth_token.sh
-cmd snapshot_cycle -n controller keystone_installed
-
-# Image
-cmd queue ubuntu/setup_glance.sh
-cmd snapshot_cycle -n controller glance_installed
-
-# Compute
-cmd queue ubuntu/setup_nova_controller.sh
-cmd queue ubuntu/setup_placement_controller.sh
-cmd snapshot_cycle -n controller nova-controller_installed
-
-# Networking
-cmd queue ubuntu/setup_neutron_controller.sh
-cmd queue ubuntu/setup_self-service_controller.sh
-cmd queue ubuntu/setup_neutron_controller_part_2.sh
-cmd snapshot_cycle -n controller neutron-controller_installed
-
-# Dashboard
-cmd queue ubuntu/setup_horizon.sh
-cmd snapshot_cycle -n controller horizon_installed
-
-# Block Storage
-cmd queue ubuntu/setup_cinder_controller.sh
-cmd snapshot_cycle -n controller cinder_installed
-
-# Orchestration
-cmd queue ubuntu/setup_heat_controller.sh
-cmd snapshot_cycle -n controller heat_controller_installed
-
-cmd boot -n controller
-#==============================================================================
-# Scripts for compute1 node
-cmd create_node -n compute1
-cmd queue_renamed -n compute1 osbash/init_xxx_node.sh
-
-cmd queue etc_hosts.sh
-cmd queue osbash/enable_osbash_ssh_keys.sh
-cmd queue osbash/copy_openrc.sh
-cmd snapshot_cycle -n compute1 compute1_node_init
-
-# Compute
-cmd queue ubuntu/setup_nova_compute.sh
-cmd snapshot_cycle -n compute1 nova-compute1_installed
-
-# Networking
-cmd queue ubuntu/setup_neutron_compute.sh
-cmd queue ubuntu/setup_self-service_compute.sh
-cmd queue ubuntu/setup_neutron_compute_part_2.sh
-cmd snapshot_cycle -n compute1 neutron-compute_installed
-
-# Block Storage
-cmd queue ubuntu/setup_cinder_volumes.sh
-cmd snapshot_cycle -n compute1 cinder-volume_installed
-
-cmd boot -n compute1
-#==============================================================================
-# Create networks
-cmd shutdown -n controller
-cmd queue config_public_network.sh
-cmd queue config_private_network.sh
-cmd boot -n controller
-#==============================================================================
-# Always take snapshots of finished cluster
-cmd shutdown -n controller
-cmd shutdown -n compute1
-cmd snapshot -n controller controller_-_cluster_installed
-cmd snapshot -n compute1 compute-_cluster_installed
-
-# Boot cluster nodes -- cluster is ready for use
-cmd boot -n compute1
-
-# Enable extra services as needed:
-#
-#cmd queue ubuntu/barbican/setup_barbican_server.sh
-#
-#cmd queue ubuntu/mistral/setup_mistral_server.sh
-#
-# Note: tacker depends on mistral and barbican
-#cmd queue ubuntu/tacker/setup_tacker_server.sh
-#cmd queue ubuntu/tacker/create_vim.sh
-#cmd queue ubuntu/tacker/create_vnf.sh
-
-cmd boot -n controller
diff --git a/labs/osbash/config/scripts.ubuntu_nodes_only b/labs/osbash/config/scripts.ubuntu_nodes_only
deleted file mode 100644
index 82d5b53c..00000000
--- a/labs/osbash/config/scripts.ubuntu_nodes_only
+++ /dev/null
@@ -1,26 +0,0 @@
-#==============================================================================
-# Only create VMs (don't install any software)
-#==============================================================================
-
-# Scripts for controller node
-cmd create_node -n controller
-cmd queue_renamed -n controller osbash/init_xxx_node.sh
-
-cmd queue etc_hosts.sh
-cmd queue osbash/enable_osbash_ssh_keys.sh
-cmd queue osbash/copy_openrc.sh
-cmd snapshot_cycle -n controller controller_node_init
-
-#==============================================================================
-# Scripts for compute1 node
-cmd create_node -n compute1
-cmd queue_renamed -n compute1 osbash/init_xxx_node.sh
-
-cmd queue etc_hosts.sh
-cmd queue osbash/enable_osbash_ssh_keys.sh
-cmd snapshot_cycle -n compute1 compute1_node_init
-
-#==============================================================================
-# Both nodes are built, boot them
-cmd boot -n controller
-cmd boot -n compute1
diff --git a/labs/osbash/config/scripts.ubuntu_pxecluster b/labs/osbash/config/scripts.ubuntu_pxecluster
deleted file mode 100644
index 8749c01d..00000000
--- a/labs/osbash/config/scripts.ubuntu_pxecluster
+++ /dev/null
@@ -1,102 +0,0 @@
-cmd boot -n pxeserver
-#==============================================================================
-# Scripts for controller node
-cmd create_pxe_node -n controller
-cmd boot_set_tmp_node_ip -n controller
-cmd queue_renamed -n controller osbash/init_xxx_node.sh
-
-cmd queue etc_hosts.sh
-cmd queue ubuntu/apt_init.sh
-cmd queue ubuntu/apt_upgrade.sh
-cmd queue pre-download.sh
-cmd queue osbash/enable_osbash_ssh_keys.sh
-# This reboot is not optional, we must switch from temporary PXE IP address to
-# final address before installing servers
-cmd queue shutdown.sh
-cmd boot -n controller
-cmd wait_for_shutdown -n controller
-cmd snapshot -n controller controller_node_init
-
-# Environment
-cmd queue ubuntu/apt_install_mysql.sh
-cmd queue ubuntu/install_rabbitmq.sh
-cmd queue ubuntu/install_memcached.sh
-cmd snapshot_cycle -n controller pre-openstack_installed
-
-# Identity
-cmd queue ubuntu/setup_keystone.sh
-cmd queue test/get_auth_token.sh
-cmd snapshot_cycle -n controller keystone_installed
-
-# Image
-cmd queue ubuntu/setup_glance.sh
-cmd snapshot_cycle -n controller glance_installed
-
-# Compute
-cmd queue ubuntu/setup_nova_controller.sh
-cmd snapshot_cycle -n controller nova-controller_installed
-
-# Networking
-cmd queue ubuntu/setup_neutron_controller.sh
-cmd queue ubuntu/setup_self-service_controller.sh
-cmd queue ubuntu/setup_neutron_controller_part_2.sh
-cmd snapshot_cycle -n controller neutron-controller_installed
-
-# Dashboard
-cmd queue ubuntu/setup_horizon.sh
-cmd snapshot_cycle -n controller horizon_installed
-
-# Block Storage
-cmd queue ubuntu/setup_cinder_controller.sh
-cmd snapshot_cycle -n controller cinder_installed
-
-# Orchestration
-cmd queue ubuntu/setup_heat_controller.sh
-cmd snapshot_cycle -n controller heat_controller_installed
-
-cmd boot -n controller
-#==============================================================================
-# Scripts for compute1 node
-cmd create_pxe_node -n compute1
-cmd boot_set_tmp_node_ip -n compute1
-cmd queue_renamed -n compute1 osbash/init_xxx_node.sh
-
-cmd queue etc_hosts.sh
-cmd queue ubuntu/apt_init.sh
-cmd queue ubuntu/apt_upgrade.sh
-cmd queue pre-download.sh
-cmd queue osbash/enable_osbash_ssh_keys.sh
-# This reboot is not optional, we must switch from temporary PXE IP address to
-# final address before installing servers
-cmd queue shutdown.sh
-cmd boot -n compute1
-cmd wait_for_shutdown -n compute1
-cmd snapshot -n compute1 compute1_node_init
-
-# Compute
-cmd queue ubuntu/setup_nova_compute.sh
-cmd snapshot_cycle -n compute1 nova-compute1_installed
-
-# Networking
-cmd queue ubuntu/setup_neutron_compute.sh
-cmd queue ubuntu/setup_self-service_compute.sh
-cmd queue ubuntu/setup_neutron_compute_part_2.sh
-cmd snapshot_cycle -n compute1 neutron-compute_installed
-
-# Block Storage
-cmd queue ubuntu/setup_cinder_volumes.sh
-cmd snapshot_cycle -n compute1 cinder-volume_installed
-
-cmd boot -n compute1
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Take snapshot of database changes on controller VM, too
-cmd shutdown -n controller
-
-cmd snapshot -n controller controller_-_compute1_node_installed
-#==============================================================================
-cmd queue config_public_network.sh
-cmd queue config_private_network.sh
-cmd snapshot_cycle -n controller public_private_networks
-#==============================================================================
-
-cmd boot -n controller
diff --git a/labs/osbash/config/scripts.ubuntu_pxeserver b/labs/osbash/config/scripts.ubuntu_pxeserver
deleted file mode 100644
index 6e5f4a73..00000000
--- a/labs/osbash/config/scripts.ubuntu_pxeserver
+++ /dev/null
@@ -1,25 +0,0 @@
-#==============================================================================
-cmd create_node -n pxeserver
-cmd queue_renamed -n pxeserver osbash/init_xxx_node.sh
-
-cmd queue etc_hosts.sh
-cmd queue osbash/enable_osbash_ssh_keys.sh
-cmd queue osbash/copy_openrc.sh
-cmd snapshot_cycle -n pxeserver pxe_server_node_init
-#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Copy ISO image to pxeserver
-cmd boot -n pxeserver
-cmd cp_iso -n pxeserver
-cmd shutdown -n pxeserver
-#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-cmd queue pxe_server/install_pxeserver.sh
-
-# Add scripts for creating netboot config file on PXE server
-cmd queue_renamed -n controller ubuntu/create_xxx_node_pxeboot.sh
-
-# Add scripts for creating netboot config file on PXE server
-cmd queue_renamed -n compute1 ubuntu/create_xxx_node_pxeboot.sh
-
-cmd snapshot_cycle -n pxeserver pxe_server_ready
-#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-cmd boot -n pxeserver
diff --git a/labs/osbash/img/README.rst b/labs/osbash/img/README.rst
deleted file mode 100644
index 9123a3cc..00000000
--- a/labs/osbash/img/README.rst
+++ /dev/null
@@ -1,18 +0,0 @@
-OsBash
-------
-
-About
------
-
-By default, osbash will put into this directory its base disk images
-(base-*-.vdi), the VM export images (labs-.ova),
-and all installation ISO images it may download.
-
- - 'img' folder stores all the base disk and ISO images.
- - To find individual virtualbox disk images, please look into the
- virtualbox default machine folder.
- - For Linux: "~/VirtualBox/labs/"
- - In case your default folder is at another location (manually set)
- please get the location by opening the VirtualBox GUI at this location
- "File>Preferences>General>Default Machine Folder"
-
diff --git a/labs/osbash/lib/README.rst b/labs/osbash/lib/README.rst
deleted file mode 100644
index a72fc822..00000000
--- a/labs/osbash/lib/README.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-This directory contains bash libraries used by scripts.
-
-Configuration files for kickstart (Fedora) and preseed (Ubuntu) are in
-osbash/netboot.
-
-The osbash-ssh-keys can be automatically installed into osbash
-VMs to make them accessible.
-
-The templates used to build Windows batch files are in the wbatch subdirectory.
diff --git a/labs/osbash/lib/functions-common-devstack b/labs/osbash/lib/functions-common-devstack
deleted file mode 100644
index a77e5f8a..00000000
--- a/labs/osbash/lib/functions-common-devstack
+++ /dev/null
@@ -1,1630 +0,0 @@
-# functions-common - Common functions used by DevStack components
-#
-# The canonical copy of this file is maintained in the DevStack repo.
-# All modifications should be made there and then sync'ed to other repos
-# as required.
-#
-# This file is sorted alphabetically within the function groups.
-#
-# - Config Functions
-# - Control Functions
-# - Distro Functions
-# - Git Functions
-# - OpenStack Functions
-# - Package Functions
-# - Process Functions
-# - Python Functions
-# - Service Functions
-# - System Functions
-#
-# The following variables are assumed to be defined by certain functions:
-#
-# - ``ENABLED_SERVICES``
-# - ``ERROR_ON_CLONE``
-# - ``FILES``
-# - ``OFFLINE``
-# - ``PIP_DOWNLOAD_CACHE``
-# - ``PIP_USE_MIRRORS``
-# - ``RECLONE``
-# - ``REQUIREMENTS_DIR``
-# - ``STACK_USER``
-# - ``TRACK_DEPENDS``
-# - ``UNDO_REQUIREMENTS``
-# - ``http_proxy``, ``https_proxy``, ``no_proxy``
-
-# Save trace setting
-XTRACE=$(set +o | grep xtrace)
-set +o xtrace
-
-
-# Config Functions
-# ================
-
-# Append a new option in an ini file without replacing the old value
-# iniadd config-file section option value1 value2 value3 ...
-function iniadd {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local file=$1
- local section=$2
- local option=$3
- shift 3
- local values="$(iniget_multiline $file $section $option) $@"
- iniset_multiline $file $section $option $values
- $xtrace
-}
-
-# Comment an option in an INI file
-# inicomment config-file section option
-function inicomment {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local file=$1
- local section=$2
- local option=$3
- sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=.*$\)|#\1|" "$file"
- $xtrace
-}
-
-# Get an option from an INI file
-# iniget config-file section option
-function iniget {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local file=$1
- local section=$2
- local option=$3
- local line
- line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
- echo ${line#*=}
- $xtrace
-}
-
-# Get a multiple line option from an INI file
-# iniget_multiline config-file section option
-function iniget_multiline {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local file=$1
- local section=$2
- local option=$3
- local values
- values=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { s/^$option[ \t]*=[ \t]*//gp; }" "$file")
- echo ${values}
- $xtrace
-}
-
-# Determinate is the given option present in the INI file
-# ini_has_option config-file section option
-function ini_has_option {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local file=$1
- local section=$2
- local option=$3
- local line
- line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
- $xtrace
- [ -n "$line" ]
-}
-
-# Set an option in an INI file
-# iniset config-file section option value
-function iniset {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local file=$1
- local section=$2
- local option=$3
- local value=$4
-
- [[ -z $section || -z $option ]] && return
-
- if ! grep -q "^\[$section\]" "$file" 2>/dev/null; then
- # Add section at the end
- echo -e "\n[$section]" >>"$file"
- fi
- if ! ini_has_option "$file" "$section" "$option"; then
- # Add it
- sed -i -e "/^\[$section\]/ a\\
-$option = $value
-" "$file"
- else
- local sep=$(echo -ne "\x01")
- # Replace it
- sed -i -e '/^\['${section}'\]/,/^\[.*\]/ s'${sep}'^\('${option}'[ \t]*=[ \t]*\).*$'${sep}'\1'"${value}"${sep} "$file"
- fi
- $xtrace
-}
-
-# Set a multiple line option in an INI file
-# iniset_multiline config-file section option value1 value2 valu3 ...
-function iniset_multiline {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local file=$1
- local section=$2
- local option=$3
- shift 3
- local values
- for v in $@; do
- # The later sed command inserts each new value in the line next to
- # the section identifier, which causes the values to be inserted in
- # the reverse order. Do a reverse here to keep the original order.
- values="$v ${values}"
- done
- if ! grep -q "^\[$section\]" "$file"; then
- # Add section at the end
- echo -e "\n[$section]" >>"$file"
- else
- # Remove old values
- sed -i -e "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ d; }" "$file"
- fi
- # Add new ones
- for v in $values; do
- sed -i -e "/^\[$section\]/ a\\
-$option = $v
-" "$file"
- done
- $xtrace
-}
-
-# Uncomment an option in an INI file
-# iniuncomment config-file section option
-function iniuncomment {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local file=$1
- local section=$2
- local option=$3
- sed -i -e "/^\[$section\]/,/^\[.*\]/ s|[^ \t]*#[ \t]*\($option[ \t]*=.*$\)|\1|" "$file"
- $xtrace
-}
-
-# Normalize config values to True or False
-# Accepts as False: 0 no No NO false False FALSE
-# Accepts as True: 1 yes Yes YES true True TRUE
-# VAR=$(trueorfalse default-value test-value)
-function trueorfalse {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local default=$1
- local testval=$2
-
- [[ -z "$testval" ]] && { echo "$default"; return; }
- [[ "0 no No NO false False FALSE" =~ "$testval" ]] && { echo "False"; return; }
- [[ "1 yes Yes YES true True TRUE" =~ "$testval" ]] && { echo "True"; return; }
- echo "$default"
- $xtrace
-}
-
-
-# Control Functions
-# =================
-
-# Prints backtrace info
-# filename:lineno:function
-# backtrace level
-function backtrace {
- local level=$1
- local deep=$((${#BASH_SOURCE[@]} - 1))
- echo "[Call Trace]"
- while [ $level -le $deep ]; do
- echo "${BASH_SOURCE[$deep]}:${BASH_LINENO[$deep-1]}:${FUNCNAME[$deep-1]}"
- deep=$((deep - 1))
- done
-}
-
-# Prints line number and "message" then exits
-# die $LINENO "message"
-function die {
- local exitcode=$?
- set +o xtrace
- local line=$1; shift
- if [ $exitcode == 0 ]; then
- exitcode=1
- fi
- backtrace 2
- err $line "$*"
- # Give buffers a second to flush
- sleep 1
- exit $exitcode
-}
-
-# Checks an environment variable is not set or has length 0 OR if the
-# exit code is non-zero and prints "message" and exits
-# NOTE: env-var is the variable name without a '$'
-# die_if_not_set $LINENO env-var "message"
-function die_if_not_set {
- local exitcode=$?
- FXTRACE=$(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
-}
-
-# Prints line number and "message" in error format
-# err $LINENO "message"
-function err {
- local exitcode=$?
- errXTRACE=$(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
- return $exitcode
-}
-
-# Checks an environment variable is not set or has length 0 OR if the
-# exit code is non-zero and prints "message"
-# NOTE: env-var is the variable name without a '$'
-# err_if_not_set $LINENO env-var "message"
-function err_if_not_set {
- local exitcode=$?
- errinsXTRACE=$(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
- return $exitcode
-}
-
-# Exit after outputting a message about the distribution not being supported.
-# exit_distro_not_supported [optional-string-telling-what-is-missing]
-function exit_distro_not_supported {
- if [[ -z "$DISTRO" ]]; then
- GetDistro
- fi
-
- if [ $# -gt 0 ]; then
- die $LINENO "Support for $DISTRO is incomplete: no support for $@"
- else
- die $LINENO "Support for $DISTRO is incomplete."
- fi
-}
-
-# Test if the named environment variable is set and not zero length
-# is_set env-var
-function is_set {
- local var=\$"$1"
- eval "[ -n \"$var\" ]" # For ex.: sh -c "[ -n \"$var\" ]" would be better, but several exercises depends on this
-}
-
-# Prints line number and "message" in warning format
-# warn $LINENO "message"
-function warn {
- local exitcode=$?
- errXTRACE=$(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
- return $exitcode
-}
-
-
-# Distro Functions
-# ================
-
-# 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
-# GetOSVersion
-function GetOSVersion {
- # Figure out which vendor we are
- if [[ -x "`which sw_vers 2>/dev/null`" ]]; then
- # OS/X
- os_VENDOR=`sw_vers -productName`
- os_RELEASE=`sw_vers -productVersion`
- os_UPDATE=${os_RELEASE##*.}
- os_RELEASE=${os_RELEASE%.*}
- os_PACKAGE=""
- if [[ "$os_RELEASE" =~ "10.7" ]]; then
- os_CODENAME="lion"
- elif [[ "$os_RELEASE" =~ "10.6" ]]; then
- os_CODENAME="snow leopard"
- elif [[ "$os_RELEASE" =~ "10.5" ]]; then
- os_CODENAME="leopard"
- elif [[ "$os_RELEASE" =~ "10.4" ]]; then
- os_CODENAME="tiger"
- elif [[ "$os_RELEASE" =~ "10.3" ]]; then
- os_CODENAME="panther"
- else
- os_CODENAME=""
- fi
- elif [[ -x $(which lsb_release 2>/dev/null) ]]; then
- os_VENDOR=$(lsb_release -i -s)
- os_RELEASE=$(lsb_release -r -s)
- os_UPDATE=""
- os_PACKAGE="rpm"
- if [[ "Debian,Ubuntu,LinuxMint" =~ $os_VENDOR ]]; then
- os_PACKAGE="deb"
- elif [[ "SUSE LINUX" =~ $os_VENDOR ]]; then
- lsb_release -d -s | grep -q openSUSE
- if [[ $? -eq 0 ]]; then
- os_VENDOR="openSUSE"
- fi
- elif [[ $os_VENDOR == "openSUSE project" ]]; then
- os_VENDOR="openSUSE"
- elif [[ $os_VENDOR =~ Red.*Hat ]]; then
- os_VENDOR="Red Hat"
- fi
- os_CODENAME=$(lsb_release -c -s)
- elif [[ -r /etc/redhat-release ]]; then
- # Red Hat Enterprise Linux Server release 5.5 (Tikanga)
- # Red Hat Enterprise Linux Server release 7.0 Beta (Maipo)
- # CentOS release 5.5 (Final)
- # CentOS Linux release 6.0 (Final)
- # Fedora release 16 (Verne)
- # XenServer release 6.2.0-70446c (xenenterprise)
- os_CODENAME=""
- for r in "Red Hat" CentOS Fedora XenServer; do
- os_VENDOR=$r
- if [[ -n "`grep \"$r\" /etc/redhat-release`" ]]; then
- ver=`sed -e 's/^.* \([0-9].*\) (\(.*\)).*$/\1\|\2/' /etc/redhat-release`
- os_CODENAME=${ver#*|}
- os_RELEASE=${ver%|*}
- os_UPDATE=${os_RELEASE##*.}
- os_RELEASE=${os_RELEASE%.*}
- break
- fi
- os_VENDOR=""
- done
- os_PACKAGE="rpm"
- elif [[ -r /etc/SuSE-release ]]; then
- for r in openSUSE "SUSE Linux"; do
- if [[ "$r" = "SUSE Linux" ]]; then
- os_VENDOR="SUSE LINUX"
- else
- os_VENDOR=$r
- fi
-
- if [[ -n "`grep \"$r\" /etc/SuSE-release`" ]]; then
- os_CODENAME=`grep "CODENAME = " /etc/SuSE-release | sed 's:.* = ::g'`
- os_RELEASE=`grep "VERSION = " /etc/SuSE-release | sed 's:.* = ::g'`
- os_UPDATE=`grep "PATCHLEVEL = " /etc/SuSE-release | sed 's:.* = ::g'`
- break
- fi
- os_VENDOR=""
- done
- os_PACKAGE="rpm"
- # If lsb_release is not installed, we should be able to detect Debian OS
- elif [[ -f /etc/debian_version ]] && [[ $(cat /proc/version) =~ "Debian" ]]; then
- os_VENDOR="Debian"
- os_PACKAGE="deb"
- os_CODENAME=$(awk '/VERSION=/' /etc/os-release | sed 's/VERSION=//' | sed -r 's/\"|\(|\)//g' | awk '{print $2}')
- os_RELEASE=$(awk '/VERSION_ID=/' /etc/os-release | sed 's/VERSION_ID=//' | sed 's/\"//g')
- fi
- export os_VENDOR os_RELEASE os_UPDATE os_PACKAGE os_CODENAME
-}
-
-# Translate the OS version values into common nomenclature
-# Sets global ``DISTRO`` from the ``os_*`` values
-function GetDistro {
- GetOSVersion
- if [[ "$os_VENDOR" =~ (Ubuntu) || "$os_VENDOR" =~ (Debian) ]]; then
- # 'Everyone' refers to Ubuntu / Debian releases by the code name adjective
- DISTRO=$os_CODENAME
- elif [[ "$os_VENDOR" =~ (Fedora) ]]; then
- # For Fedora, just use 'f' and the release
- DISTRO="f$os_RELEASE"
- elif [[ "$os_VENDOR" =~ (openSUSE) ]]; then
- DISTRO="opensuse-$os_RELEASE"
- elif [[ "$os_VENDOR" =~ (SUSE LINUX) ]]; then
- # For SLE, also use the service pack
- if [[ -z "$os_UPDATE" ]]; then
- DISTRO="sle${os_RELEASE}"
- else
- DISTRO="sle${os_RELEASE}sp${os_UPDATE}"
- fi
- elif [[ "$os_VENDOR" =~ (Red Hat) || "$os_VENDOR" =~ (CentOS) ]]; then
- # Drop the . release as we assume it's compatible
- DISTRO="rhel${os_RELEASE::1}"
- elif [[ "$os_VENDOR" =~ (XenServer) ]]; then
- DISTRO="xs$os_RELEASE"
- else
- # Catch-all for now is Vendor + Release + Update
- DISTRO="$os_VENDOR-$os_RELEASE.$os_UPDATE"
- fi
- export DISTRO
-}
-
-# Utility function for checking machine architecture
-# is_arch arch-type
-function is_arch {
- ARCH_TYPE=$1
-
- [[ "$(uname -m)" == "$ARCH_TYPE" ]]
-}
-
-# Determine if current distribution is a Fedora-based distribution
-# (Fedora, RHEL, CentOS, etc).
-# is_fedora
-function is_fedora {
- if [[ -z "$os_VENDOR" ]]; then
- GetOSVersion
- fi
-
- [ "$os_VENDOR" = "Fedora" ] || [ "$os_VENDOR" = "Red Hat" ] || [ "$os_VENDOR" = "CentOS" ]
-}
-
-
-# Determine if current distribution is a SUSE-based distribution
-# (openSUSE, SLE).
-# is_suse
-function is_suse {
- if [[ -z "$os_VENDOR" ]]; then
- GetOSVersion
- fi
-
- [ "$os_VENDOR" = "openSUSE" ] || [ "$os_VENDOR" = "SUSE LINUX" ]
-}
-
-
-# Determine if current distribution is an Ubuntu-based distribution
-# It will also detect non-Ubuntu but Debian-based distros
-# is_ubuntu
-function is_ubuntu {
- if [[ -z "$os_PACKAGE" ]]; then
- GetOSVersion
- fi
- [ "$os_PACKAGE" = "deb" ]
-}
-
-
-# Git Functions
-# =============
-
-# Returns openstack release name for a given branch name
-# ``get_release_name_from_branch branch-name``
-function get_release_name_from_branch {
- local branch=$1
- if [[ $branch =~ "stable/" ]]; then
- echo ${branch#*/}
- else
- echo "master"
- fi
-}
-
-# git clone only if directory doesn't exist already. Since ``DEST`` might not
-# be owned by the installation user, we create the directory and change the
-# ownership to the proper user.
-# Set global RECLONE=yes to simulate a clone when dest-dir exists
-# Set global ERROR_ON_CLONE=True to abort execution with an error if the git repo
-# does not exist (default is False, meaning the repo will be cloned).
-# Uses global ``OFFLINE``
-# git_clone remote dest-dir branch
-function git_clone {
- GIT_REMOTE=$1
- GIT_DEST=$2
- GIT_REF=$3
- RECLONE=$(trueorfalse False $RECLONE)
- local orig_dir=`pwd`
-
- if [[ "$OFFLINE" = "True" ]]; then
- echo "Running in offline mode, clones already exist"
- # print out the results so we know what change was used in the logs
- cd $GIT_DEST
- git show --oneline | head -1
- cd $orig_dir
- return
- fi
-
- if echo $GIT_REF | egrep -q "^refs"; then
- # If our branch name is a gerrit style refs/changes/...
- if [[ ! -d $GIT_DEST ]]; then
- [[ "$ERROR_ON_CLONE" = "True" ]] && \
- die $LINENO "Cloning not allowed in this configuration"
- git_timed clone $GIT_REMOTE $GIT_DEST
- fi
- cd $GIT_DEST
- git_timed fetch $GIT_REMOTE $GIT_REF && git checkout FETCH_HEAD
- else
- # do a full clone only if the directory doesn't exist
- if [[ ! -d $GIT_DEST ]]; then
- [[ "$ERROR_ON_CLONE" = "True" ]] && \
- die $LINENO "Cloning not allowed in this configuration"
- git_timed clone $GIT_REMOTE $GIT_DEST
- cd $GIT_DEST
- # This checkout syntax works for both branches and tags
- git checkout $GIT_REF
- elif [[ "$RECLONE" = "True" ]]; then
- # if it does exist then simulate what clone does if asked to RECLONE
- cd $GIT_DEST
- # set the url to pull from and fetch
- git remote set-url origin $GIT_REMOTE
- git_timed fetch origin
- # remove the existing ignored files (like pyc) as they cause breakage
- # (due to the py files having older timestamps than our pyc, so python
- # thinks the pyc files are correct using them)
- find $GIT_DEST -name '*.pyc' -delete
-
- # handle GIT_REF accordingly to type (tag, branch)
- if [[ -n "`git show-ref refs/tags/$GIT_REF`" ]]; then
- git_update_tag $GIT_REF
- elif [[ -n "`git show-ref refs/heads/$GIT_REF`" ]]; then
- git_update_branch $GIT_REF
- elif [[ -n "`git show-ref refs/remotes/origin/$GIT_REF`" ]]; then
- git_update_remote_branch $GIT_REF
- else
- die $LINENO "$GIT_REF is neither branch nor tag"
- fi
-
- fi
- fi
-
- # print out the results so we know what change was used in the logs
- cd $GIT_DEST
- git show --oneline | head -1
- cd $orig_dir
-}
-
-# git can sometimes get itself infinitely stuck with transient network
-# errors or other issues with the remote end. This wraps git in a
-# timeout/retry loop and is intended to watch over non-local git
-# processes that might hang. GIT_TIMEOUT, if set, is passed directly
-# to timeout(1); otherwise the default value of 0 maintains the status
-# quo of waiting forever.
-# usage: git_timed
-function git_timed {
- local count=0
- local timeout=0
-
- if [[ -n "${GIT_TIMEOUT}" ]]; then
- timeout=${GIT_TIMEOUT}
- fi
-
- until timeout -s SIGINT ${timeout} git "$@"; do
- # 124 is timeout(1)'s special return code when it reached the
- # timeout; otherwise assume fatal failure
- if [[ $? -ne 124 ]]; then
- die $LINENO "git call failed: [git $@]"
- fi
-
- count=$(($count + 1))
- warn "timeout ${count} for git call: [git $@]"
- if [ $count -eq 3 ]; then
- die $LINENO "Maximum of 3 git retries reached"
- fi
- sleep 5
- done
-}
-
-# git update using reference as a branch.
-# git_update_branch ref
-function git_update_branch {
-
- GIT_BRANCH=$1
-
- git checkout -f origin/$GIT_BRANCH
- # a local branch might not exist
- git branch -D $GIT_BRANCH || true
- git checkout -b $GIT_BRANCH
-}
-
-# git update using reference as a branch.
-# git_update_remote_branch ref
-function git_update_remote_branch {
-
- GIT_BRANCH=$1
-
- git checkout -b $GIT_BRANCH -t origin/$GIT_BRANCH
-}
-
-# git update using reference as a tag. Be careful editing source at that repo
-# as working copy will be in a detached mode
-# git_update_tag ref
-function git_update_tag {
-
- GIT_TAG=$1
-
- git tag -d $GIT_TAG
- # fetching given tag only
- git_timed fetch origin tag $GIT_TAG
- git checkout -f $GIT_TAG
-}
-
-
-# OpenStack Functions
-# ===================
-
-# Get the default value for HOST_IP
-# get_default_host_ip fixed_range floating_range host_ip_iface host_ip
-function get_default_host_ip {
- local fixed_range=$1
- local floating_range=$2
- local host_ip_iface=$3
- local host_ip=$4
-
- # Find the interface used for the default route
- host_ip_iface=${host_ip_iface:-$(ip route | sed -n '/^default/{ s/.*dev \(\w\+\)\s\+.*/\1/; p; }' | head -1)}
- # 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
- # 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
- break;
- fi
- done
- fi
- echo $host_ip
-}
-
-# Grab a numbered field from python prettytable output
-# Fields are numbered starting with 1
-# Reverse syntax is supported: -1 is the last field, -2 is second to last, etc.
-# get_field field-number
-function get_field {
- while read data; do
- if [ "$1" -lt 0 ]; then
- field="(\$(NF$1))"
- else
- field="\$$(($1 + 1))"
- fi
- echo "$data" | awk -F'[ \t]*\\|[ \t]*' "{print $field}"
- done
-}
-
-# Add a policy to a policy.json file
-# Do nothing if the policy already exists
-# ``policy_add policy_file policy_name policy_permissions``
-function policy_add {
- local policy_file=$1
- local policy_name=$2
- local policy_perm=$3
-
- if grep -q ${policy_name} ${policy_file}; then
- echo "Policy ${policy_name} already exists in ${policy_file}"
- return
- fi
-
- # Add a terminating comma to policy lines without one
- # Remove the closing '}' and all lines following to the end-of-file
- local tmpfile=$(mktemp)
- uniq ${policy_file} | sed -e '
- s/]$/],/
- /^[}]/,$d
- ' > ${tmpfile}
-
- # Append policy and closing brace
- echo " \"${policy_name}\": ${policy_perm}" >>${tmpfile}
- echo "}" >>${tmpfile}
-
- mv ${tmpfile} ${policy_file}
-}
-
-
-# Package Functions
-# =================
-
-# _get_package_dir
-function _get_package_dir {
- local pkg_dir
- if is_ubuntu; then
- pkg_dir=$FILES/apts
- elif is_fedora; then
- pkg_dir=$FILES/rpms
- elif is_suse; then
- pkg_dir=$FILES/rpms-suse
- else
- exit_distro_not_supported "list of packages"
- fi
- echo "$pkg_dir"
-}
-
-# Wrapper for ``apt-get`` to set cache and proxy environment variables
-# Uses globals ``OFFLINE``, ``*_proxy``
-# apt_get operation package [package ...]
-function apt_get {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
-
- [[ "$OFFLINE" = "True" || -z "$@" ]] && return
- local sudo="sudo"
- [[ "$(id -u)" = "0" ]] && sudo="env"
-
- $xtrace
- $sudo DEBIAN_FRONTEND=noninteractive \
- http_proxy=$http_proxy https_proxy=$https_proxy \
- no_proxy=$no_proxy \
- apt-get --option "Dpkg::Options::=--force-confold" --assume-yes "$@"
-}
-
-# get_packages() collects a list of package names of any type from the
-# prerequisite files in ``files/{apts|rpms}``. The list is intended
-# to be passed to a package installer such as apt or yum.
-#
-# Only packages required for the services in 1st argument will be
-# included. Two bits of metadata are recognized in the prerequisite files:
-#
-# - ``# NOPRIME`` defers installation to be performed later in `stack.sh`
-# - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection
-# of the package to the distros listed. The distro names are case insensitive.
-function get_packages {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local services=$@
- local package_dir=$(_get_package_dir)
- local file_to_parse
- local service
-
- if [[ -z "$package_dir" ]]; then
- echo "No package directory supplied"
- return 1
- fi
- if [[ -z "$DISTRO" ]]; then
- GetDistro
- echo "Found Distro $DISTRO"
- fi
- for service in ${services//,/ }; do
- # Allow individual services to specify dependencies
- if [[ -e ${package_dir}/${service} ]]; then
- file_to_parse="${file_to_parse} $service"
- fi
- # NOTE(sdague) n-api needs glance for now because that's where
- # glance client is
- if [[ $service == n-api ]]; then
- if [[ ! $file_to_parse =~ nova ]]; then
- file_to_parse="${file_to_parse} nova"
- fi
- if [[ ! $file_to_parse =~ glance ]]; then
- file_to_parse="${file_to_parse} glance"
- fi
- elif [[ $service == c-* ]]; then
- if [[ ! $file_to_parse =~ cinder ]]; then
- file_to_parse="${file_to_parse} cinder"
- fi
- elif [[ $service == ceilometer-* ]]; then
- if [[ ! $file_to_parse =~ ceilometer ]]; then
- file_to_parse="${file_to_parse} ceilometer"
- fi
- elif [[ $service == s-* ]]; then
- if [[ ! $file_to_parse =~ swift ]]; then
- file_to_parse="${file_to_parse} swift"
- fi
- elif [[ $service == n-* ]]; then
- if [[ ! $file_to_parse =~ nova ]]; then
- file_to_parse="${file_to_parse} nova"
- fi
- elif [[ $service == g-* ]]; then
- if [[ ! $file_to_parse =~ glance ]]; then
- file_to_parse="${file_to_parse} glance"
- fi
- elif [[ $service == key* ]]; then
- if [[ ! $file_to_parse =~ keystone ]]; then
- file_to_parse="${file_to_parse} keystone"
- fi
- elif [[ $service == q-* ]]; then
- if [[ ! $file_to_parse =~ neutron ]]; then
- file_to_parse="${file_to_parse} neutron"
- fi
- elif [[ $service == ir-* ]]; then
- if [[ ! $file_to_parse =~ ironic ]]; then
- file_to_parse="${file_to_parse} ironic"
- fi
- fi
- done
-
- for file in ${file_to_parse}; do
- local fname=${package_dir}/${file}
- local OIFS line package distros distro
- [[ -e $fname ]] || continue
-
- OIFS=$IFS
- IFS=$'\n'
- for line in $(<${fname}); do
- if [[ $line =~ "NOPRIME" ]]; then
- continue
- fi
-
- # Assume we want this package
- package=${line%#*}
- inst_pkg=1
-
- # Look for # dist:xxx in comment
- if [[ $line =~ (.*)#.*dist:([^ ]*) ]]; then
- # We are using BASH regexp matching feature.
- package=${BASH_REMATCH[1]}
- distros=${BASH_REMATCH[2]}
- # In bash ${VAR,,} will lowecase VAR
- # Look for a match in the distro list
- if [[ ! ${distros,,} =~ ${DISTRO,,} ]]; then
- # If no match then skip this package
- inst_pkg=0
- fi
- fi
-
- # Look for # testonly in comment
- if [[ $line =~ (.*)#.*testonly.* ]]; then
- package=${BASH_REMATCH[1]}
- # Are we installing test packages? (test for the default value)
- if [[ $INSTALL_TESTONLY_PACKAGES = "False" ]]; then
- # If not installing test packages the skip this package
- inst_pkg=0
- fi
- fi
-
- if [[ $inst_pkg = 1 ]]; then
- echo $package
- fi
- done
- IFS=$OIFS
- done
- $xtrace
-}
-
-# Distro-agnostic package installer
-# install_package package [package ...]
-function install_package {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- if is_ubuntu; then
- # if there are transient errors pulling the updates, that's fine. It may
- # be secondary repositories that we don't really care about.
- [[ "$NO_UPDATE_REPOS" = "True" ]] || apt_get update || /bin/true
- NO_UPDATE_REPOS=True
-
- $xtrace
- apt_get install "$@"
- elif is_fedora; then
- $xtrace
- yum_install "$@"
- elif is_suse; then
- $xtrace
- zypper_install "$@"
- else
- $xtrace
- exit_distro_not_supported "installing packages"
- fi
-}
-
-# Distro-agnostic function to tell if a package is installed
-# is_package_installed package [package ...]
-function is_package_installed {
- if [[ -z "$@" ]]; then
- return 1
- fi
-
- if [[ -z "$os_PACKAGE" ]]; then
- GetOSVersion
- fi
-
- if [[ "$os_PACKAGE" = "deb" ]]; then
- dpkg -s "$@" > /dev/null 2> /dev/null
- elif [[ "$os_PACKAGE" = "rpm" ]]; then
- rpm --quiet -q "$@"
- else
- exit_distro_not_supported "finding if a package is installed"
- fi
-}
-
-# Distro-agnostic package uninstaller
-# uninstall_package package [package ...]
-function uninstall_package {
- if is_ubuntu; then
- apt_get purge "$@"
- elif is_fedora; then
- sudo yum remove -y "$@"
- elif is_suse; then
- sudo zypper rm "$@"
- else
- exit_distro_not_supported "uninstalling packages"
- fi
-}
-
-# Wrapper for ``yum`` to set proxy environment variables
-# Uses globals ``OFFLINE``, ``*_proxy``
-# yum_install package [package ...]
-function yum_install {
- [[ "$OFFLINE" = "True" ]] && return
- local sudo="sudo"
- [[ "$(id -u)" = "0" ]] && sudo="env"
-
- # The manual check for missing packages is because yum -y assumes
- # missing packages are OK. See
- # https://bugzilla.redhat.com/show_bug.cgi?id=965567
- $sudo http_proxy=$http_proxy https_proxy=$https_proxy \
- no_proxy=$no_proxy \
- yum install -y "$@" 2>&1 | \
- awk '
- BEGIN { fail=0 }
- /No package/ { fail=1 }
- { print }
- END { exit fail }' || \
- die $LINENO "Missing packages detected"
-
- # also ensure we catch a yum failure
- if [[ ${PIPESTATUS[0]} != 0 ]]; then
- die $LINENO "Yum install failure"
- fi
-}
-
-# zypper wrapper to set arguments correctly
-# zypper_install package [package ...]
-function zypper_install {
- [[ "$OFFLINE" = "True" ]] && return
- local sudo="sudo"
- [[ "$(id -u)" = "0" ]] && sudo="env"
- $sudo http_proxy=$http_proxy https_proxy=$https_proxy \
- zypper --non-interactive install --auto-agree-with-licenses "$@"
-}
-
-
-# Process Functions
-# =================
-
-# _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
-# _run_process service "command-line"
-function _run_process {
- local service=$1
- local command="$2"
-
- # Undo logging redirections and close the extra descriptors
- exec 1>&3
- exec 2>&3
- exec 3>&-
- exec 6>&-
-
- if [[ -n ${SCREEN_LOGDIR} ]]; then
- exec 1>&${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log 2>&1
- ln -sf ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${1}.log
-
- # TODO(dtroyer): Hack to get stdout from the Python interpreter for the logs.
- export PYTHONUNBUFFERED=1
- fi
-
- exec /bin/bash -c "$command"
- die "$service exec failure: $command"
-}
-
-# 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
-# init_service_check
-function init_service_check {
- SCREEN_NAME=${SCREEN_NAME:-stack}
- SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
-
- if [[ ! -d "$SERVICE_DIR/$SCREEN_NAME" ]]; then
- mkdir -p "$SERVICE_DIR/$SCREEN_NAME"
- fi
-
- rm -f "$SERVICE_DIR/$SCREEN_NAME"/*.failure
-}
-
-# Find out if a process exists by partial name.
-# is_running name
-function is_running {
- local name=$1
- ps auxw | grep -v grep | grep ${name} > /dev/null
- RC=$?
- # some times I really hate bash reverse binary logic
- return $RC
-}
-
-# 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
-# run_process service "command-line"
-function run_process {
- local service=$1
- local command="$2"
-
- # Spawn the child process
- _run_process "$service" "$command" &
- echo $!
-}
-
-# Helper to launch a service in a named screen
-# screen_it service "command-line"
-function screen_it {
- SCREEN_NAME=${SCREEN_NAME:-stack}
- SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
- USE_SCREEN=$(trueorfalse True $USE_SCREEN)
-
- if is_service_enabled $1; then
- # Append the service to the screen rc file
- screen_rc "$1" "$2"
-
- if [[ "$USE_SCREEN" = "True" ]]; then
- screen -S $SCREEN_NAME -X screen -t $1
-
- if [[ -n ${SCREEN_LOGDIR} ]]; then
- screen -S $SCREEN_NAME -p $1 -X logfile ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log
- screen -S $SCREEN_NAME -p $1 -X log on
- ln -sf ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${1}.log
- fi
-
- # sleep to allow bash to be ready to be send the command - we are
- # creating a new window in screen and then sends characters, so if
- # bash isn't running by the time we send the command, nothing happens
- sleep 1.5
-
- NL=`echo -ne '\015'`
- # This fun command does the following:
- # - the passed server command is backgrounded
- # - the pid of the background process is saved in the usual place
- # - the server process is brought back to the foreground
- # - if the server process exits prematurely the fg command errors
- # and a message is written to stdout and the service failure file
- # The pid saved can be used in screen_stop() as a process group
- # id to kill off all child processes
- screen -S $SCREEN_NAME -p $1 -X stuff "$2 & echo \$! >$SERVICE_DIR/$SCREEN_NAME/$1.pid; fg || echo \"$1 failed to start\" | tee \"$SERVICE_DIR/$SCREEN_NAME/$1.failure\"$NL"
- else
- # Spawn directly without screen
- run_process "$1" "$2" >$SERVICE_DIR/$SCREEN_NAME/$1.pid
- fi
- fi
-}
-
-# Screen rc file builder
-# screen_rc service "command-line"
-function screen_rc {
- SCREEN_NAME=${SCREEN_NAME:-stack}
- SCREENRC=$TOP_DIR/$SCREEN_NAME-screenrc
- if [[ ! -e $SCREENRC ]]; then
- # Name the screen session
- echo "sessionname $SCREEN_NAME" > $SCREENRC
- # Set a reasonable statusbar
- echo "hardstatus alwayslastline '$SCREEN_HARDSTATUS'" >> $SCREENRC
- # Some distributions override PROMPT_COMMAND for the screen terminal type - turn that off
- echo "setenv PROMPT_COMMAND /bin/true" >> $SCREENRC
- echo "screen -t shell bash" >> $SCREENRC
- fi
- # If this service doesn't already exist in the screenrc file
- if ! grep $1 $SCREENRC 2>&1 > /dev/null; then
- NL=`echo -ne '\015'`
- echo "screen -t $1 bash" >> $SCREENRC
- echo "stuff \"$2$NL\"" >> $SCREENRC
-
- if [[ -n ${SCREEN_LOGDIR} ]]; then
- echo "logfile ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log" >>$SCREENRC
- echo "log on" >>$SCREENRC
- fi
- fi
-}
-
-# Stop a service in screen
-# 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
-# screen_stop service
-function screen_stop {
- SCREEN_NAME=${SCREEN_NAME:-stack}
- SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
- USE_SCREEN=$(trueorfalse True $USE_SCREEN)
-
- if is_service_enabled $1; then
- # Kill via pid if we have one available
- if [[ -r $SERVICE_DIR/$SCREEN_NAME/$1.pid ]]; then
- pkill -TERM -P -$(cat $SERVICE_DIR/$SCREEN_NAME/$1.pid)
- rm $SERVICE_DIR/$SCREEN_NAME/$1.pid
- fi
- if [[ "$USE_SCREEN" = "True" ]]; then
- # Clean up the screen window
- screen -S $SCREEN_NAME -p $1 -X kill
- fi
- fi
-}
-
-# Helper to get the status of each running service
-# service_check
-function service_check {
- local service
- local failures
- SCREEN_NAME=${SCREEN_NAME:-stack}
- SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
-
-
- if [[ ! -d "$SERVICE_DIR/$SCREEN_NAME" ]]; then
- echo "No service status directory found"
- return
- fi
-
- # Check if there is any falure flag file under $SERVICE_DIR/$SCREEN_NAME
- # make this -o errexit safe
- failures=`ls "$SERVICE_DIR/$SCREEN_NAME"/*.failure 2>/dev/null || /bin/true`
-
- for service in $failures; do
- service=`basename $service`
- service=${service%.failure}
- echo "Error: Service $service is not running"
- done
-
- if [ -n "$failures" ]; then
- die $LINENO "More details about the above errors can be found with screen, with ./rejoin-stack.sh"
- fi
-}
-
-
-# Python Functions
-# ================
-
-# Get the path to the pip command.
-# get_pip_command
-function get_pip_command {
- which pip || which pip-python
-
- if [ $? -ne 0 ]; then
- die $LINENO "Unable to find pip; cannot continue"
- fi
-}
-
-# Get the path to the directory where python executables are installed.
-# get_python_exec_prefix
-function get_python_exec_prefix {
- if is_fedora || is_suse; then
- echo "/usr/bin"
- else
- echo "/usr/local/bin"
- fi
-}
-
-# Wrapper for ``pip install`` to set cache and proxy environment variables
-# Uses globals ``OFFLINE``, ``PIP_DOWNLOAD_CACHE``, ``PIP_USE_MIRRORS``,
-# ``TRACK_DEPENDS``, ``*_proxy``
-# pip_install package [package ...]
-function pip_install {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- if [[ "$OFFLINE" = "True" || -z "$@" ]]; then
- $xtrace
- return
- fi
-
- if [[ -z "$os_PACKAGE" ]]; then
- GetOSVersion
- fi
- if [[ $TRACK_DEPENDS = True ]]; then
- source $DEST/.venv/bin/activate
- CMD_PIP=$DEST/.venv/bin/pip
- SUDO_PIP="env"
- else
- SUDO_PIP="sudo"
- CMD_PIP=$(get_pip_command)
- 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}
- if [[ "$PIP_USE_MIRRORS" != "False" ]]; then
- PIP_MIRROR_OPT="--use-mirrors"
- fi
-
- # pip < 1.4 has a bug where it will use an already existing build
- # directory unconditionally. Say an earlier component installs
- # foo v1.1; pip will have built foo's source in
- # /tmp/$USER-pip-build. Even if a later component specifies foo <
- # 1.1, the existing extracted build will be used and cause
- # confusing errors. By creating unique build directories we avoid
- # this problem. See https://github.com/pypa/pip/issues/709
- local pip_build_tmp=$(mktemp --tmpdir -d pip-build.XXXXX)
-
- $xtrace
- $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}
-}
-
-# this should be used if you want to install globally, all libraries should
-# use this, especially *oslo* ones
-function setup_install {
- local project_dir=$1
- setup_package_with_req_sync $project_dir
-}
-
-# this should be used for projects which run services, like all services
-function setup_develop {
- local project_dir=$1
- setup_package_with_req_sync $project_dir -e
-}
-
-# ``pip install -e`` the package, which processes the dependencies
-# using pip before running `setup.py develop`
-#
-# Updates the dependencies in project_dir from the
-# openstack/requirements global list before installing anything.
-#
-# Uses globals ``TRACK_DEPENDS``, ``REQUIREMENTS_DIR``, ``UNDO_REQUIREMENTS``
-# setup_develop directory
-function setup_package_with_req_sync {
- local project_dir=$1
- local flags=$2
-
- # Don't update repo if local changes exist
- # Don't use buggy "git diff --quiet"
- # ``errexit`` requires us to trap the exit code when the repo is changed
- local update_requirements=$(cd $project_dir && git diff --exit-code >/dev/null || echo "changed")
-
- if [[ $update_requirements != "changed" ]]; then
- (cd $REQUIREMENTS_DIR; \
- $SUDO_CMD python update.py $project_dir)
- fi
-
- setup_package $project_dir $flags
-
- # We've just gone and possibly modified the user's source tree in an
- # automated way, which is considered bad form if it's a development
- # tree because we've screwed up their next git checkin. So undo it.
- #
- # However... there are some circumstances, like running in the gate
- # where we really really want the overridden version to stick. So provide
- # a variable that tells us whether or not we should UNDO the requirements
- # changes (this will be set to False in the OpenStack ci gate)
- if [ $UNDO_REQUIREMENTS = "True" ]; then
- if [[ $update_requirements != "changed" ]]; then
- (cd $project_dir && git reset --hard)
- fi
- fi
-}
-
-# ``pip install -e`` the package, which processes the dependencies
-# using pip before running `setup.py develop`
-# Uses globals ``STACK_USER``
-# setup_develop_no_requirements_update directory
-function setup_package {
- local project_dir=$1
- local flags=$2
-
- pip_install $flags $project_dir
- # ensure that further actions can do things like setup.py sdist
- if [[ "$flags" == "-e" ]]; then
- safe_chown -R $STACK_USER $1/*.egg-info
- fi
-}
-
-
-# Service Functions
-# =================
-
-# remove extra commas from the input string (i.e. ``ENABLED_SERVICES``)
-# _cleanup_service_list service-list
-function _cleanup_service_list {
- echo "$1" | sed -e '
- s/,,/,/g;
- s/^,//;
- s/,$//
- '
-}
-
-# disable_all_services() removes all current services
-# from ``ENABLED_SERVICES`` to reset the configuration
-# before a minimal installation
-# Uses global ``ENABLED_SERVICES``
-# disable_all_services
-function disable_all_services {
- ENABLED_SERVICES=""
-}
-
-# Remove all services starting with '-'. For example, to install all default
-# services except rabbit (rabbit) set in ``localrc``:
-# ENABLED_SERVICES+=",-rabbit"
-# Uses global ``ENABLED_SERVICES``
-# disable_negated_services
-function disable_negated_services {
- local tmpsvcs="${ENABLED_SERVICES}"
- local service
- for service in ${tmpsvcs//,/ }; do
- if [[ ${service} == -* ]]; then
- tmpsvcs=$(echo ${tmpsvcs}|sed -r "s/(,)?(-)?${service#-}(,)?/,/g")
- fi
- done
- ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs")
-}
-
-# disable_service() removes the services passed as argument to the
-# ``ENABLED_SERVICES`` list, if they are present.
-#
-# For example:
-# disable_service rabbit
-#
-# This function does not know about the special cases
-# for nova, glance, and neutron built into is_service_enabled().
-# Uses global ``ENABLED_SERVICES``
-# disable_service service [service ...]
-function disable_service {
- local tmpsvcs=",${ENABLED_SERVICES},"
- local service
- for service in $@; do
- if is_service_enabled $service; then
- tmpsvcs=${tmpsvcs//,$service,/,}
- fi
- done
- ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs")
-}
-
-# enable_service() adds the services passed as argument to the
-# ``ENABLED_SERVICES`` list, if they are not already present.
-#
-# For example:
-# enable_service qpid
-#
-# This function does not know about the special cases
-# for nova, glance, and neutron built into is_service_enabled().
-# Uses global ``ENABLED_SERVICES``
-# enable_service service [service ...]
-function enable_service {
- local tmpsvcs="${ENABLED_SERVICES}"
- for service in $@; do
- if ! is_service_enabled $service; then
- tmpsvcs+=",$service"
- fi
- done
- ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs")
- disable_negated_services
-}
-
-# is_service_enabled() checks if the service(s) specified as arguments are
-# enabled by the user in ``ENABLED_SERVICES``.
-#
-# Multiple services specified as arguments are ``OR``'ed together; the test
-# is a short-circuit boolean, i.e it returns on the first match.
-#
-# There are special cases for some 'catch-all' services::
-# **nova** returns true if any service enabled start with **n-**
-# **cinder** returns true if any service enabled start with **c-**
-# **ceilometer** returns true if any service enabled start with **ceilometer**
-# **glance** returns true if any service enabled start with **g-**
-# **neutron** returns true if any service enabled start with **q-**
-# **swift** returns true if any service enabled start with **s-**
-# **trove** returns true if any service enabled start with **tr-**
-# For backward compatibility if we have **swift** in ENABLED_SERVICES all the
-# **s-** services will be enabled. This will be deprecated in the future.
-#
-# Cells within nova is enabled if **n-cell** is in ``ENABLED_SERVICES``.
-# We also need to make sure to treat **n-cell-region** and **n-cell-child**
-# as enabled in this case.
-#
-# Uses global ``ENABLED_SERVICES``
-# is_service_enabled service [service ...]
-function is_service_enabled {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local enabled=1
- services=$@
- for service in ${services}; do
- [[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && enabled=0
-
- # Look for top-level 'enabled' function for this service
- if type is_${service}_enabled >/dev/null 2>&1; then
- # A function exists for this service, use it
- is_${service}_enabled
- enabled=$?
- fi
-
- # TODO(dtroyer): Remove these legacy special-cases after the is_XXX_enabled()
- # are implemented
-
- [[ ${service} == n-cell-* && ${ENABLED_SERVICES} =~ "n-cell" ]] && enabled=0
- [[ ${service} == "nova" && ${ENABLED_SERVICES} =~ "n-" ]] && enabled=0
- [[ ${service} == "cinder" && ${ENABLED_SERVICES} =~ "c-" ]] && enabled=0
- [[ ${service} == "ceilometer" && ${ENABLED_SERVICES} =~ "ceilometer-" ]] && enabled=0
- [[ ${service} == "glance" && ${ENABLED_SERVICES} =~ "g-" ]] && enabled=0
- [[ ${service} == "ironic" && ${ENABLED_SERVICES} =~ "ir-" ]] && enabled=0
- [[ ${service} == "neutron" && ${ENABLED_SERVICES} =~ "q-" ]] && enabled=0
- [[ ${service} == "trove" && ${ENABLED_SERVICES} =~ "tr-" ]] && enabled=0
- [[ ${service} == "swift" && ${ENABLED_SERVICES} =~ "s-" ]] && enabled=0
- [[ ${service} == s-* && ${ENABLED_SERVICES} =~ "swift" ]] && enabled=0
- done
- $xtrace
- return $enabled
-}
-
-# Toggle enable/disable_service for services that must run exclusive of each other
-# $1 The name of a variable containing a space-separated list of services
-# $2 The name of a variable in which to store the enabled service's name
-# $3 The name of the service to enable
-function use_exclusive_service {
- local options=${!1}
- local selection=$3
- out=$2
- [ -z $selection ] || [[ ! "$options" =~ "$selection" ]] && return 1
- for opt in $options;do
- [[ "$opt" = "$selection" ]] && enable_service $opt || disable_service $opt
- done
- eval "$out=$selection"
- return 0
-}
-
-
-# System Functions
-# ================
-
-# Only run the command if the target file (the last arg) is not on an
-# NFS filesystem.
-function _safe_permission_operation {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local args=( $@ )
- local last
- local sudo_cmd
- local dir_to_check
-
- let last="${#args[*]} - 1"
-
- dir_to_check=${args[$last]}
- if [ ! -d "$dir_to_check" ]; then
- dir_to_check=`dirname "$dir_to_check"`
- fi
-
- if is_nfs_directory "$dir_to_check" ; then
- $xtrace
- return 0
- fi
-
- if [[ $TRACK_DEPENDS = True ]]; then
- sudo_cmd="env"
- else
- sudo_cmd="sudo"
- fi
-
- $xtrace
- $sudo_cmd $@
-}
-
-# Exit 0 if address is in network or 1 if address is not in network
-# ip-range is in CIDR notation: 1.2.3.4/20
-# address_in_net ip-address ip-range
-function address_in_net {
- local ip=$1
- local range=$2
- local masklen=${range#*/}
- local network=$(maskip ${range%/*} $(cidr2netmask $masklen))
- local subnet=$(maskip $ip $(cidr2netmask $masklen))
- [[ $network == $subnet ]]
-}
-
-# Add a user to a group.
-# add_user_to_group user group
-function add_user_to_group {
- local user=$1
- local group=$2
-
- if [[ -z "$os_VENDOR" ]]; then
- GetOSVersion
- fi
-
- # SLE11 and openSUSE 12.2 don't have the usual usermod
- if ! is_suse || [[ "$os_VENDOR" = "openSUSE" && "$os_RELEASE" != "12.2" ]]; then
- sudo usermod -a -G "$group" "$user"
- else
- sudo usermod -A "$group" "$user"
- fi
-}
-
-# Convert CIDR notation to a IPv4 netmask
-# cidr2netmask cidr-bits
-function cidr2netmask {
- local maskpat="255 255 255 255"
- local maskdgt="254 252 248 240 224 192 128"
- set -- ${maskpat:0:$(( ($1 / 8) * 4 ))}${maskdgt:$(( (7 - ($1 % 8)) * 4 )):3}
- echo ${1-0}.${2-0}.${3-0}.${4-0}
-}
-
-# Gracefully cp only if source file/dir exists
-# cp_it source destination
-function cp_it {
- if [ -e $1 ] || [ -d $1 ]; then
- cp -pRL $1 $2
- fi
-}
-
-# HTTP and HTTPS proxy servers are supported via the usual environment variables [1]
-# ``http_proxy``, ``https_proxy`` and ``no_proxy``. They can be set in
-# ``localrc`` or on the command line if necessary::
-#
-# [1] http://www.w3.org/Daemon/User/Proxies/ProxyClients.html
-#
-# http_proxy=http://proxy.example.com:3128/ no_proxy=repo.example.net ./stack.sh
-
-function export_proxy_variables {
- if [[ -n "$http_proxy" ]]; then
- export http_proxy=$http_proxy
- fi
- if [[ -n "$https_proxy" ]]; then
- export https_proxy=$https_proxy
- fi
- if [[ -n "$no_proxy" ]]; then
- export no_proxy=$no_proxy
- fi
-}
-
-# Returns true if the directory is on a filesystem mounted via NFS.
-function is_nfs_directory {
- local mount_type=`stat -f -L -c %T $1`
- test "$mount_type" == "nfs"
-}
-
-# Return the network portion of the given IP address using netmask
-# netmask is in the traditional dotted-quad format
-# maskip ip-address netmask
-function maskip {
- local ip=$1
- local mask=$2
- local l="${ip%.*}"; local r="${ip#*.}"; local n="${mask%.*}"; local m="${mask#*.}"
- local subnet=$((${ip%%.*}&${mask%%.*})).$((${r%%.*}&${m%%.*})).$((${l##*.}&${n##*.})).$((${ip##*.}&${mask##*.}))
- echo $subnet
-}
-
-# Service wrapper to restart services
-# restart_service service-name
-function restart_service {
- if is_ubuntu; then
- sudo /usr/sbin/service $1 restart
- else
- sudo /sbin/service $1 restart
- fi
-}
-
-# Only change permissions of a file or directory if it is not on an
-# NFS filesystem.
-function safe_chmod {
- _safe_permission_operation chmod $@
-}
-
-# Only change ownership of a file or directory if it is not on an NFS
-# filesystem.
-function safe_chown {
- _safe_permission_operation chown $@
-}
-
-# Service wrapper to start services
-# start_service service-name
-function start_service {
- if is_ubuntu; then
- sudo /usr/sbin/service $1 start
- else
- sudo /sbin/service $1 start
- fi
-}
-
-# Service wrapper to stop services
-# stop_service service-name
-function stop_service {
- if is_ubuntu; then
- sudo /usr/sbin/service $1 stop
- else
- sudo /sbin/service $1 stop
- fi
-}
-
-
-# Restore xtrace
-$XTRACE
-
-# Local variables:
-# mode: shell-script
-# End:
diff --git a/labs/osbash/lib/functions.fedora.sh b/labs/osbash/lib/functions.fedora.sh
deleted file mode 100644
index 18400460..00000000
--- a/labs/osbash/lib/functions.fedora.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Fedora /etc/sysconfig/network-scripts/ifcfg-* configuration
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-function config_netif {
- local if_type=$1
- local if_num=${2:-""}
- local ip_address=${3:-""}
- local template
-
- if [ "$if_type" = "dhcp" ]; then
- template="template-fedora-ifcfg-dhcp"
- else
- template="template-fedora-ifcfg-static"
- fi
-
- local if_name="$(ifnum_to_ifname "$if_num")"
-
- local if_file=/etc/sysconfig/network-scripts/ifcfg-$if_name
-
- sed -e "
- s,%IF_NAME%,$if_name,g;
- s,%IP_ADDRESS%,$ip_address,g;
- " "$TEMPLATE_DIR/$template" | sudo tee "$if_file"
-}
-
-function netcfg_init {
- : # Not needed for Fedora
-}
-
-function netcfg_show {
- local cfg
- for cfg in /etc/sysconfig/network-scripts/ifcfg-*; do
- echo ---------- "$cfg"
- cat "$cfg"
- done
- echo ---------------------------------------------------------------
-}
diff --git a/labs/osbash/lib/functions.guest.sh b/labs/osbash/lib/functions.guest.sh
deleted file mode 100644
index c81c225f..00000000
--- a/labs/osbash/lib/functions.guest.sh
+++ /dev/null
@@ -1,466 +0,0 @@
-# This file contains bash functions that may be used by guest systems (VMs).
-
-# Sourcing this file calls functions fix_path_env and source_deploy.
-
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.sh"
-source "$LIB_DIR/functions-common-devstack"
-
-# Make devstack's operating system identification work with nounset
-function init_os_ident {
- if [[ -z "${os_PACKAGE:-""}" ]]; then
- GetOSVersion
- fi
-}
-
-function source_deploy {
- if [ -n "${VM_SHELL_USER:-}" ]; then
- # Already sourced
- return 0
- fi
- if mountpoint -q /vagrant; then
- source "$CONFIG_DIR/deploy.vagrant"
- else
- source "$CONFIG_DIR/deploy.osbash"
- fi
-}
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# If our sudo user's PATH is preserved (and does not contain sbin dirs),
-# some commands won't be found. Observed with Vagrant shell provisioner
-# scripts using sudo after "su - vagrant".
-# Adding to the path seems preferable to messing with the vagrant user's
-# sudoers environment (or working with a separate Vagrant user).
-
-function fix_path_env {
- if is_root; then return 0; fi
- if echo 'echo $PATH'|sudo sh|grep -q '/sbin'; then return 0; fi
- export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
-}
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-function zero_empty_space {
- echo "Filling empty disk space with zeros"
- sudo dd if=/dev/zero of=/filler bs=1M 2>/dev/null || true
- sudo rm /filler
-}
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# For guest scripts to let osbash know they are running; used when osbashauto
-# runs scripts inside of the VM (STATUS_DIR directory must be shared between
-# host and VM).
-
-function indicate_current_auto {
- if [ "${VM_SHELL_USER:-}" = "osbash" ]; then
- local scr_name=${1:-$(basename "$0")}
- local fpath=${2:-"/$STATUS_DIR/$scr_name.begin"}
- mkdir -p "$STATUS_DIR"
- touch "$fpath"
- fi
- log_point "script begin"
-}
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Debug function to make a script halt execution until a tmp file is removed
-
-function wait_for_file {
- # If no argument is passed, use empty string (to pass nounset option)
- local msg=${1-""}
- local wait_file=remove_to_continue
- [ -n "$msg" ] && wait_file=${wait_file}_${msg}
- echo >&2 "DEBUG wait_for_file pause; remove /tmp/$wait_file to continue."
- touch "/tmp/$wait_file"
- while [ -e "/tmp/$wait_file" ]; do
- sleep 1
- done
-}
-#-------------------------------------------------------------------------------
-# Copy stdin/stderr to log file
-#-------------------------------------------------------------------------------
-
-function exec_logpath {
- local log_path=$1
-
- # Append all stdin and stderr to log file
- exec > >(tee -a "$log_path") 2>&1
-}
-
-function exec_logfile {
- local log_dir=${1:-/home/$VM_SHELL_USER/log}
-
- # Default extension is log
- local ext=${2:-log}
-
- mkdir -p "$log_dir"
-
- # Log name based on name of running script
- local base_name=$(basename "$0" .sh)
-
- local prefix=$(get_next_prefix "$log_dir" "$ext")
- local log_name="${prefix}_$base_name.$ext"
-
- exec_logpath "$log_dir/$log_name"
-}
-
-#-------------------------------------------------------------------------------
-# Functions that need to run as root
-#-------------------------------------------------------------------------------
-
-# /sbin/mount.vboxsf often ends up as a broken symlink, resulting in errors
-# when trying to mount the share in osbashauto.
-function as_root_fix_mount_vboxsf_link {
- local file=/sbin/mount.vboxsf
- if [ -L $file -a ! -e $file ]; then
- echo "$file is a broken symlink:"
- ls -l "$file"
- echo "Trying to fix it."
-
- sdir="/usr/lib/VBoxGuestAdditions"
- if [ -L "$sdir" -a ! -e "$sdir" ]; then
- # /usr/lib/VBoxGuestAdditions is a convenient link into a directory
- # under /opt that changes its name with VirtualBox versions.
- # In some cases, the link was missing but /sbin/mount.vboxsf
- # pointed there.
- echo "$sdir is a broken symlink:"
- ls -l "sdir"
- shopt -s nullglob
- local new=(/opt/VBoxGuestAdditions*/lib/VBoxGuestAdditions)
- if [ -n "$new" ]; then
- ln -sv "$new" "$sdir"
- else
- echo "as_root_fix_mount_vboxsf_link: no VGA dir, aborting."
- return 1
- fi
- fi
-
- if [ -L $file -a ! -e $file ]; then
- # In some cases, /sbin/mount.vboxsf gets the path in
- # /usr/lib/VBoxGuestAdditions. Try to fix the link.
- echo "Trying harder."
- new_target=$(find "$sdir/" -name "mount.vboxsf")
- if [ -z "$new_target" ]; then
- echo "as_root_fix_mount_vboxsf_link: no mount.vboxsf, aborting."
- return 1
- else
- echo "Found new target: $new_target"
- fi
- ln -svf "$new_target" "$file"
- fi
- fi
-}
-
-function as_root_inject_sudoer {
- if grep -q "${VM_SHELL_USER}" /etc/sudoers; then
- echo "${VM_SHELL_USER} already in /etc/sudoers"
- else
- echo "${VM_SHELL_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
- echo "Defaults:${VM_SHELL_USER} !requiretty" >> /etc/sudoers
- fi
-}
-
-# Change to a regular user to execute a guest script (and log its output)
-
-function as_root_exec_script {
- local script_path=$1
- local script_name="$(basename "$script_path" .sh)"
-
- echo "$(date) start $script_path"
-
- local prefix=$(get_next_prefix "$LOG_DIR" "auto")
- local log_path=$LOG_DIR/${prefix}_$script_name.auto
-
- su - "$VM_SHELL_USER" -c "bash $script_path" >"$log_path" 2>&1
- local rc=$?
- if [ $rc -ne 0 ]; then
- echo "$(date) ERROR: status $rc for $script_path" |
- tee >&2 -a "$LOG_DIR/error.log"
- else
- echo "$(date) done"
- fi
- return $rc
-}
-
-#-------------------------------------------------------------------------------
-# Root wrapper around devstack functions for manipulating config files
-#-------------------------------------------------------------------------------
-
-# Return predictable temporary path for configuration file editing.
-# Used to simplify debugging.
-function get_iniset_tmpfile {
- local file=$1
-
- # Set tmpdir="$LOG_DIR" if you want the temporary files to survive reboots.
- local tmpdir="/tmp"
- local ext="iniset"
-
- local prefix=$(get_next_prefix "$tmpdir" "$ext")
-
- # Typical tmpfile path: /tmp/000_etc_keystone_keystone.conf.iniset
- local tmpfile=$tmpdir/$prefix$(echo "$file" | tr '/' '_').$ext
-
- # Create file owned by regular user so it can be edited without privileges
- touch "$tmpfile"
-
- echo "$tmpfile"
-}
-
-# Set an option in an INI file
-# iniset config-file section option value
-function iniset_sudo {
- if (($# != 4)); then
- echo -n "ERROR: $# instead of 4 arguments for iniset: $*"
- exit 1
- fi
-
- local file=$1
- shift
- local tmpfile=$(get_iniset_tmpfile "$file")
- # Create a temporary copy, work on it, and copy it back into place
- sudo cp -fv "$file" "$tmpfile"
- echo >&2 iniset "$tmpfile" "$@"
- iniset "$tmpfile" "$@"
- cat "$tmpfile" | sudo tee "$file" >/dev/null
-}
-
-# Comment an option in an INI file
-# inicomment config-file section option
-function inicomment_sudo {
- local file=$1
- shift
- local tmpfile=$(get_iniset_tmpfile "$file")
- # Create a temporary copy, work on it, and copy it back into place
- sudo cp -fv "$file" "$tmpfile"
- echo >&2 inicomment "$tmpfile" "$@"
- inicomment "$tmpfile" "$@"
- cat "$tmpfile" | sudo tee "$file" >/dev/null
-}
-
-# Determinate is the given option present in the INI file
-# ini_has_option config-file section option
-function ini_has_option_sudo {
- local file=$1
- shift
- local tmpfile=$(get_iniset_tmpfile "$file")
- # Create a temporary copy, work on it
- sudo cp -fv "$file" "$tmpfile"
- echo >&2 ini_has_option "$tmpfile" "$@"
- ini_has_option "$tmpfile" "$@"
-}
-
-#-------------------------------------------------------------------------------
-# Functions for manipulating config files without section
-#-------------------------------------------------------------------------------
-
-function iniset_sudo_no_section {
- local file=$1
- shift
- local tmpfile=$(get_iniset_tmpfile "$file")
- # Create a temporary copy, work on it, and copy it back into place
- sudo cp -fv "$file" "$tmpfile"
- iniset_no_section "$tmpfile" "$@"
- cat "$tmpfile" | sudo tee "$file" >/dev/null
-}
-
-# ini_has_option_no_section config-file option
-function ini_has_option_no_section {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local file=$1
- local option=$2
- local line
- line=$(sed -ne "/^$option[ \t]*=/ p;" "$file")
- $xtrace
- [ -n "$line" ]
-}
-
-# Set an option in an INI file
-# iniset_no_section config-file option value
-function iniset_no_section {
- local xtrace=$(set +o | grep xtrace)
- set +o xtrace
- local file=$1
- local option=$2
- local value=$3
-
- [[ -z $option ]] && return
-
- if ! ini_has_option_no_section "$file" "$option"; then
- # Add it
- sed -i -e "1 i\
-$option = $value
-" "$file"
- else
- local sep=$(echo -ne "\x01")
- # Replace it
- sed -i -e '/^'${option}'/ s'${sep}'^\('${option}'[ \t]*=[ \t]*\).*$'${sep}'\1'"${value}"${sep} "$file"
- fi
- $xtrace
-}
-
-
-#-------------------------------------------------------------------------------
-# OpenStack helpers
-#-------------------------------------------------------------------------------
-
-function mysql_exe {
- local cmd="$1"
- echo "mysql cmd: $cmd."
- sudo mysql -u "root" -p"$DATABASE_PASSWORD" -e "$cmd"
-}
-
-function setup_database {
- local service=$1
- local db_user=$2
- local db_password=$3
-
- echo -n "Waiting for database server to come up."
- until mysql_exe quit >/dev/null 2>&1; do
- sleep 1
- echo -n .
- done
- echo
-
- mysql_exe "CREATE DATABASE $service"
- mysql_exe "GRANT ALL ON ${service}.* TO '$db_user'@'%' IDENTIFIED BY '$db_password';"
- mysql_exe "GRANT ALL ON ${service}.* TO '$db_user'@'localhost' IDENTIFIED BY '$db_password';"
-}
-
-# Wait for neutron to come up. Due to a race during the operating system boot
-# process, the neutron server sometimes fails to come up. We restart the
-# neutron server if it does not reply for too long.
-function wait_for_neutron {
- (
- source $CONFIG_DIR/demo-openstackrc.sh
- echo -n "Waiting for neutron to come up."
- local cnt=0
- until openstack network list >/dev/null 2>&1; do
- if [ "$cnt" -eq 10 ]; then
- echo
- echo "ERROR No response from neutron. Restarting neutron-server."
- node_ssh controller "sudo service neutron-server restart"
- echo -n "Waiting for neutron to come up."
- elif [ "$cnt" -eq 20 ]; then
- echo
- echo "ERROR neutron does not seem to come up. Aborting."
- exit 1
- fi
- echo -n .
- sleep 1
- cnt=$((cnt + 1))
- done
- echo
- )
-}
-
-# Wait for keystone to come up
-function wait_for_keystone {
- (
- source "$CONFIG_DIR/admin-openstackrc.sh"
- echo -n "Waiting for keystone to come up."
- until openstack user list >/dev/null 2>&1; do
- echo -n .
- sleep 1
- done
- echo
- )
-}
-
-#-------------------------------------------------------------------------------
-# Network configuration
-#-------------------------------------------------------------------------------
-
-# Return the nth network interface name (not counting loopback; 0 -> eth0)
-function ifnum_to_ifname {
- local if_num=$1
-
- # Skip loopback and start counting with next interface
- local iface=${IF_NAMES[$((if_num + 1))]}
-
- echo >&2 "ifnum_to_ifname: interface $if_num is $iface"
- echo "$iface"
-}
-
-# Get all network interfaces (e.g. eth0, p2p1, ens0, enp0s3) into an array
-function set_iface_list {
- unset IF_NAMES
- local iface
- for iface in $(ip -o link show|awk '/: / {print $2}'|tr -d ':'); do
- IF_NAMES+=($iface)
- done
- echo "Set IF_NAMES to ${IF_NAMES[*]}"
-}
-
-function hostname_to_ip {
- local host_name=$1
- getent hosts "$host_name"|awk '{print $1}'
-}
-
-function config_network {
- init_os_ident
- if is_ubuntu; then
- source "$LIB_DIR/functions.ubuntu.sh"
- else
- source "$LIB_DIR/functions.fedora.sh"
- fi
-
- netcfg_init
-
- # Get network interface configuration (NET_IF_?) for this node
- unset -v NET_IF_0 NET_IF_1 NET_IF_2 NET_IF_3
- get_node_netif_config "$(hostname)"
-
- local index
- local iftype
- for index in "${!NODE_IF_TYPE[@]}"; do
- iftype=${NODE_IF_TYPE[index]}
- config_netif "$iftype" "$index" "${NODE_IF_IP[index]}"
- done
-}
-
-#-------------------------------------------------------------------------------
-# Log points
-#------------------------------------------------------------------------------
-
-# Record current size of log files of interest so we can later split them
-# accordingly.
-# Log points can be set anywhere in a client script simply by adding a
-# line: log_point "log point name"
-
-function log_point {
- local caller=$(basename "$0" .sh)
- local commit_msg=$1
- local logdir=${2:-/var/log}
- local ext=lsl
- local prefix=$(get_next_prefix "$logdir" "$ext")
-
- local fname
- fname=${prefix}_$(echo "${caller}_-_$commit_msg"|tr ' ' '_').$ext
-
- (
- cd "$logdir"
- sudo bash -c "shopt -s nullglob; ls -l auth.log* keystone/* upstart/*.log mysql/* neutron/*" | \
- sudo tee "$logdir/$fname" > /dev/null
- )
-}
-
-#-------------------------------------------------------------------------------
-# ssh wrapper functions
-#-------------------------------------------------------------------------------
-
-function no_chk_ssh {
- echo >&2 "ssh $*"
- # Options set to disable strict host key checking and related messages.
- ssh \
- -o "UserKnownHostsFile /dev/null" \
- -o "StrictHostKeyChecking no" \
- -o LogLevel=error \
- "$@"
-}
-
-# ssh from one node VM to another node in the cluster
-function node_ssh {
- no_chk_ssh -i "$HOME/.ssh/osbash_key" "$@"
-}
-
-#-------------------------------------------------------------------------------
-fix_path_env
-source_deploy
-#-------------------------------------------------------------------------------
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/functions.sh b/labs/osbash/lib/functions.sh
deleted file mode 100644
index 06810c6b..00000000
--- a/labs/osbash/lib/functions.sh
+++ /dev/null
@@ -1,199 +0,0 @@
-# This file contains bash functions that may be used by both guest and host
-# systems.
-
-# Non-recursive removal of all files except README.*
-function clean_dir {
- local target_dir=$1
- if [ ! -e "$target_dir" ]; then
- mkdir -pv "$target_dir"
- elif [ ! -d "$target_dir" ]; then
- echo >&2 "Not a directory: $target_dir"
- return 1
- fi
- shopt -s nullglob
- local entries=("$target_dir"/*)
- if [ -n "${entries[0]-}" ]; then
- for f in "${entries[@]}"; do
- # Skip directories
- if [ ! -f "$f" ]; then
- continue
- fi
-
- # Skip README.*
- if [[ $f =~ /README\. ]]; then
- continue
- fi
-
- rm -f "$f"
- done
- fi
-}
-
-function is_root {
- if [ $EUID -eq 0 ]; then
- return 0
- else
- return 1
- fi
-}
-
-function yes_or_no {
- local prompt=$1
- local input=""
- while : ; do
- read -p "$prompt (Y/n): " input
- case "$input" in
- N|n)
- return 1
- ;;
- ""|Y|y)
- return 0
- ;;
- *)
- echo -e "${CError:-}Invalid input: ${CData:-}$input${CReset:-}"
- ;;
- esac
- done
-}
-
-#-------------------------------------------------------------------------------
-# Network helpers
-#-------------------------------------------------------------------------------
-
-function get_host_network_config {
- source "$CONFIG_DIR/openstack"
-
- local line
- # Iterate over all NETWORK_? variables
- for hostnet in "${!NETWORK_@}"; do
- line=(${!hostnet})
- NET_NAME+=(${line[0]})
- NET_IP+=(${line[1]})
- # Set .1 (e.g., 203.0.113.1) as the default gateway address
- NET_GW+=($(remove_last_octet ${line[1]}).1)
- done
-}
-
-function get_node_netif_config {
- local vm_name=$1
- source "$CONFIG_DIR/config.$vm_name"
-
- local net_if=""
- local line
- # Iterate over all NET_IF_? variables
- for net_if in "${!NET_IF_@}"; do
- local if_num=${net_if##*_}
- line=(${!net_if})
- NODE_IF_TYPE[$if_num]=${line[0]}
- NODE_IF_IP[$if_num]=${line[1]:-""}
- # Default boot priority is 0 for all interfaces
- NODE_IF_PRIO[$if_num]=${line[2]:=0}
- done
-}
-
-function remove_last_octet {
- # Remove last period and everything after it
- echo "${1%.*}"
-}
-
-function netname_to_network {
- local net_name=$1
- local index
-
- if [ -z "${NET_NAME+1}" ]; then
- # NET_NAME array is undefined
- get_host_network_config
- fi
-
- for index in "${!NET_NAME[@]}"; do
- if [ "$net_name" = "${NET_NAME[index]}" ]; then
- echo "${NET_IP[index]}"
- return 0
- fi
- done
- echo >&2 "ERROR: No network named $net_name."
- exit 1
-}
-
-function ip_to_netname {
- local ip=$1
- local ip_net=$(remove_last_octet "$ip").0
- local index
-
- if [ -z "${NET_NAME+1}" ]; then
- # NET_NAME array is undefined
- get_host_network_config
- fi
-
- for index in "${!NET_IP[@]}"; do
- # Remove last octet
- if [ "$ip_net" = "${NET_IP[index]}" ]; then
- echo "${NET_NAME[index]}"
- return 0
- fi
- done
-
- echo >&2 "ERROR: No network for IP address $ip. Exiting."
- exit 1
-}
-
-function get_node_ip_in_network {
- local vm_name=$1
- local netname=$2
- local ip
-
- if [ -z "${NET_NAME+1}" ]; then
- # NET_NAME array is undefined
- get_host_network_config
- fi
-
- get_node_netif_config "$vm_name"
-
- for ip in "${NODE_IF_IP[@]}"; do
- if [ -z "$ip" ]; then
- # This interface has no IP address. Next.
- continue
- elif [ "$(ip_to_netname "$ip")" = "$netname" ]; then
- echo >&2 "Success. Node $vm_name in $netname: $ip."
- echo "$ip"
- return 0
- fi
- done
-
- echo >&2 "ERROR: Node $vm_name not in network $netname. Exiting."
- exit 1
-}
-
-#-------------------------------------------------------------------------------
-# Helpers to incrementally number files via name prefixes
-#-------------------------------------------------------------------------------
-
-function get_next_file_number {
- local dir=$1
- local ext=${2:-""}
-
- # Get number of *.log files in directory
- shopt -s nullglob
- if [ -n "$ext" ]; then
- # Count files with specific extension
- local files=("$dir/"*".$ext")
- else
- # Count all files
- local files=("$dir/"*)
- fi
- echo "${#files[*]}"
-}
-
-function get_next_prefix {
- local dir=$1
- local ext=$2
- # Number of digits in prefix string (default 3)
- local digits=${3:-3}
-
- # Get number of *.$ext files in $dir
- local cnt=$(get_next_file_number "$dir" "$ext")
-
- printf "%0${digits}d" "$cnt"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/functions.ubuntu.sh b/labs/osbash/lib/functions.ubuntu.sh
deleted file mode 100644
index 33476e62..00000000
--- a/labs/osbash/lib/functions.ubuntu.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Ubuntu /etc/network/interfaces configuration
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-readonly UBUNTU_IF_FILE=/etc/network/interfaces
-
-function config_netif {
- local if_type=$1
- local if_num=${2:-""}
- local ip_address=${3:-""}
- local template
-
- if [ "$if_type" = "dhcp" ]; then
- template="template-ubuntu-interfaces-dhcp"
- elif [ "$if_type" = "manual" ]; then
- template="template-ubuntu-interfaces-manual"
- else
- template="template-ubuntu-interfaces-static"
- fi
-
- local if_name="$(ifnum_to_ifname "$if_num")"
-
- # Empty line before this entry
- echo | sudo tee -a "$UBUNTU_IF_FILE"
-
- sed -e "
- s,%IF_NAME%,$if_name,g;
- s,%IP_ADDRESS%,$ip_address,g;
- " "$TEMPLATE_DIR/$template" | sudo tee -a "$UBUNTU_IF_FILE"
-}
-
-function netcfg_init {
- # Configuration functions will append to this file
- sudo cp -v "$TEMPLATE_DIR/template-ubuntu-interfaces-loopback" \
- "$UBUNTU_IF_FILE"
-}
-
-function netcfg_show {
- echo ---------- "$UBUNTU_IF_FILE"
- cat "$UBUNTU_IF_FILE"
- echo ---------------------------------------------------------------
-}
diff --git a/labs/osbash/lib/osbash-ssh-keys/README.rst b/labs/osbash/lib/osbash-ssh-keys/README.rst
deleted file mode 100644
index 7f2dbcfd..00000000
--- a/labs/osbash/lib/osbash-ssh-keys/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-This directory contains the insecure ssh keys used by osbash for logging into
-the node VMs.
diff --git a/labs/osbash/lib/osbash-ssh-keys/osbash_key b/labs/osbash/lib/osbash-ssh-keys/osbash_key
deleted file mode 100644
index 26c6434e..00000000
--- a/labs/osbash/lib/osbash-ssh-keys/osbash_key
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEowIBAAKCAQEA0pxig+FU4OyoaJjYRcYzvFX70h2Sc7hUr7YSvYyHh9vjOOUE
-0eG2rWPuKjravQ8xoI7ElaeoT9kEn3FW2bUi9444d7I0jdxK0+FCnqkXoTV/2wip
-nR4NHiuZtRGz6SZWPn80mI+Kg8OcfKw3haB1R8nYdo8kRXXd/fzHGjUDmLkEZmW0
-fX+yCEh/fYrCMZqLGJ9z3gHyFQHC6k/TnGD4DyifrbE72xZGBNoTokuxHpNAvdCj
-lWyT9NVc92/3HBGEOVhZS9KKhZHrFUOSOHLYdcDBtuoJW2TuUlU9BgJXTML5vh/8
-J1YUPwIxeTZriBBp+OSuP3NHLKCM1nCnbjxMnwIDAQABAoIBAAkrH6rIE27bPpWX
-GcsnzrbDM3w5J1f8TUt87KHtzTSf4OtoJOaSIea4c/TIrR8P20Q3Et3E97HKK8ZZ
-I8PEe+o0+cZULq+CSIuiwciwacPt1UwOu3uIhF+s3DsisydSMOz1kq+ViB0mVdij
-kqMxkgl3AwJeRuDzOZ/F8lD0v9xVFVggqA5DLJhrXtPXrkMZYDlI9RtA3qvD1/RN
-/0QFiZNvbG9DpH/us5SWhI8FAtLgVBeylx5rLBebY59WGl2plyitGGOjtmTc7060
-bBWOZzT6PfruXvLj9O7dQwcEb0QNtAeNKHnyllYPNRHK8+WWP9JMg+h0JmV3r/UW
-ArGUvAECgYEA9pBDiTPdHKEdJW/Aic4ZGWMNbkCbxN6tHNXPfUQrOiyWtpShUjzI
-l4A9k6KTuWhsNQuLV2Cthdoa9WvEx9do/KXGuiXOhSkBm0ictsEeJMH50LbnQ6bX
-qMx7EPdyxmKQjcblUkB2Q+0TovPTPI61U9KYRFsj4iDXDftlrf/+Jp8CgYEA2qve
-2uWQvXWHe4EMKZpc/BqAIWmJiXzP9o4AD9ClOP9InNr2RVxVcTTVG0YEEqQDbPYi
-lq5k65QAA7NaojvHaawhz+VPqRFAKtzqzUpsDZPh9Db737Qclh3WacQiEecmHwtP
-1mYEIQTlCKTKfZ5yM0NASBD9kwWtjSSf2zpuGgECgYAEFfPojCF33fubqTRplC66
-SvfoAc4S/xWjSq+7hauptR9yOxhJQpSYXhmnHqSQB/jzEBPpCMMXWrvjoTuLjDhD
-J4QZhZLchgduyU8/gAe92DEJkl5WsqcUNv87Er6mJu/6SXd3W3YaPg17P8saT8sV
-boHzcAcyMhUeODJBJeLSRQKBgQDVOdygNFPz+oO20XoroyLijXC9o+yCTVt4PrUe
-tsQ1lPCYSwbzUXrbXboj0x0rlBTnDgdiSQGNmY5+DUjmg0YK69c4opEP+gtJAIxQ
-zC4a+0XMXkUyuK1bUBMApUjXjj7k7KHYHTgPfnda+12cKoGPLRekbjTlRRcbV0gt
-fIdaAQKBgGE1nzOZtA0z1cEVcucfy9yHjZqic1JN0os1H52CzsPUwCjpAwTMct9J
-7aLusbHBKQZgoOBuC0O/erV02oQIzTLWcjf45Uj52r0Rgt2kJpOKy8aPMZ9cpbq4
-tfMrBy/mZc7joHtfwtexLMm5EotkvHEzGXDIRZuyzOSTmlpSzEz3
------END RSA PRIVATE KEY-----
diff --git a/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub b/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub
deleted file mode 100644
index e4c98a3d..00000000
--- a/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub
+++ /dev/null
@@ -1 +0,0 @@
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key
diff --git a/labs/osbash/lib/osbash/functions-host.sh b/labs/osbash/lib/osbash/functions-host.sh
deleted file mode 100644
index ad588ff2..00000000
--- a/labs/osbash/lib/osbash/functions-host.sh
+++ /dev/null
@@ -1,730 +0,0 @@
-# This file contains bash functions that are used by osbash on the host.
-
-source "$LIB_DIR/functions.sh"
-
-#-------------------------------------------------------------------------------
-# Conditional execution
-#-------------------------------------------------------------------------------
-# TODO: Create a help function and display it under help by default or with
-# option --help (-h).
-# exec_cmd is used for conditional execution:
-#
-# OSBASH=exec_cmd
-#
-# Execute command only if OSBASH is set:
-# ${OSBASH:-:} cmd args
-#
-# Execute command only if OSBASH is not set:
-# ${OSBASH:+:} cmd args
-#
-# Disable actual call to VBoxManage (selectively override configuration):
-# OSBASH= cmd args
-#
-# Enable call to VBoxManage (selectively override configuration):
-# OSBASH=exec_cmd cmd args
-
-function exec_cmd {
- local cmd=$1
- shift
- $cmd "$@"
-}
-
-#-------------------------------------------------------------------------------
-function get_base_disk_name {
- echo "base-$VM_ACCESS-$OPENSTACK_RELEASE-$DISTRO"
-}
-
-# From DISTRO string (e.g., ubuntu-14.04-server-amd64), get first component
-function get_distro_name {
- # Match up to first dash
- local re='([^-]*)'
-
- if [[ $DISTRO =~ $re ]]; then
- echo "${BASH_REMATCH[1]}"
- fi
-}
-
-# Wrapper around vm_snapshot to deal with collisions with cluster rebuilds
-# starting from snapshot. We could delete the existing snapshot first,
-# rename the new one, or just skip the snapshot.
-function vm_conditional_snapshot {
- local vm_name=$1
- local shot_name=$2
-
- # On Windows, don't test; take snapshots unconditionally
- if ! WBATCH= vm_snapshot_exists "$vm_name" "$shot_name"; then
- vm_snapshot "$vm_name" "$shot_name"
- fi
-}
-
-#-------------------------------------------------------------------------------
-# Virtual VM keyboard using keycodes
-#-------------------------------------------------------------------------------
-
-function keyboard_send_escape {
- local vm_name=$1
- _keyboard_push_scancode "$vm_name" "$(esc2scancode)"
-}
-
-function keyboard_send_enter {
- local vm_name=$1
- _keyboard_push_scancode "$vm_name" "$(enter2scancode)"
-}
-
-function keyboard_send_backspace {
- local vm_name=$1
- _keyboard_push_scancode "$vm_name" "$(backspace2scancode)"
-}
-
-function keyboard_send_f6 {
- local vm_name=$1
- _keyboard_push_scancode "$vm_name" "$(f6_2scancode)"
-}
-
-# Turn strings into keycodes and send them to target VM
-function keyboard_send_string {
- local vm_name=$1
- local str=$2
- local cnt=0
-
- # This loop is inefficient enough that we don't overrun the keyboard input
- # buffer when pushing scancodes to the VM.
- while IFS= read -r -n1 char; do
- if [ -n "$char" ]; then
- SC=$(char2scancode "$char")
- if [ -n "$SC" ]; then
- _keyboard_push_scancode "$vm_name" "$SC"
- else
- echo >&2 "not found: $char"
- fi
- fi
-
- # Inject sleep into the wbatch files because the Windows batch file
- # is sometimes _too_ efficient and overruns the keyboard input buffer
- if [[ $((cnt % 50)) -eq 0 ]]; then
- OSBASH= ${WBATCH:-:} conditional_sleep 1
- fi
- cnt=$((cnt + 1))
-
- done <<< "$str"
-}
-
-#-------------------------------------------------------------------------------
-# Conditional sleeping
-#-------------------------------------------------------------------------------
-
-function conditional_sleep {
- sec=$1
-
- # Don't sleep if we are just faking it for wbatch
- ${OSBASH:-:} sleep "$sec"
- ${WBATCH:-:} wbatch_sleep "$sec"
-}
-
-#-------------------------------------------------------------------------------
-# Networking
-#-------------------------------------------------------------------------------
-
-function create_host_networks {
- get_host_network_config
-
- local index
- for index in "${!NET_NAME[@]}"; do
- create_network "$index"
- done
-}
-
-function configure_node_netifs {
- local vm_name=$1
-
- get_node_netif_config "$vm_name"
-
- local index
- local type
- local prio
- for index in "${!NODE_IF_TYPE[@]}"; do
- type=${NODE_IF_TYPE[index]}
- prio=${NODE_IF_PRIO[index]}
- if [ "$type" = "dhcp" ]; then
- vm_nic_base "$vm_name" "$index"
- elif [ "$type" = "manual" ]; then
- vm_nic_std "$vm_name" "$index"
- elif [ "$type" = "static" ]; then
- vm_nic_std "$vm_name" "$index"
- else
- echo >&2 "ERROR Unknown interface type: $type."
- exit 1
- fi
- if [ "$prio" -ne 0 ]; then
- # Elevate boot prio so this particular NIC is used for PXE booting
- vm_nic_set_boot_prio "$vm_name" "$index" "$prio"
- fi
- done
-}
-
-#-------------------------------------------------------------------------------
-# ssh
-#-------------------------------------------------------------------------------
-
-# Check permission for osbash insecure private key
-function check_osbash_private_key {
- local key_name="osbash_key"
- local osbash_key_dir=$LIB_DIR/osbash-ssh-keys
- local osbash_key_path=$osbash_key_dir/$key_name
-
- if ! ls -l "$osbash_key_path"|grep -q "^-r--------"; then
- echo "Adjusting permissions for $osbash_key_path"
- chmod 400 "$osbash_key_path"
- fi
-}
-
-function strip_top_dir {
- local full_path=$1
- echo "${full_path/$TOP_DIR\//}"
-}
-
-# Copy files or directories to VM (incl. implied directories; HOME is TOP_DIR)
-function vm_scp_to_vm {
- local ssh_port=$1
- shift
- local ssh_ip=${SSH_IP:=127.0.0.1}
-
- check_osbash_private_key
-
- while (($#)); do
- local src_path=$1
- shift
- local target_path=$(strip_top_dir "$src_path")
- local target_dir=$(dirname "$target_path")
- vm_ssh "$ssh_port" "mkdir -p $target_dir"
- # To avoid getting stuck on broken ssh connection, disable connection
- # sharing (ControlPath) and use a timeout when connecting.
- scp -q -r \
- -i "$LIB_DIR/osbash-ssh-keys/osbash_key" \
- -o "UserKnownHostsFile /dev/null" \
- -o "StrictHostKeyChecking no" \
- -o ConnectTimeout=10 \
- -o ControlPath=none \
- -P "$ssh_port" \
- "$src_path" "$VM_SHELL_USER@$ssh_ip:$target_dir"
- done
-}
-
-# Execute commands via ssh
-function vm_ssh {
- local ssh_port=$1
- shift
- local ssh_ip=${SSH_IP:=127.0.0.1}
-
- check_osbash_private_key
-
- # Some operating systems (e.g., Mac OS X) export locale settings to the
- # target that cause some Python clients to fail. Override with a standard
- # setting (LC_ALL=C).
- # To avoid getting stuck on broken ssh connection, disable connection
- # sharing (ControlPath) and use a timeout when connecting.
- LC_ALL=C ssh -q \
- -i "$LIB_DIR/osbash-ssh-keys/osbash_key" \
- -o "UserKnownHostsFile /dev/null" \
- -o "StrictHostKeyChecking no" \
- -o ConnectTimeout=10 \
- -o ControlPath=none \
- -p "$ssh_port" \
- "$VM_SHELL_USER@$ssh_ip" "$@"
-}
-
-function wait_for_ssh {
- local ssh_port=$1
-
- echo -e -n "${CStatus:-}Waiting for ssh server to respond on ${CData:-}${SSH_IP:-127.0.0.1}:$ssh_port${CReset:-}."
- while : ; do
- if vm_ssh "$ssh_port" exit ; then
- break
- else
- echo -n .
- sleep 1
- fi
- done
- echo
-}
-
-# Copy one script to VM and execute it via ssh; log output to separate file
-function ssh_exec_script {
- local ssh_port=$1
- local script_path=$2
-
- vm_scp_to_vm "$ssh_port" "$script_path"
-
- local remote_path=$(strip_top_dir "$script_path")
-
- echo -en "\n$(date) start $remote_path"
-
- local script_name=$(basename "$script_path" .sh)
- local prefix=$(get_next_prefix "$LOG_DIR" "auto")
- local log_path=$LOG_DIR/${prefix}_${script_name}.auto
-
- local rc=0
- vm_ssh "$ssh_port" "bash $remote_path && rm -vf $remote_path" \
- > "$log_path" 2>&1 || rc=$?
- if [ $rc -ne 0 ]; then
- echo >&2
- echo -e "${CError:-}ERROR: ssh returned status ${CData:-}$rc${CError:-} for${CData:-} $remote_path${CReset:-}" |
- tee >&2 -a "$LOG_DIR/error.log"
- touch "$STATUS_DIR/error"
- return $rc
- fi
-
- echo -en "\n$(date) done"
-}
-
-# Wait for sshd, prepare autostart dirs, and execute autostart scripts on VM
-function ssh_process_autostart {
- local vm_name=$1
-
- # Run this function in sub-shell to protect our caller's environment
- # (which might be _our_ environment if we get called again)
- (
- source "$CONFIG_DIR/config.$vm_name"
- ssh_env_for_node "$vm_name"
-
- local ssh_port
- if [ -n "${PXE_TMP_NODE_IP:-""}" ]; then
- ssh_port=22
- elif [ ${PROVIDER:-""} = virtualbox ]; then
- ssh_port=$VM_SSH_PORT
- else
- ssh_port=22
- fi
-
- wait_for_ssh "$ssh_port"
- vm_ssh "$ssh_port" "rm -rf lib config autostart scripts"
- vm_scp_to_vm "$ssh_port" "$TOP_DIR/lib" "$TOP_DIR/config" "$TOP_DIR/scripts"
-
- local script_path=""
- for script_path in "$AUTOSTART_DIR/"*.sh; do
- ssh_exec_script "$ssh_port" "$script_path"
- rm -f "$script_path" >&2
- done
- touch "$STATUS_DIR/done"
-
- )
-}
-
-#-------------------------------------------------------------------------------
-# Autostart mechanism
-#-------------------------------------------------------------------------------
-
-function autostart_reset {
- clean_dir "$AUTOSTART_DIR"
- clean_dir "$STATUS_DIR"
-}
-
-function process_begin_files {
- local processing=("$STATUS_DIR"/*.sh.begin)
- if [ -n "${processing[0]-}" ]; then
- local file
- for file in "${processing[@]}"; do
- echo >&2 -en "\nVM processing $(basename "$file" .begin)"
- rm "$file"
- done
- fi
-}
-
-# Wait until all autofiles are processed (indicated by a "$STATUS_DIR/done"
-# file created either by osbashauto or ssh_process_autostart)
-function wait_for_autofiles {
- shopt -s nullglob
-
- ${WBATCH:-:} wbatch_wait_auto
- # Remove autostart files and return if we are just faking it for wbatch
- ${OSBASH:+:} autostart_reset
- ${OSBASH:+:} return 0
-
- until [ -f "$STATUS_DIR/done" -o -f "$STATUS_DIR/error" ]; do
- # Note: begin files (created by indicate_current_auto) are only visible
- # if the STATUS_DIR directory is shared between host and VM
- ${WBATCH:-:} process_begin_files
- echo >&2 -n .
- sleep 1
- done
- # Check for remaining *.sh.begin files
- ${WBATCH:-:} process_begin_files
- if [ -f "$STATUS_DIR/done" ]; then
- rm "$STATUS_DIR/done"
- else
- echo -e >&2 "${CError:-}\nERROR occured. Exiting.${CReset:-}"
- exit 1
- fi
- echo
-}
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# Prepending numbers ensures scripts will be executed in the order they
-# were added to the queue.
-
-function _autostart_queue {
- local src_path=$SCRIPTS_DIR/$1
- local src_name=${1##*/}
-
- # If we get a target name, file will be renamed
- local target_name=${2:-$src_name}
-
- if [[ $target_name = *.sh ]]; then
- # Create target file name like 01_apt_init.sh
- local prefix=$(get_next_prefix "$AUTOSTART_DIR" "sh" 2)
- target_name="${prefix}_$target_name"
- fi
-
- if [ "$src_name" = "$target_name" ]; then
- echo >&2 -e "\t$src_name"
- else
- echo >&2 -e "\t$src_name -> $target_name"
- fi
-
- cp -- "$src_path" "$AUTOSTART_DIR/$target_name"
- ${WBATCH:-:} wbatch_cp_auto "$src_path" "$AUTOSTART_DIR/$target_name"
-}
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# Print to the console which file requested guest scripts to run
-function log_autostart_source {
- # If the caller doesn't provide a config file, log the caller's source file
- local src_file=${1:-${BASH_SOURCE[1]##*/}}
- echo >&2 "Copying autostart files set in $src_file"
-}
-
-# autostart [ ...]
-# e.g. autostart zero_empty.sh osbash/base_fixups.sh
-function autostart {
- # Don't log this file -- log our caller's source file
- log_autostart_source "${BASH_SOURCE[1]##*/}"
-
- while (($#)); do
- local src_file=$1
- shift
- _autostart_queue "$src_file"
- done
-}
-
-# Parse options given to configuration commands. Return parsed values by
-# setting variables to be used by caller.
-function get_cmd_options {
- local OPTIND
- local opt
-
- while getopts :g:n: opt; do
- case $opt in
- g)
- vm_ui=$OPTARG
- ;;
- n)
- vm_name=$OPTARG
- ;;
- *)
- echo -e >&2 "${CError:-}Error: bad option ${CData:-}$OPTARG.${CReset:-}"
- exit 1
- ;;
- esac
- done
- shift $((OPTIND-1))
-
- # Assign the remaining arguments back to args
- args=$@
-}
-
-# Parse command and arguments after a "cmd" token in config/scripts.*
-function command_from_config {
- local cmd=$1
- shift
-
- # Local variables that may be changed by get_cmd_options
- local vm_name=${NODE_NAME:-""}
- local vm_ui=${VM_UI:-""}
-
- local args=$@
- case "$cmd" in
- boot)
- # Format: boot [-g ] [-n ]
- # Boot with queued autostart files now, wait for end of scripts
- # processing
- get_cmd_options $args
- echo >&2 "VM_UI=$vm_ui _vm_boot_with_autostart $vm_name"
- VM_UI=$vm_ui _vm_boot_with_autostart "$vm_name"
- if [ -n "${PXE_TMP_NODE_IP:-""}" ]; then
- echo >&2 "Unsetting PXE_TMP_NODE_IP."
- unset PXE_TMP_NODE_IP
- fi
- ;;
- snapshot)
- # Format: snapshot [-n ]
- get_cmd_options $args
- local shot_name=$args
- echo >&2 vm_conditional_snapshot "$vm_name" "$shot_name"
- vm_conditional_snapshot "$vm_name" "$shot_name"
- ;;
- shutdown)
- # Format: shutdown [-n ]
- get_cmd_options $args
- echo >&2 "vm_acpi_shutdown $vm_name"
- vm_acpi_shutdown "$vm_name"
- echo >&2 vm_wait_for_shutdown "$vm_name"
- vm_wait_for_shutdown "$vm_name"
- conditional_sleep 1
- ;;
- wait_for_shutdown)
- # Format: wait_for_shutdown [-n ]
- get_cmd_options $args
- echo >&2 vm_wait_for_shutdown "$vm_name"
- vm_wait_for_shutdown "$vm_name"
- ;;
- snapshot_cycle)
- # Skip command if user disabled snapshot cycles
- if [ "${SNAP_CYCLE:-}" = "no" ]; then
- return
- fi
- # Format: snapshot_cycle [-g ] [-n ]
- # comprises shutdown, boot, wait_for_shutdown, snapshot
- get_cmd_options $args
- local shot_name=$args
- echo >&2 snapshot_cycle "$vm_name" "$shot_name"
- _autostart_queue "shutdown.sh"
- _vm_boot_with_autostart "$vm_name"
- if [ -n "${PXE_TMP_NODE_IP:-""}" ]; then
- echo >&2 "Unsetting PXE_TMP_NODE_IP."
- unset PXE_TMP_NODE_IP
- fi
- vm_wait_for_shutdown "$vm_name"
- vm_conditional_snapshot "$vm_name" "$shot_name"
- ;;
- boot_set_tmp_node_ip)
- # format: boot_set_tmp_node_ip
- get_cmd_options $args
- echo >&2 PXE_TMP_NODE_IP=$PXE_INITIAL_NODE_IP
- PXE_TMP_NODE_IP=$PXE_INITIAL_NODE_IP
- ;;
- create_node)
- # Format: create_node [-n ]
- get_cmd_options $args
- echo >&2 vm_create_node "$vm_name"
- vm_create_node "$vm_name"
- ;;
- create_pxe_node)
- # Format: create_pxe_node [-n ]
- get_cmd_options $args
- if [ "$PROVIDER" = "kvm" ]; then
- echo -e >&2 "${CError:-}PXE booting with KVM is currently" \
- "not supported.\nPlease file a bug if you need it." \
- "${CReset:-}"
- exit 1
- fi
- # Set FIRST_DISK_SIZE to disable use of basedisk for PXE booting
- FIRST_DISK_SIZE=10000
- echo >&2 "PXE boot node, set FIRST_DISK_SIZE=$FIRST_DISK_SIZE."
- echo >&2 vm_create_node "$vm_name"
- vm_create_node "$vm_name"
- ;;
- queue_renamed)
- # Queue a script for autostart, replacing xxx with vm_name
- # Format: queue [-n ]
- get_cmd_options $args
- local script_rel_path=$args
- local old_name=$(basename "$script_rel_path")
- # Replace xxx with vm_name
- local new_name=${old_name/xxx/$vm_name}
- echo >&2 _autostart_queue "$script_rel_path" "$new_name"
- _autostart_queue "$script_rel_path" "$new_name"
- ;;
- queue)
- # Queue a script for autostart
- # Format: queue
- local script_rel_path=$args
- echo >&2 _autostart_queue "$script_rel_path"
- _autostart_queue "$script_rel_path"
- ;;
- cp_iso)
- # Format: cp_iso [-n ]
- get_cmd_options $args
- local iso_name=$(get_iso_name)
- # Run this function in sub-shell to protect our caller's environment
- # (which might be _our_ environment if we get called again)
- (
- source "$CONFIG_DIR/config.$vm_name"
- ssh_env_for_node "$vm_name"
-
- local ssh_port
- if [ ${PROVIDER:-""} = virtualbox ]; then
- ssh_port=$VM_SSH_PORT
- else
- ssh_port=22
- fi
- echo >&2 "cp_iso $vm_name $args"
- vm_scp_to_vm "$ssh_port" "$ISO_DIR/$iso_name"
- )
- ;;
- *)
- echo -e >&2 "${CError:-}Error: invalid cmd: ${CData:-}$cmd${CReset:-}"
- exit 1
- ;;
- esac
-}
-
-# Parse config/scripts.* configuration files
-function autostart_from_config {
- local config_file=$1
- local config_path=$CONFIG_DIR/$config_file
-
- if [ ! -f "$config_path" ]; then
- echo -e >&2 "${CMissing:-}Config file not found: ${CData:-}$config_file${CReset:-}"
- return 1
- fi
-
- log_autostart_source "$config_file"
-
- # Open file on file descriptor 3 so programs we call in this loop (ssh)
- # are free to mess with the standard file descriptors.
- exec 3< "$config_path"
- while read -r field_1 field_2 <&3; do
- if [[ $field_1 =~ (^$|^#) ]]; then
- # Skip empty lines and lines that are commented out
- continue
- elif [ "$field_1" == "cmd" ]; then
- if [ -n "${JUMP_SNAPSHOT:-""}" ]; then
- if [[ $field_2 =~ ^snapshot.*${JUMP_SNAPSHOT} ]]; then
- echo >&2 "Skipped forward to snapshot $JUMP_SNAPSHOT."
- unset JUMP_SNAPSHOT
- fi
- else
- command_from_config $field_2
- fi
- else
- # Syntax error
- echo -e -n >&2 "${CError:-}ERROR in ${CInfo:-}$config_file: ${CData:-}'$field_1${CReset:-}"
- if [ -n "$field_2" ]; then
- echo >&2 " $field_2'"
- else
- echo >&2 "'"
- fi
- exit 1
- fi
- done
-}
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# Get node names from scripts config file
-function script_cfg_get_nodenames {
- local config_name=$(get_distro_name "$DISTRO")_cluster
- local scripts_cfg="$CONFIG_DIR/scripts.$config_name"
- local node
-
- node_names=""
-
- while read -r line; do
- if [[ $line =~ ^cmd\ .*\ -n\ ([^ ]*)\ .* ]]; then
- node=${BASH_REMATCH[1]}
- if ! [[ $node_names =~ $node ]]; then
- node_names="$node_names $node"
- fi
- fi
- done < "$scripts_cfg"
- echo $node_names
- echo >&2 $node_names
-}
-
-#-------------------------------------------------------------------------------
-# Functions to get install ISO images
-#-------------------------------------------------------------------------------
-
-function download {
- local url=$1
- local dest_dir=$2
- local dest_file=$3
- local rc=0
-
- if [ -n "${VM_PROXY:-""}" ]; then
- echo "Using VM_PROXY as http_proxy: $VM_PROXY"
- export http_proxy=$VM_PROXY
- fi
-
- local wget_exe=$(which wget)
- mkdir -pv "$dest_dir"
- if [ -n "$wget_exe" ]; then
- $wget_exe --output-document "$dest_dir/$dest_file" "$url"||rc=$?
- else
- # Mac OS X has curl instead of wget
- local curl_exe=$(which curl)
- if [ -n "$curl_exe" ]; then
- $curl_exe "$url" -o "$dest_dir/$dest_file"||rc=$?
- fi
- fi
- if [ $rc -ne 0 ]; then
- echo -e >&2 "${CError:-}Unable to download ${CData:-}$url${CError:-}.${CReset:-}"
- return 1
- fi
-}
-
-function get_iso_name {
- basename "${ISO_URL:-}"
-}
-
-# If ISO image is missing from IMG_DIR, try downloading it.
-function download_iso_if_necessary {
- local iso_name=$(get_iso_name)
- if [ ! -f "$ISO_DIR/$iso_name" ]; then
- echo >&2 "$iso_name not in $ISO_DIR; downloading."
- if ! download "$ISO_URL" "$ISO_DIR" "$iso_name"; then
- echo -e >&2 "${CError:-}Download failed.${CReset:-}"
- # Remove empty file
- rm "$ISO_DIR/$iso_name"
- return 1
- fi
- else
- echo >&2 "$iso_name already in $ISO_DIR."
- fi
-}
-
-# Get ISO image for installation. If the download fails, get an alternative URL
-# and try again.
-function find_install-iso {
- if ! download_iso_if_necessary; then
- # No local ISO file and download failed
- echo -e >&2 "${CStatus:-}Trying to find alternative.${CReset:-}"
- update_iso_variables
-
- if ! download_iso_if_necessary; then
- echo -e >&2 "${CError:-}Exiting.${CReset:-}"
- exit 1
- fi
- fi
-}
-
-function check_md5 {
- local file=$1
- local csum=$2
- local md5exe
- if [ ! -f "$file" ]; then
- echo -e >&2 "${CError:-}File $file not found. Aborting.${CReset:-}"
- exit 1
- fi
- if ! md5exe=$(which md5sum); then
- # On Mac OS X, the tool is called md5
- if ! md5exe=$(which md5); then
- echo -e >&2 "${CError:-}Neither md5sum nor md5 executable found." \
- " Aborting.${CReset:-}"
- exit 1
- fi
- fi
- echo -e >&2 -n "${CStatus:-}Verifying MD5 checksum: ${CReset:-}"
- if $md5exe "$file" | grep -q "$csum"; then
- echo >&2 "okay."
- else
- echo -e >&2 "${CError:-}Verification failed. File corrupt:${CReset:-}"
- echo >&2 "$file"
- echo -e >&2 "${CError:-}Please remove file and re-run osbash script.${CReset:-}"
- exit 1
- fi
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/kvm-functions.sh b/labs/osbash/lib/osbash/kvm-functions.sh
deleted file mode 100644
index e6a8e67b..00000000
--- a/labs/osbash/lib/osbash/kvm-functions.sh
+++ /dev/null
@@ -1,454 +0,0 @@
-source "$CONFIG_DIR/provider.$PROVIDER"
-
-#-------------------------------------------------------------------------------
-# virt-install / virsh
-#-------------------------------------------------------------------------------
-
-VIRSH=virsh
-VIRT_INSTALL=virt_install
-
-: ${VIRT_LOG:=$LOG_DIR/virt.log}
-
-function virsh {
- mkdir -p "$(dirname "$VIRT_LOG")"
-
- echo "$VIRSH_CALL" "$@" >> "$VIRT_LOG"
- local rc=0
- $VIRSH_CALL "$@" || rc=$?
- if [ $rc -ne 0 ]; then
- echo -e >&2 "${CError:-}FAILURE ($rc): virsh: ${*}${CReset:-}"
- echo "FAILURE ($rc): $VIRSH_CALL $@" >> "$VIRT_LOG"
- return 1
- fi
-}
-
-function virt_install {
- mkdir -p "$(dirname "$VIRT_LOG")"
-
- echo "$VIRT_INSTALL_CALL" "$@" >> "$VIRT_LOG"
- local rc=0
- $VIRT_INSTALL_CALL "$@" || rc=$?
- if [ $rc -ne 0 ]; then
- echo -e >&2 "${CError:-}FAILURE ($rc): $VIRT_INSTALL_CALL ${*}${CReset:-}"
- echo "FAILURE ($rc): $VIRT_INSTALL_CALL $@" >> "$VIRT_LOG"
- return 1
- fi
-}
-
-function virsh_uses_kvm {
- $VIRSH capabilities | grep -q kvm
-}
-
-#-------------------------------------------------------------------------------
-# VM status
-#-------------------------------------------------------------------------------
-
-function set_vm_group {
- local vm_name=$1
-
- $VIRSH desc "$vm_name" --config --live --title \
- --new-desc "$vm_name: $VM_GROUP"
- $VIRSH desc "$vm_name" --config --live --new-desc "All VMs with" \
- "'$VM_GROUP' in their description title get shut down when a new" \
- "cluster build starts."
-}
-
-function get_vm_group {
- local vm_name=$1
-
- $VIRSH desc "$vm_name" --title
-}
-
-function vm_exists {
- local vm_name=$1
-
- return $($VIRSH domstate "$vm_name" >/dev/null 2>&1)
-}
-
-function vm_is_running {
- local vm_name=$1
-
- return $($VIRSH domstate "$vm_name" 2>/dev/null | grep -q running)
-}
-
-function vm_wait_for_shutdown {
- local vm_name=$1
-
- echo -e >&2 -n "${CStatus:-}Machine shutting down${CReset:-}"
- while $VIRSH domstate "$vm_name" | grep -q -e running -e "in shutdown"; do
- echo -n .
- sleep 1
- done
- echo >&2 -e "${CStatus:-}\nMachine powered off.${CReset:-}"
-}
-
-function vm_power_off {
- local vm_name=$1
- if vm_is_running "$vm_name"; then
- echo -e >&2 "${CStatus:-}Powering off VM ${CData:-}\"$vm_name\"${CReset:-}"
- $VIRSH destroy "$vm_name"
- fi
-}
-
-function vm_acpi_shutdown {
- local vm_name=$1
- if vm_is_running "$vm_name"; then
- echo -e >&2 "${CStatus:-}ACPI shutdown for VM ${CData:-}\"$vm_name\"${CReset:-}"
- $VIRSH shutdown "$vm_name"
- fi
-}
-
-function stop_running_cluster_vms {
- local vm_id
-
- $VIRSH list --uuid | while read vm_id; do
- if [ -z "$vm_id" ]; then
- continue
- elif [[ "$(get_vm_group "$vm_id")" =~ $VM_GROUP ]]; then
- # vm_id instead of vm_name works just as well
- vm_acpi_shutdown "$vm_id"
- vm_wait_for_shutdown "$vm_id"
- fi
- done
-}
-
-#-------------------------------------------------------------------------------
-# Snapshots
-#-------------------------------------------------------------------------------
-
-function vm_snapshot_list_tree {
- local vm_name=$1
-
- $VIRSH snapshot-list --tree "$vm_name"
-}
-
-function vm_snapshot_list {
- local vm_name=$1
-
- $VIRSH snapshot-list "$vm_name"
-}
-
-function vm_snapshot_exists {
- local vm_name=$1
- local shot_name=$2
-
- vm_snapshot_list "$vm_name" | grep -q "^ $shot_name "
-}
-
-function vm_snapshot {
- local vm_name=$1
- local shot_name=$2
-
- $VIRSH snapshot-create-as "$vm_name" "$shot_name" "$vm_name: $shot_name"
-}
-
-function vm_snapshot_restore {
- local vm_name=$1
- local shot_name=$2
-
- $VIRSH snapshot-revert "$vm_name" "$shot_name"
-}
-
-function vm_snapshot_restore_current {
- local vm_name=$1
-
- $VIRSH snapshot-revert "$vm_name" --current
-}
-
-#-------------------------------------------------------------------------------
-# Network functions
-#-------------------------------------------------------------------------------
-
-# Get the MAC address from a node name (default network)
-function node_to_mac {
- local node=$1
- local rc=""
- local mac=""
-
- echo >&2 "Waiting for MAC address."
- while : ; do
- mac=$($VIRSH dumpxml "$node"|grep -Po '[a-z0-9:]{17}'|head -n1) || rc=$?
- if [ -n "$mac" ]; then
- echo "$mac"
- echo >&2
- break
- fi
- sleep 1
- echo >&2 -n .
- done
-}
-
-# Get the IP address from a MAC address (default network)
-function mac_to_ip {
- local mac=$1
- local rc=""
- local ip=""
-
- echo >&2 "Waiting for IP address."
- while : ; do
- ip=$(sudo arp -n|grep "$mac"|awk '{print $1}') || rc=$?
- if [ -n "$ip" ]; then
- echo >&2
- echo "$ip"
- break
- fi
- sleep 1
- echo >&2 -n .
- done
-}
-
-NODE_IP_DB=$LOG_DIR/node_ip.db
-
-function node_to_ip {
- local node=$1
-
- local mac=$(node_to_mac "$node")
- echo -e >&2 "${CInfo:-}MAC address for $node: ${CData:-}$mac${CReset:-}"
-
- local ip=$(mac_to_ip "$mac")
- echo -e >&2 "${CInfo:-}IP address for $node: ${CData:-}$ip${CReset:-}"
-
- # Store node name, IP address, and MAC address in text file for later use
- echo "$mac $ip $node" >> "$NODE_IP_DB"
-
- # Return IP address to caller
- echo "$ip"
-}
-
-# Get ssh IP address and port from node name (non-default networks)
-function ssh_env_for_node {
- local node=$1
-
- # No port forwarding with KVM; ignore VM_SSH_PORT from config.
- VM_SSH_PORT=22
-
- if [ -f "$NODE_IP_DB" ]; then
- if grep "$node" "$NODE_IP_DB"; then
- SSH_IP=$(grep " $node$" "$NODE_IP_DB"|awk '{print $2}')
- return 0
- else
- echo >&2 "Node $node not found in $NODE_IP_DB."
- fi
- else
- echo >&2 "$NODE_IP_DB missing."
- fi
- echo >&2 "Getting IP address through arp."
- SSH_IP=$(node_to_ip "$node")
-}
-
-function virsh_define_network {
- local net=labs-$1
- local if_ip=$2
-
- echo >&2 "Defining network $net ($if_ip)."
- if ! $VIRSH net-info "$net" >/dev/null 2>&1; then
- local cfg=$LOG_DIR/kvm-net-$net.xml
-
- # FIXME Limit port forwarding to networks that need it.
- cat << NETCFG > "$cfg"
-
- $net
-
-
-
-
-NETCFG
-
- $VIRSH net-define "$cfg"
- fi
-}
-
-function virsh_start_network {
- local net=labs-$1
-
- if $VIRSH net-info "$net" 2>/dev/null|grep -q "Active:.*no"; then
- echo >&2 "Starting network $net."
- $VIRSH net-start "$net"
- fi
-
- # Save, update, and restore iptables configuration made by libvirt
- sudo iptables-save > "$LOG_DIR/iptables"
- # Forward new connections, too (except on virbr0); this allows our
- # NAT networks to talk to each other
- sed -i -e '/FORWARD.*virbr[^0]/ s/ RELATED/ NEW,RELATED/' "$LOG_DIR/iptables"
- sudo iptables-restore "$LOG_DIR/iptables"
-}
-
-function virsh_stop_network {
- local net=labs-$1
-
- # Undo our changes to iptables before letting libvirt deal with it
- sudo iptables-save > "$LOG_DIR/iptables"
- sed -i -e '/FORWARD.*virbr/ s/ NEW,RELATED/ RELATED/' "$LOG_DIR/iptables"
- sudo iptables-restore "$LOG_DIR/iptables"
-
- if $VIRSH net-info "$net" 2>/dev/null|grep -q "Active:.*yes"; then
- echo >&2 "Stopping network $net."
- $VIRSH net-destroy "$net"
- fi
-}
-
-function virsh_undefine_network {
- local net=labs-$1
-
- if $VIRSH net-info "$net" >/dev/null 2>&1; then
- echo >&2 "Undefining network $net."
- $VIRSH net-undefine "$net"
- fi
-}
-
-function vm_nic_base {
- KVM_NET_OPTIONS="${KVM_NET_OPTIONS:-} --network bridge=virbr0"
-}
-
-function vm_nic_std {
- local vm_name=$1
- local index=$2
- local netname=labs-$(ip_to_netname "${NODE_IF_IP[index]}")
-
- KVM_NET_OPTIONS="${KVM_NET_OPTIONS:-} --network network=$netname"
-}
-
-function vm_nic_set_boot_prio {
- : Not implemented
-}
-
-function create_network {
- local index=$1
- local net_name=${NET_NAME[index]}
- local if_ip=${NET_GW[index]}
-
- virsh_stop_network "$net_name"
-
- virsh_undefine_network "$net_name"
-
- virsh_define_network "$net_name" "$if_ip"
-
- virsh_start_network "$net_name"
-}
-
-#-------------------------------------------------------------------------------
-# Disk functions
-#-------------------------------------------------------------------------------
-
-function disk_exists {
- local disk=$1
-
- return $($VIRSH vol-info --pool "$KVM_VOL_POOL" "$disk" >/dev/null 2>&1)
-}
-
-function base_disk_exists {
- disk_exists "$(get_base_disk_name)"
-}
-
-function disk_create {
- local disk=$1
- # Size in MB
- local size=$2
-
- if ! disk_exists "$disk"; then
- $VIRSH vol-create-as "$KVM_VOL_POOL" "$disk" "${size}M" --format qcow2
- fi
-}
-
-function disk_delete {
- local disk=$1
-
- if disk_exists "$disk"; then
- $VIRSH vol-delete --pool "$KVM_VOL_POOL" "$disk"
- fi
-}
-
-function base_disk_delete {
- disk_delete "$(get_base_disk_name)"
-}
-
-# Use virt-sparsify to compress disk image and make it sparse
-function disk_compress {
- local disk_name=$1
- local disk_path=$($VIRSH vol-path --pool "$KVM_VOL_POOL" "$disk_name")
- local pool_dir=$(dirname "$disk_path")
-
- local spexe
- if ! spexe=$(which virt-sparsify); then
- echo -e >&2 "${CError:-}No virt-sparsify executable found." \
- "Consider installing libguestfs-tools.${CReset:-}"
- return 0
- fi
-
- echo -e >&2 "${CStatus:-}Compressing disk image, input file:${CReset:-}"
- sudo file "$disk_path"
- sudo ls -lh "$disk_path"
- sudo du -sh "$disk_path"
-
- # virt-sparsify uses about 10 GB additional, temporary work space.
- # The default (/tmp) is often too small (especially if it is a RAM
- # disk). We use the pool_dir instead.
- sudo "$spexe" --tmp "$pool_dir" --compress "$disk_path" \
- "$pool_dir/.$disk_name"
-
- # Copy owner and file modes from original file
- sudo chown -v --reference="$disk_path" "$pool_dir/.$disk_name"
- sudo chmod -v --reference="$disk_path" "$pool_dir/.$disk_name"
-
- # Replace original with compressed file
- sudo mv -vf "$pool_dir/.$disk_name" "$disk_path"
-
- echo -e >&2 "${CStatus:-}Output file:${CReset:-}"
- sudo file "$disk_path"
- sudo ls -lh "$disk_path"
- sudo du -sh "$disk_path"
-}
-
-#-------------------------------------------------------------------------------
-# VM unregister, remove, delete
-#-------------------------------------------------------------------------------
-
-function vm_delete {
- local vm_name=$1
-
- echo >&2 -n "Asked to delete VM \"$vm_name\" "
-
- if vm_exists "$vm_name"; then
- echo >&2 "(found)"
- vm_power_off "$vm_name"
- # Take a break before undefining the VM
- sleep 1
- $VIRSH undefine --snapshots-metadata --remove-all-storage "$vm_name"
- else
- echo >&2 "(not found)"
- fi
-
- if disk_exists "$vm_name"; then
- echo >&2 -e "${CInfo:-}Disk exists: ${CData:-}$vm_name${CReset:-}"
- echo >&2 -e "Deleting disk $vm_name."
- disk_delete "$vm_name"
- fi
-}
-
-#-------------------------------------------------------------------------------
-# Booting a VM and passing boot parameters
-#-------------------------------------------------------------------------------
-
-source "$OSBASH_LIB_DIR/kvm-keycodes.sh"
-
-function _keyboard_push_scancode {
- local vm_name=$1
- shift
- # Split string (e.g. '01 81') into arguments (works also if we
- # get each hexbyte as a separate argument)
- # Not quoting $@ is intentional -- we want to split on blanks
- local scan_code=( $@ )
- $VIRSH send-key "$vm_name" --codeset linux "${scan_code[@]}" >/dev/null
-}
-
-function vm_boot {
- local vm_name=$1
-
- echo -e >&2 "${CStatus:-}Starting VM ${CData:-}\"$vm_name\"${CReset:-}"
- $VIRSH start "$vm_name"
-}
-
-#-------------------------------------------------------------------------------
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/kvm-install_base.sh b/labs/osbash/lib/osbash/kvm-install_base.sh
deleted file mode 100644
index 1cb59b4c..00000000
--- a/labs/osbash/lib/osbash/kvm-install_base.sh
+++ /dev/null
@@ -1,115 +0,0 @@
-# This bash library contains the main function that creates the base disk.
-
-function vm_install_base {
- local base_disk_name=$(get_base_disk_name)
- local vm_name=base
-
- echo >&2 "$(date) osbash vm_install starts."
-
- if virsh_uses_kvm; then
- echo -e "${CInfo:-}KVM support is available.${CReset:-}"
- else
- echo -e "${CError:-}No KVM support available. Using qemu.${CReset:-}"
- fi
-
- vm_delete "$vm_name"
-
- if [ -z "${INSTALL_ISO-}" ]; then
-
- if [ -z "$ISO_URL" ]; then
- echo -e >&2 "${CMissing:-}Either ISO URL or name needed (ISO_URL, INSTALL_ISO).${CReset:-}"
- exit 1
- fi
-
- find_install-iso
-
- INSTALL_ISO=$ISO_DIR/$(get_iso_name)
- fi
-
- echo >&2 -e "${CInfo:-}Install ISO:\n\t${CData:-}$INSTALL_ISO${CReset:-}"
-
- check_md5 "$INSTALL_ISO" "$ISO_MD5"
-
- # Configure autostart
- autostart_reset
-
- autostart osbash/base_fixups.sh
-
- # By default, set by lib/osbash/lib.* to something like scripts.ubuntu_base
- autostart_from_config "$BASE_INSTALL_SCRIPTS"
-
- autostart zero_empty.sh shutdown.sh
-
- disk_create "$base_disk_name" "${BASE_DISK_SIZE:=10000}"
-
- local console_type
- if [ "$VM_UI" = "headless" ]; then
- console_type="--noautoconsole"
- elif [ "$VM_UI" = "vnc" ]; then
- console_type="--graphics vnc,listen=0.0.0.0"
- else
- # gui option: should open a console viewer
- console_type=""
- fi
-
- # Boot VM into distribution installer
- (
- source "$CONFIG_DIR/config.$vm_name"
- $VIRT_INSTALL \
- --disk "vol=$KVM_VOL_POOL/$base_disk_name,cache=none" \
- --cdrom "$INSTALL_ISO" \
- --name $vm_name \
- --os-type linux \
- --ram "${VM_MEM}" \
- --vcpus 1 \
- --virt-type kvm \
- $console_type \
- --wait=-1 \
- &
- )
-
- local delay=10
- echo >&2 "Waiting $delay seconds for VM \"$vm_name\" to come up."
- conditional_sleep "$delay"
-
- distro_start_installer "$vm_name"
-
- echo -e >&2 "${CStatus:-}Installing operating system; waiting for reboot.${CReset:-}"
-
- # Prevent "time stamp from the future" due to race between two sudos in
- # VIRT_INSTALL (background) above and VIRSH below
- sleep 1
-
- echo >&2 "Waiting for VM to be defined."
- until vm_is_running "$vm_name"; do
- sleep 1
- echo -n .
- done
-
- SSH_IP=$(node_to_ip "$vm_name")
-
- echo >&2 "Waiting for ping returning from $SSH_IP."
- while ! ping -c1 "$SSH_IP" > /dev/null; do
- echo -n .
- sleep 1
- done
-
- # Wait for ssh connection and execute scripts in autostart directory
- ssh_process_autostart "$vm_name" &
- # After reboot
- wait_for_autofiles
- echo -e >&2 "${CStatus:-}Installation done for VM ${CData:-}$vm_name${CReset:-}"
-
- vm_wait_for_shutdown "$vm_name"
-
- disk_compress "$base_disk_name"
-
- # Just undefine the VM without deleting the base disk
- $VIRSH undefine "$vm_name"
-
- echo -e >&2 "${CStatus:-}Base disk created${CReset:-}"
-
- echo >&2 -e "${CData:-}$(date) ${CStatus:-}osbash vm_install ends\n${CReset:-}"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/kvm-install_nodes.sh b/labs/osbash/lib/osbash/kvm-install_nodes.sh
deleted file mode 100644
index a2aa3080..00000000
--- a/labs/osbash/lib/osbash/kvm-install_nodes.sh
+++ /dev/null
@@ -1,111 +0,0 @@
-# This bash library contains the main function that creates a node VM.
-
-# Boot node VM; wait until autostart files are processed
-function _vm_boot_with_autostart {
- local vm_name=$1
-
- if $VIRSH domstate "$vm_name" | grep -q "shut off"; then
- vm_boot "$vm_name"
- else
- echo >&2 "VM is already running."
- $VIRSH domstate "$vm_name"
- fi
-
- # Wait for ssh connection and execute scripts in autostart directory
- ssh_process_autostart "$vm_name" &
-
- wait_for_autofiles
- echo >&2 "VM \"$vm_name\": autostart files executed"
-}
-
-# Create a new node VM
-function vm_create_node {
- # XXX Run this function in sub-shell to protect our caller's environment
- # (which might be _our_ environment if we get called again)
- local vm_name=$1
-
- (
- source "$CONFIG_DIR/config.$vm_name"
-
- local base_disk_name=$(get_base_disk_name)
-
- configure_node_netifs "$vm_name"
-
- vm_delete "$vm_name"
-
- echo -e "${CStatus:-}Creating copy-on-write VM disk.${CReset:-}"
- $VIRSH vol-create-as "$KVM_VOL_POOL" "$vm_name" \
- "${BASE_DISK_SIZE:=10000}M" \
- --format qcow2 \
- --backing-vol "$base_disk_name" \
- --backing-vol-format qcow2
-
- if [ "${SECOND_DISK_SIZE:-0}" -gt 0 ]; then
- disk_create "$vm_name-sdb" "$SECOND_DISK_SIZE"
- local disks="--disk vol=$KVM_VOL_POOL/${vm_name}-sdb,cache=none"
- echo >&2 "Adding second disk: $disks:"
- fi
-
- local console_type
- if [ "$VM_UI" = "headless" ]; then
- console_type="--noautoconsole"
- elif [ "$VM_UI" = "vnc" ]; then
- console_type="--graphics vnc,listen=0.0.0.0"
- else
- # gui option: should open a console viewer
- console_type=""
- fi
-
- $VIRT_INSTALL \
- --name "$vm_name" \
- --ram "${VM_MEM:-512}" \
- --vcpus "${VM_CPUS:-1}" \
- --os-type=linux \
- --disk vol="$KVM_VOL_POOL/${vm_name},cache=none" \
- ${disks:-} \
- ${KVM_NET_OPTIONS:-""} \
- --import \
- $console_type \
- &
- )
-
- # Prevent "time stamp from the future" due to race between two sudos in
- # VIRT_INSTALL (background) above and VIRSH below
- sleep 1
-
- echo >&2 "Waiting for VM to come up."
- until vm_is_running "$vm_name"; do
- sleep 1
- echo -n .
- done
-
- # Set VM group in description so we know which VMs are ours.
- set_vm_group "$vm_name"
-
- SSH_IP=$(node_to_ip "$vm_name")
-
- echo >&2 "Waiting for ping returning from $SSH_IP."
- while ! ping -c1 "$SSH_IP" > /dev/null; do
- echo -n .
- sleep 1
- done
-}
-
-function vm_build_nodes {
-
- if virsh_uses_kvm; then
- echo -e "${CInfo:-}KVM support is available.${CReset:-}"
- else
- echo -e "${CError:-}No KVM support available. Using qemu.${CReset:-}"
- fi
-
- CONFIG_NAME=$(get_distro_name "$DISTRO")_$1
- echo -e "${CInfo:-}Configuration file: ${CData:-}$CONFIG_NAME${CReset:-}"
-
- #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- autostart_reset
- autostart_from_config "scripts.$CONFIG_NAME"
- #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/kvm-keycodes.sh b/labs/osbash/lib/osbash/kvm-keycodes.sh
deleted file mode 100644
index ed929bea..00000000
--- a/labs/osbash/lib/osbash/kvm-keycodes.sh
+++ /dev/null
@@ -1,310 +0,0 @@
-# The functions in this library are used to get scancode strings for virsh
-# keyboard input (send-key).
-#
-# It is based on:
-# http://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=src/util/keymaps.csv
-#
-# The library works with bash 3.2 (shipped with Mac OS X as of 2014).
-
-function char2scancode {
- local key=$1
- case "$key" in
- 'a')
- echo -n " KEY_A"
- ;;
- 'b')
- echo -n " KEY_B"
- ;;
- 'c')
- echo -n " KEY_C"
- ;;
- 'd')
- echo -n " KEY_D"
- ;;
- 'e')
- echo -n " KEY_E"
- ;;
- 'f')
- echo -n " KEY_F"
- ;;
- 'g')
- echo -n " KEY_G"
- ;;
- 'h')
- echo -n " KEY_H"
- ;;
- 'i')
- echo -n " KEY_I"
- ;;
- 'j')
- echo -n " KEY_J"
- ;;
- 'k')
- echo -n " KEY_K"
- ;;
- 'l')
- echo -n " KEY_L"
- ;;
- 'm')
- echo -n " KEY_M"
- ;;
- 'n')
- echo -n " KEY_N"
- ;;
- 'o')
- echo -n " KEY_O"
- ;;
- 'p')
- echo -n " KEY_P"
- ;;
- 'q')
- echo -n " KEY_Q"
- ;;
- 'r')
- echo -n " KEY_R"
- ;;
- 's')
- echo -n " KEY_S"
- ;;
- 't')
- echo -n " KEY_T"
- ;;
- 'u')
- echo -n " KEY_U"
- ;;
- 'v')
- echo -n " KEY_V"
- ;;
- 'w')
- echo -n " KEY_W"
- ;;
- 'x')
- echo -n " KEY_X"
- ;;
- 'y')
- echo -n " KEY_Y"
- ;;
- 'z')
- echo -n " KEY_Z"
- ;;
- 'A')
- echo -n " KEY_LEFTSHIFT KEY_A"
- ;;
- 'B')
- echo -n " KEY_LEFTSHIFT KEY_B"
- ;;
- 'C')
- echo -n " KEY_LEFTSHIFT KEY_C"
- ;;
- 'D')
- echo -n " KEY_LEFTSHIFT KEY_D"
- ;;
- 'E')
- echo -n " KEY_LEFTSHIFT KEY_E"
- ;;
- 'F')
- echo -n " KEY_LEFTSHIFT KEY_F"
- ;;
- 'G')
- echo -n " KEY_LEFTSHIFT KEY_G"
- ;;
- 'H')
- echo -n " KEY_LEFTSHIFT KEY_H"
- ;;
- 'I')
- echo -n " KEY_LEFTSHIFT KEY_I"
- ;;
- 'J')
- echo -n " KEY_LEFTSHIFT KEY_J"
- ;;
- 'K')
- echo -n " KEY_LEFTSHIFT KEY_K"
- ;;
- 'L')
- echo -n " KEY_LEFTSHIFT KEY_L"
- ;;
- 'M')
- echo -n " KEY_LEFTSHIFT KEY_M"
- ;;
- 'N')
- echo -n " KEY_LEFTSHIFT KEY_N"
- ;;
- 'O')
- echo -n " KEY_LEFTSHIFT KEY_O"
- ;;
- 'P')
- echo -n " KEY_LEFTSHIFT KEY_P"
- ;;
- 'Q')
- echo -n " KEY_LEFTSHIFT KEY_Q"
- ;;
- 'R')
- echo -n " KEY_LEFTSHIFT KEY_R"
- ;;
- 'S')
- echo -n " KEY_LEFTSHIFT KEY_S"
- ;;
- 'T')
- echo -n " KEY_LEFTSHIFT KEY_T"
- ;;
- 'U')
- echo -n " KEY_LEFTSHIFT KEY_U"
- ;;
- 'V')
- echo -n " KEY_LEFTSHIFT KEY_V"
- ;;
- 'W')
- echo -n " KEY_LEFTSHIFT KEY_W"
- ;;
- 'X')
- echo -n " KEY_LEFTSHIFT KEY_X"
- ;;
- 'Y')
- echo -n " KEY_LEFTSHIFT KEY_Y"
- ;;
- 'Z')
- echo -n " KEY_LEFTSHIFT KEY_Z"
- ;;
- '1')
- echo -n " KEY_1"
- ;;
- '2')
- echo -n " KEY_2"
- ;;
- '3')
- echo -n " KEY_3"
- ;;
- '4')
- echo -n " KEY_4"
- ;;
- '5')
- echo -n " KEY_5"
- ;;
- '6')
- echo -n " KEY_6"
- ;;
- '7')
- echo -n " KEY_7"
- ;;
- '8')
- echo -n " KEY_8"
- ;;
- '9')
- echo -n " KEY_9"
- ;;
- '0')
- echo -n " KEY_0"
- ;;
- '!')
- echo -n " KEY_LEFTSHIFT KEY_1"
- ;;
- '@')
- echo -n " KEY_LEFTSHIFT KEY_2"
- ;;
- '#')
- echo -n " KEY_LEFTSHIFT KEY_3"
- ;;
- '$')
- echo -n " KEY_LEFTSHIFT KEY_4"
- ;;
- '%')
- echo -n " KEY_LEFTSHIFT KEY_5"
- ;;
- '^')
- echo -n " KEY_LEFTSHIFT KEY_6"
- ;;
- '&')
- echo -n " KEY_LEFTSHIFT KEY_7"
- ;;
- '*')
- echo -n " KEY_LEFTSHIFT KEY_8"
- ;;
- '(')
- echo -n " KEY_LEFTSHIFT KEY_9"
- ;;
- ')')
- echo -n " KEY_LEFTSHIFT KEY_0"
- ;;
- '-')
- echo -n " KEY_MINUS"
- ;;
- '_')
- echo -n " KEY_LEFTSHIFT KEY_MINUS"
- ;;
- '=')
- echo -n " KEY_EQUAL"
- ;;
- '+')
- echo -n " KEY_LEFTSHIFT KEY_EQUAL"
- ;;
- ' ')
- echo -n " KEY_SPACE"
- ;;
- '[')
- echo -n " KEY_LEFTBRACE"
- ;;
- ']')
- echo -n " KEY_RIGHTBRACE"
- ;;
- '{')
- echo -n " KEY_LEFTSHIFT KEY_LEFTBRACE"
- ;;
- '}')
- echo -n " KEY_LEFTSHIFT KEY_RIGHTBRACE"
- ;;
- ';')
- echo -n " KEY_SEMICOLON"
- ;;
- ':')
- echo -n " KEY_LEFTSHIFT KEY_SEMICOLON"
- ;;
- ',')
- echo -n " KEY_COMMA"
- ;;
- '.')
- echo -n " KEY_DOT"
- ;;
- '/')
- echo -n " KEY_SLASH"
- ;;
- '\')
- echo -n " KEY_BACKSLASH"
- ;;
- '|')
- echo -n " KEY_LEFTSHIFT KEY_BACKSLASH"
- ;;
- '?')
- echo -n " KEY_LEFTSHIFT KEY_SLASH"
- ;;
- '"')
- echo -n " KEY_LEFTSHIFT KEY_APOSTROPHE"
- ;;
- "'")
- echo -n " KEY_APOSTROPHE"
- ;;
- ">")
- echo -n " KEY_LEFTSHIFT KEY_DOT"
- ;;
- "<")
- echo -n " KEY_LEFTSHIFT KEY_COMMA"
- ;;
- esac
-}
-
-function esc2scancode {
- echo -n " KEY_ESC"
-}
-
-function enter2scancode {
- echo -n " KEY_ENTER"
-}
-
-function backspace2scancode {
- echo -n " KEY_BACKSPACE"
-}
-
-function f6_2scancode {
- echo -n " KEY_F6"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/lib-color.sh b/labs/osbash/lib/osbash/lib-color.sh
deleted file mode 100644
index 60db4d87..00000000
--- a/labs/osbash/lib/osbash/lib-color.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-# Colors and decorations
-
-function colorizer {
-
- # Text Reset
- local Reset_Color='\x1b[0m'
-
- # Regular
- local Black='\x1b[0;30m'
- local Red='\x1b[0;31m'
- local Green='\x1b[0;32m'
- local Yellow='\x1b[0;33m'
- local Blue='\x1b[0;34m'
- local Purple='\x1b[0;35m'
- local Cyan='\x1b[0;36m'
- local White='\x1b[0;37m'
-
- # Bold
- local Bold_Black='\x1b[1;30m'
- local Bold_Red='\x1b[1;31m'
- local Bold_Green='\x1b[1;32m'
- local Bold_Yellow='\x1b[1;33m'
- local Bold_Blue='\x1b[1;34m'
- local Bold_Purple='\x1b[1;35m'
- local Bold_Cyan='\x1b[1;36m'
- local Bold_White='\x1b[1;37m'
-
- # Underline
- local Underline_Black='\x1b[4;30m'
- local Underline_Red='\x1b[4;31m'
- local Underline_Green='\x1b[4;32m'
- local Underline_Yellow='\x1b[4;33m'
- local Underline_Blue='\x1b[4;34m'
- local Underline_Purple='\x1b[1;35m'
- local Underline_Cyan='\x1b[4;36m'
- local Underline_White='\x1b[4;37m'
-
- # Background
- local On_Black='\x1b[40m'
- local On_Blue='\x1b[44m'
- local On_White='\x1b[47m'
-
- # Color codes
- export CError=$Red
- export CStatus=$Bold_Purple
- export CInfo=$Bold_Yellow
- export CProcess=$Bold_Blue
- export CData=$Bold_Cyan
- export CMissing=$Bold_Red
- export CReset=$Reset_Color
-}
-colorizer
-unset colorizer
diff --git a/labs/osbash/lib/osbash/lib.centos-7-x86_64.sh b/labs/osbash/lib/osbash/lib.centos-7-x86_64.sh
deleted file mode 100644
index 6ca5026c..00000000
--- a/labs/osbash/lib/osbash/lib.centos-7-x86_64.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-# CentOS 7 x86_64
-
-# Default scripts for all Fedora base disks
-: ${BASE_INSTALL_SCRIPTS:=scripts.centos_base}
-
-#-------------------------------------------------------------------------------
-# Booting the operating system installer
-#-------------------------------------------------------------------------------
-
-readonly ISO_URL=https://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-DVD-1511.iso
-readonly ISO_MD5=c875b0f1dabda14f00a3e261d241f63e
-
-readonly _KS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/ks-ssh-v2.cfg
-readonly _KS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/ks-vbadd.cfg
-readonly _KS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/ks-all-v2.cfg
-
-readonly _BOOT_ARGS="linux ks=%s"
-
-# ostype used by VirtualBox to choose icon and flags (64-bit, IOAPIC)
-VBOX_OSTYPE=RedHat_64
-
-function distro_start_installer {
- local vm_name=$1
-
- # pick a _KS_* file
- local kickstart=_KS_$VM_ACCESS
-
- echo "Using $kickstart ${!kickstart}"
-
- local boot_args=$(printf "$_BOOT_ARGS" "${!kickstart}")
-
- keyboard_send_escape "$vm_name"
-
- conditional_sleep 1
-
- echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
- keyboard_send_string "$vm_name" "$boot_args"
-
- echo "Initiating boot sequence"
- keyboard_send_enter "$vm_name"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/lib.ubuntu-12.04.4-server-amd64.sh b/labs/osbash/lib/osbash/lib.ubuntu-12.04.4-server-amd64.sh
deleted file mode 100644
index 5610c9f4..00000000
--- a/labs/osbash/lib/osbash/lib.ubuntu-12.04.4-server-amd64.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-# Ubuntu 12.04.4 LTS amd64 server
-
-# Default scripts for all Ubuntu installs
-: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
-
-#-------------------------------------------------------------------------------
-# Booting the operating system installer
-#-------------------------------------------------------------------------------
-
-readonly ISO_URL=http://releases.ubuntu.com/12.04/ubuntu-12.04.4-server-amd64.iso
-
-# Note: Ubuntu 12.04 LTS cannot pull a preseed file over HTTPS
-readonly _PS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-ssh-v2.cfg
-readonly _PS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-vbadd.cfg
-readonly _PS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-all-v2.cfg
-
-readonly _BOOT_ARGS="/install/vmlinuz
- noapic
- preseed/url=%s
- debian-installer=en_US
- auto=true
- locale=en_US
- hostname=osbash
- fb=false
- debconf/frontend=noninteractive
- keyboard-configuration/modelcode=SKIP
- initrd=/install/initrd.gz
- console-setup/ask_detect=false"
-
-# ostype used by VirtualBox to choose icon and flags (64-bit, IOAPIC)
-VBOX_OSTYPE=Ubuntu_64
-
-function distro_start_installer {
- local vm_name=$1
-
- # pick a _PS_* file
- local preseed=_PS_$VM_ACCESS
-
- echo "Using $preseed ${!preseed}"
-
- local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
-
- keyboard_send_escape "$vm_name"
- keyboard_send_escape "$vm_name"
- keyboard_send_enter "$vm_name"
-
- conditional_sleep 1
-
- echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
- keyboard_send_string "$vm_name" "$boot_args"
-
- echo "Initiating boot sequence"
- keyboard_send_enter "$vm_name"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/lib.ubuntu-14.04-server-amd64.sh b/labs/osbash/lib/osbash/lib.ubuntu-14.04-server-amd64.sh
deleted file mode 100644
index 6dafe495..00000000
--- a/labs/osbash/lib/osbash/lib.ubuntu-14.04-server-amd64.sh
+++ /dev/null
@@ -1,86 +0,0 @@
-# Ubuntu 14.04 LTS amd64 server
-
-# Default scripts for all Ubuntu installs
-: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
-
-#-------------------------------------------------------------------------------
-# Installation from ISO image
-#-------------------------------------------------------------------------------
-
-readonly ISO_URL_BASE=http://releases.ubuntu.com/14.04
-
-ISO_URL=$ISO_URL_BASE/ubuntu-14.04.5-server-amd64.iso
-ISO_MD5=dd54dc8cfc2a655053d19813c2f9aa9f
-
-readonly _PS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-ssh-v4.cfg
-readonly _PS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-vbadd.cfg
-readonly _PS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-all-v2.cfg
-
-# Arguments for ISO image installer
-readonly _BOOT_ARGS="/install/vmlinuz
- noapic
- preseed/url=%s
- debian-installer=en_US
- auto=true
- locale=en_US
- hostname=osbash
- fb=false
- debconf/frontend=noninteractive
- keyboard-configuration/modelcode=SKIP
- initrd=/install/initrd.gz
- console-setup/ask_detect=false"
-
-# Fallback function to find current ISO image in case the file in ISO_URL is
-# neither on the disk nor at the configured URL.
-# This mechanism was added because old Ubuntu ISOs are removed from the server
-# as soon as a new ISO appears.
-function update_iso_variables {
- # Get matching line from distro repo's MD5SUMS file, e.g.
- # "9e5fecc94b3925bededed0fdca1bd417 *ubuntu-14.04.3-server-amd64.iso"
- local distro_info=$(wget -O - "$ISO_URL_BASE/MD5SUMS" | \
- grep "server-amd64.*\.iso" | tail -n1)
-
- # First part (removing everything after first space) is the md5sum
- ISO_MD5=${distro_info%% *}
-
- # Second part (keeping everything after ' *') is the ISO file name
- local iso_file=${distro_info#* \*}
-
- ISO_URL=$ISO_URL_BASE/$iso_file
-
- echo -e >&2 "${CStatus:-}New ISO_URL: ${CData:-}$ISO_URL${CReset:-}"
-}
-
-# ostype used by VirtualBox to choose icon and flags (64-bit, IOAPIC)
-VBOX_OSTYPE=Ubuntu_64
-
-# Boot the ISO image operating system installer
-function distro_start_installer {
- local vm_name=$1
-
- # pick a _PS_* file
- local preseed=_PS_$VM_ACCESS
-
- echo "Using $preseed ${!preseed}"
-
- local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
-
- if [ -n "${VM_PROXY:-""}" ]; then
- echo >&2 "Using proxy $VM_PROXY."
- boot_args="$boot_args mirror/http/proxy=$VM_PROXY http_proxy=$VM_PROXY"
- fi
-
- keyboard_send_escape "$vm_name"
- keyboard_send_escape "$vm_name"
- keyboard_send_enter "$vm_name"
-
- conditional_sleep 1
-
- echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
- keyboard_send_string "$vm_name" "$boot_args"
-
- echo "Initiating boot sequence"
- keyboard_send_enter "$vm_name"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/lib.ubuntu-14.04-server-i386.sh b/labs/osbash/lib/osbash/lib.ubuntu-14.04-server-i386.sh
deleted file mode 100644
index c5db09d1..00000000
--- a/labs/osbash/lib/osbash/lib.ubuntu-14.04-server-i386.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-# Ubuntu 14.04 LTS i386 server
-
-# Default scripts for all Ubuntu installs
-: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
-
-#-------------------------------------------------------------------------------
-# Installation from ISO image
-#-------------------------------------------------------------------------------
-
-readonly ISO_URL_BASE=http://releases.ubuntu.com/14.04
-
-ISO_URL=$ISO_URL_BASE/ubuntu-14.04.5-server-i386.iso
-ISO_MD5=812ac191b8898b33aed4aef9ab066b5a
-
-readonly _PS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-ssh-v4.cfg
-readonly _PS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-vbadd.cfg
-readonly _PS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-all-v2.cfg
-
-# Arguments for ISO image installer
-readonly _BOOT_ARGS="/install/vmlinuz
- noapic
- preseed/url=%s
- debian-installer=en_US
- auto=true
- locale=en_US
- hostname=osbash
- fb=false
- debconf/frontend=noninteractive
- keyboard-configuration/modelcode=SKIP
- initrd=/install/initrd.gz
- console-setup/ask_detect=false"
-
-# Fallback function to find current ISO image in case the file in ISO_URL is
-# neither on the disk nor at the configured URL.
-# This mechanism was added because old Ubuntu ISOs are removed from the server
-# as soon as a new ISO appears.
-function update_iso_variables {
- # Get matching line from distro repo's MD5SUMS file, e.g.
- # "9e5fecc94b3925bededed0fdca1bd417 *ubuntu-14.04.5-server-i386.iso"
- local distro_info=$(wget -O - "$ISO_URL_BASE/MD5SUMS" | \
- grep "server-i386.*\.iso" | tail -n1)
-
- # First part (removing everything after first space) is the md5sum
- ISO_MD5=${distro_info%% *}
-
- # Second part (keeping everything after ' *') is the ISO file name
- local iso_file=${distro_info#* \*}
-
- ISO_URL=$ISO_URL_BASE/$iso_file
-
- echo -e >&2 "${CStatus:-}New ISO_URL: ${CData:-}$ISO_URL${CReset:-}"
-}
-
-VBOX_OSTYPE=Ubuntu
-
-# Boot the ISO image operating system installer
-function distro_start_installer {
- local vm_name=$1
-
- # pick a _PS_* file
- local preseed=_PS_$VM_ACCESS
-
- echo "Using $preseed ${!preseed}"
-
- local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
-
- keyboard_send_escape "$vm_name"
- keyboard_send_escape "$vm_name"
- keyboard_send_enter "$vm_name"
-
- conditional_sleep 1
-
- echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
- keyboard_send_string "$vm_name" "$boot_args"
-
- echo "Initiating boot sequence"
- keyboard_send_enter "$vm_name"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/lib.ubuntu-16.04-server-amd64.sh b/labs/osbash/lib/osbash/lib.ubuntu-16.04-server-amd64.sh
deleted file mode 100644
index 3a0f9e66..00000000
--- a/labs/osbash/lib/osbash/lib.ubuntu-16.04-server-amd64.sh
+++ /dev/null
@@ -1,89 +0,0 @@
-# Ubuntu 16.04 LTS amd64 server
-
-# Default scripts for all Ubuntu installs
-: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
-
-#-------------------------------------------------------------------------------
-# Installation from ISO image
-#-------------------------------------------------------------------------------
-
-readonly ISO_URL_BASE=http://releases.ubuntu.com/16.04
-
-ISO_URL=$ISO_URL_BASE/ubuntu-16.04.5-server-amd64.iso
-ISO_MD5=24636fd103a2a43c95659f1c3c63718e
-
-readonly _PS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-ssh-v6.cfg
-readonly _PS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-vbadd-v6.cfg
-readonly _PS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-all-v6.cfg
-
-# Arguments for ISO image installer
-readonly _BOOT_ARGS="/install/vmlinuz
- noapic
- preseed/url=%s
- debian-installer=en_US
- auto=true
- locale=en_US
- hostname=osbash
- fb=false
- debconf/frontend=noninteractive
- keyboard-configuration/modelcode=SKIP
- initrd=/install/initrd.gz
- console-setup/ask_detect=false"
-
-# file=/bin/cdrom-checker-menu vga=788 initrd=/install/initrd.gz quiet ---
-
-# Fallback function to find current ISO image in case the file in ISO_URL is
-# neither on the disk nor at the configured URL.
-# This mechanism was added because old Ubuntu ISOs are removed from the server
-# as soon as a new ISO appears.
-function update_iso_variables {
- # Get matching line from distro repo's MD5SUMS file, e.g.
- # "9e5fecc94b3925bededed0fdca1bd417 *ubuntu-14.04.3-server-amd64.iso"
- local distro_info=$(wget -O - "$ISO_URL_BASE/MD5SUMS" | \
- grep "server-amd64.*\.iso" | tail -n1)
-
- # First part (removing everything after first space) is the md5sum
- ISO_MD5=${distro_info%% *}
-
- # Second part (keeping everything after ' *') is the ISO file name
- local iso_file=${distro_info#* \*}
-
- ISO_URL=$ISO_URL_BASE/$iso_file
-
- echo -e >&2 "${CStatus:-}New ISO_URL: ${CData:-}$ISO_URL${CReset:-}"
-}
-
-# ostype used by VirtualBox to choose icon and flags (64-bit, IOAPIC)
-VBOX_OSTYPE=Ubuntu_64
-
-# Boot the ISO image operating system installer
-function distro_start_installer {
- local vm_name=$1
-
- # pick a _PS_* file
- local preseed=_PS_$VM_ACCESS
-
- echo "Using $preseed ${!preseed}"
-
- local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
-
- if [ -n "${VM_PROXY:-""}" ]; then
- echo >&2 "Using proxy $VM_PROXY."
- boot_args="$boot_args mirror/http/proxy=$VM_PROXY http_proxy=$VM_PROXY"
- fi
-
- keyboard_send_enter "$vm_name"
- keyboard_send_f6 "$vm_name"
- keyboard_send_escape "$vm_name"
- for i in $(seq 1 83); do
- keyboard_send_backspace "$vm_name"
- done
-
- echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
- keyboard_send_string "$vm_name" "$boot_args"
-
- echo "Initiating boot sequence"
- keyboard_send_enter "$vm_name"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/lib.ubuntu-16.04-server-i386.sh b/labs/osbash/lib/osbash/lib.ubuntu-16.04-server-i386.sh
deleted file mode 100644
index 13291c32..00000000
--- a/labs/osbash/lib/osbash/lib.ubuntu-16.04-server-i386.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-# Ubuntu 16.04 LTS i386 server
-
-# Default scripts for all Ubuntu installs
-: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
-
-#-------------------------------------------------------------------------------
-# Installation from ISO image
-#-------------------------------------------------------------------------------
-
-readonly ISO_URL_BASE=http://releases.ubuntu.com/16.04
-
-ISO_URL=$ISO_URL_BASE/ubuntu-16.04.5-server-i386.iso
-ISO_MD5=9ba5fefe27685ae69f991c45396080af
-
-readonly _PS_ssh=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-ssh-v6.cfg
-readonly _PS_vbadd=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-vbadd-v6.cfg
-readonly _PS_all=https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash/netboot/preseed-all-v6.cfg
-
-# Arguments for ISO image installer
-readonly _BOOT_ARGS="/install/vmlinuz
- noapic
- preseed/url=%s
- debian-installer=en_US
- auto=true
- locale=en_US
- hostname=osbash
- fb=false
- debconf/frontend=noninteractive
- keyboard-configuration/modelcode=SKIP
- initrd=/install/initrd.gz
- console-setup/ask_detect=false"
-
-# Fallback function to find current ISO image in case the file in ISO_URL is
-# neither on the disk nor at the configured URL.
-# This mechanism was added because old Ubuntu ISOs are removed from the server
-# as soon as a new ISO appears.
-function update_iso_variables {
- # Get matching line from distro repo's MD5SUMS file, e.g.
- # "9e5fecc94b3925bededed0fdca1bd417 *ubuntu-14.04.3-server-i386.iso"
- local distro_info=$(wget -O - "$ISO_URL_BASE/MD5SUMS" | \
- grep "server-i386.*\.iso" | tail -n1)
-
- # First part (removing everything after first space) is the md5sum
- ISO_MD5=${distro_info%% *}
-
- # Second part (keeping everything after ' *') is the ISO file name
- local iso_file=${distro_info#* \*}
-
- ISO_URL=$ISO_URL_BASE/$iso_file
-
- echo -e >&2 "${CStatus:-}New ISO_URL: ${CData:-}$ISO_URL${CReset:-}"
-}
-
-# ostype used by VirtualBox to choose icon and flags (64-bit, IOAPIC)
-VBOX_OSTYPE=Ubuntu
-
-# Boot the ISO image operating system installer
-function distro_start_installer {
- local vm_name=$1
-
- # pick a _PS_* file
- local preseed=_PS_$VM_ACCESS
-
- echo "Using $preseed ${!preseed}"
-
- local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
-
- if [ -n "${VM_PROXY:-""}" ]; then
- echo >&2 "Using proxy $VM_PROXY."
- boot_args="$boot_args mirror/http/proxy=$VM_PROXY http_proxy=$VM_PROXY"
- fi
-
- keyboard_send_enter "$vm_name"
- keyboard_send_f6 "$vm_name"
- keyboard_send_escape "$vm_name"
- for i in $(seq 1 83); do
- keyboard_send_backspace "$vm_name"
- done
-
- echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
- keyboard_send_string "$vm_name" "$boot_args"
-
- echo "Initiating boot sequence"
- keyboard_send_enter "$vm_name"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/netboot/ks-all-v2.cfg b/labs/osbash/lib/osbash/netboot/ks-all-v2.cfg
deleted file mode 100644
index 05fa1f37..00000000
--- a/labs/osbash/lib/osbash/netboot/ks-all-v2.cfg
+++ /dev/null
@@ -1,75 +0,0 @@
-#platform=x86, AMD64, or Intel EM64T
-#version=DEVEL
-# Install OS instead of upgrade
-install
-# Keyboard layouts
-keyboard 'us'
-# Reboot after installation
-reboot --eject
-# Root password
-rootpw --plaintext osbash
-# User
-user --name=osbash --password=osbash --plaintext
-# System timezone
-timezone Etc/UTC --isUtc
-# System language
-lang en_US
-# Firewall configuration
-firewall --disabled
-# System authorization information
-auth --useshadow --passalgo=sha512
-# Use CDROM installation media
-cdrom
-# Use text mode install
-text
-# SELinux configuration
-selinux --permissive
-# Do not configure the X Window System
-skipx
-
-# System bootloader configuration
-bootloader --location=mbr
-# Partition clearing information
-clearpart --all
-
-part /boot --fstype=ext4 --size=1024
-part pv.0 --grow --size=1
-volgroup ROOTDISK --pesize=4096 pv.0
-logvol swap --name=swap --vgname=ROOTDISK --recommended
-logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
-
-%pre --interpreter=bash
-%end
-#-------------------------------------------------------------------------------
-# Enable ssh login with insecure osbash key and password-less sudo for osbash
-# Install VirtualBox guest additions, bootstrap osbashauto
-%post --interpreter=/bin/bash
-DIR=/home/osbash/.ssh
-mkdir $DIR
-wget -O $DIR/authorized_keys https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub
-chmod 700 $DIR
-chmod 400 $DIR/authorized_keys
-chown -R osbash:osbash $DIR
-echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
-echo "Defaults:osbash !requiretty" >> /etc/sudoers
-
-yum -y install dkms
-
-mount /dev/sr1 /mnt
-/mnt/VBoxLinuxAdditions.run
-umount /mnt
-
-echo -e '#!/bin/bash\nbash /media/sf_*/autostart/*activate_autostart.sh\nrm /media/*/autostart/*activate_autostart.sh' > /etc/init.d/osbash
-chmod 755 /etc/init.d/osbash
-ln -s ../init.d/osbash /etc/rc2.d/S40osbash
-%end
-#-------------------------------------------------------------------------------
-# tar, bzip2, kernel-{devel,headers}: needed for VirtualBox guest additions
-# (but not in @core)
-%packages
-wget
-tar
-bzip2
-kernel-devel
-kernel-headers
-%end
diff --git a/labs/osbash/lib/osbash/netboot/ks-all.cfg b/labs/osbash/lib/osbash/netboot/ks-all.cfg
deleted file mode 100644
index 76d9f80c..00000000
--- a/labs/osbash/lib/osbash/netboot/ks-all.cfg
+++ /dev/null
@@ -1,75 +0,0 @@
-#platform=x86, AMD64, or Intel EM64T
-#version=DEVEL
-# Install OS instead of upgrade
-install
-# Keyboard layouts
-keyboard 'us'
-# Reboot after installation
-reboot --eject
-# Root password
-rootpw --plaintext osbash
-# User
-user --name=osbash --password=osbash --plaintext
-# System timezone
-timezone Etc/UTC --isUtc
-# System language
-lang en_US
-# Firewall configuration
-firewall --disabled
-# System authorization information
-auth --useshadow --passalgo=sha512
-# Use CDROM installation media
-cdrom
-# Use text mode install
-text
-# SELinux configuration
-selinux --permissive
-# Do not configure the X Window System
-skipx
-
-# System bootloader configuration
-bootloader --location=mbr
-# Partition clearing information
-clearpart --all
-
-part /boot --fstype=ext4 --size=1024
-part pv.0 --grow --size=1
-volgroup ROOTDISK --pesize=4096 pv.0
-logvol swap --name=swap --vgname=ROOTDISK --recommended
-logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
-
-%pre --interpreter=bash
-%end
-#-------------------------------------------------------------------------------
-# Enable ssh login with insecure Vagrant key and password-less sudo for osbash
-# Install VirtualBox guest additions, bootstrap osbashauto
-%post --interpreter=/bin/bash
-DIR=/home/osbash/.ssh
-mkdir $DIR
-wget -O $DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
-chmod 700 $DIR
-chmod 400 $DIR/authorized_keys
-chown -R osbash:osbash $DIR
-echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
-echo "Defaults:osbash !requiretty" >> /etc/sudoers
-
-yum -y install dkms
-
-mount /dev/sr1 /mnt
-/mnt/VBoxLinuxAdditions.run
-umount /mnt
-
-echo -e '#!/bin/bash\nbash /media/sf_*/autostart/*activate_autostart.sh\nrm /media/*/autostart/*activate_autostart.sh' > /etc/init.d/osbash
-chmod 755 /etc/init.d/osbash
-ln -s ../init.d/osbash /etc/rc2.d/S40osbash
-%end
-#-------------------------------------------------------------------------------
-# tar, bzip2, kernel-{devel,headers}: needed for VirtualBox guest additions
-# (but not in @core)
-%packages
-wget
-tar
-bzip2
-kernel-devel
-kernel-headers
-%end
diff --git a/labs/osbash/lib/osbash/netboot/ks-ssh-v2.cfg b/labs/osbash/lib/osbash/netboot/ks-ssh-v2.cfg
deleted file mode 100644
index c66a4e82..00000000
--- a/labs/osbash/lib/osbash/netboot/ks-ssh-v2.cfg
+++ /dev/null
@@ -1,58 +0,0 @@
-#platform=x86, AMD64, or Intel EM64T
-#version=DEVEL
-# Install OS instead of upgrade
-install
-# Keyboard layouts
-keyboard 'us'
-# Reboot after installation
-reboot --eject
-# Root password
-rootpw --plaintext osbash
-# User
-user --name=osbash --password=osbash --plaintext
-# System timezone
-timezone Etc/UTC --isUtc
-# System language
-lang en_US
-# Firewall configuration
-firewall --disabled
-# System authorization information
-auth --useshadow --passalgo=sha512
-# Use CDROM installation media
-cdrom
-# Use text mode install
-text
-# SELinux configuration
-selinux --permissive
-# Do not configure the X Window System
-skipx
-
-# System bootloader configuration
-bootloader --location=mbr
-# Partition clearing information
-clearpart --all
-
-part /boot --fstype=ext4 --size=1024
-part pv.0 --grow --size=1
-volgroup ROOTDISK --pesize=4096 pv.0
-logvol swap --name=swap --vgname=ROOTDISK --recommended
-logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
-
-%pre --interpreter=bash
-%end
-#-------------------------------------------------------------------------------
-# Enable ssh login with insecure osbash key and password-less sudo for osbash
-%post --interpreter=/bin/bash
-DIR=/home/osbash/.ssh
-mkdir $DIR
-wget -O $DIR/authorized_keys https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub
-chmod 700 $DIR
-chmod 400 $DIR/authorized_keys
-chown -R osbash:osbash $DIR
-echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
-echo "Defaults:osbash !requiretty" >> /etc/sudoers
-%end
-
-%packages
-wget
-%end
diff --git a/labs/osbash/lib/osbash/netboot/ks-ssh.cfg b/labs/osbash/lib/osbash/netboot/ks-ssh.cfg
deleted file mode 100644
index 45736a1f..00000000
--- a/labs/osbash/lib/osbash/netboot/ks-ssh.cfg
+++ /dev/null
@@ -1,58 +0,0 @@
-#platform=x86, AMD64, or Intel EM64T
-#version=DEVEL
-# Install OS instead of upgrade
-install
-# Keyboard layouts
-keyboard 'us'
-# Reboot after installation
-reboot --eject
-# Root password
-rootpw --plaintext osbash
-# User
-user --name=osbash --password=osbash --plaintext
-# System timezone
-timezone Etc/UTC --isUtc
-# System language
-lang en_US
-# Firewall configuration
-firewall --disabled
-# System authorization information
-auth --useshadow --passalgo=sha512
-# Use CDROM installation media
-cdrom
-# Use text mode install
-text
-# SELinux configuration
-selinux --permissive
-# Do not configure the X Window System
-skipx
-
-# System bootloader configuration
-bootloader --location=mbr
-# Partition clearing information
-clearpart --all
-
-part /boot --fstype=ext4 --size=1024
-part pv.0 --grow --size=1
-volgroup ROOTDISK --pesize=4096 pv.0
-logvol swap --name=swap --vgname=ROOTDISK --recommended
-logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
-
-%pre --interpreter=bash
-%end
-#-------------------------------------------------------------------------------
-# Enable ssh login with insecure Vagrant key and password-less sudo for osbash
-%post --interpreter=/bin/bash
-DIR=/home/osbash/.ssh
-mkdir $DIR
-wget -O $DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
-chmod 700 $DIR
-chmod 400 $DIR/authorized_keys
-chown -R osbash:osbash $DIR
-echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
-echo "Defaults:osbash !requiretty" >> /etc/sudoers
-%end
-
-%packages
-wget
-%end
diff --git a/labs/osbash/lib/osbash/netboot/ks-vbadd.cfg b/labs/osbash/lib/osbash/netboot/ks-vbadd.cfg
deleted file mode 100644
index a133d6bf..00000000
--- a/labs/osbash/lib/osbash/netboot/ks-vbadd.cfg
+++ /dev/null
@@ -1,64 +0,0 @@
-#platform=x86, AMD64, or Intel EM64T
-#version=DEVEL
-# Install OS instead of upgrade
-install
-# Keyboard layouts
-keyboard 'us'
-# Reboot after installation
-reboot --eject
-# Root password
-rootpw --plaintext osbash
-# System timezone
-timezone Etc/UTC --isUtc
-# System language
-lang en_US
-# Firewall configuration
-firewall --disabled
-# System authorization information
-auth --useshadow --passalgo=sha512
-# Use CDROM installation media
-cdrom
-# Use text mode install
-text
-# SELinux configuration
-selinux --permissive
-# Do not configure the X Window System
-skipx
-
-# System bootloader configuration
-bootloader --location=mbr
-# Partition clearing information
-clearpart --all
-
-part /boot --fstype=ext4 --size=1024
-part pv.0 --grow --size=1
-volgroup ROOTDISK --pesize=4096 pv.0
-logvol swap --name=swap --vgname=ROOTDISK --recommended
-logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
-
-%pre --interpreter=bash
-%end
-#-------------------------------------------------------------------------------
-# Install VirtualBox guest additions, bootstrap osbashauto
-%post --interpreter=/bin/bash
-
-yum -y install dkms
-
-mount /dev/sr1 /mnt
-/mnt/VBoxLinuxAdditions.run
-umount /mnt
-
-echo -e '#!/bin/bash\nbash /media/sf_*/autostart/*activate_autostart.sh\nrm /media/*/autostart/*activate_autostart.sh' > /etc/init.d/osbash
-chmod 755 /etc/init.d/osbash
-ln -s ../init.d/osbash /etc/rc2.d/S40osbash
-
-%end
-#-------------------------------------------------------------------------------
-# tar, bzip2, kernel-{devel,headers}: needed for VirtualBox guest additions
-# (but not in @core)
-%packages
-tar
-bzip2
-kernel-devel
-kernel-headers
-%end
diff --git a/labs/osbash/lib/osbash/netboot/preseed-all-v2.cfg b/labs/osbash/lib/osbash/netboot/preseed-all-v2.cfg
deleted file mode 100644
index 59fdd570..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-all-v2.cfg
+++ /dev/null
@@ -1,120 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-tasksel tasksel/first minimal
-
-# Individual additional packages to install
-d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers; apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils; mount /dev/sr1 /mnt; /mnt/VBoxLinuxAdditions.run; umount /mnt; echo -e '#!/bin/bash\nexec > /root/bootstrap.log 2>&1\nset -x\nSCR=/media/sf_bootstrap/autostart/*activate_autostart.sh\nwhile [ ! -f \$SCR ];do sleep 1;done\nbash \$SCR\nrm -v \$SCR' > /etc/rc2.d/S40osbash; chmod 755 /etc/rc2.d/S40osbash;" | chroot /target /bin/bash;
diff --git a/labs/osbash/lib/osbash/netboot/preseed-all-v6.cfg b/labs/osbash/lib/osbash/netboot/preseed-all-v6.cfg
deleted file mode 100644
index 4e09978e..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-all-v6.cfg
+++ /dev/null
@@ -1,146 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-d-i partman-auto/disk string /dev/sda
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-# (standard system utilities, OpenSSH server, Basic Ubuntu server)
-tasksel tasksel/first standard system utilities
-
-# Individual additional packages to install
-# pkgsel/include disabled because it seems to cause non-deterministic installer
-# errors with Ubuntu LTS 16.04.2; installing in late_command instead
-#d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-
-# Halt after installation
-#d-i debian-installer/exit/poweroff boolean true
-#ubiquity ubiquity/poweroff boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
-mkdir -v $DIR; \
-chmod 700 $DIR; \
-echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
-in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
-echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
-echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers; \
-in-target apt-get -y install openssh-server; \
-echo "installed openssh" >> /target/root/preseed.log; \
-in-target apt-get -y install localepurge; \
-echo "installed localepurge" >> /target/root/preseed.log; \
-in-target apt-get -y install dkms; \
-echo "installed dkms" >> /target/root/preseed.log; \
-chroot /target/ apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils >/target/root/01_vbox_purge 2>&1; \
-mount /dev/sr1 /target/mnt; \
-chroot /target /mnt/VBoxLinuxAdditions.run >/target/root/02_vbox_guestadd 2>&1; \
-umount /target/mnt; \
-sed -i 's/exit 0/# exit 0/' /target/etc/rc.local; \
-echo 'exec > /root/bootstrap.log 2>&1;set -x;SCR=/media/sf_bootstrap/autostart/*activate_autostart.sh;while [ ! -f $SCR ];do sleep 1;done;bash $SCR;rm -v $SCR' >> /target/etc/rc.local;
diff --git a/labs/osbash/lib/osbash/netboot/preseed-all-v7.cfg b/labs/osbash/lib/osbash/netboot/preseed-all-v7.cfg
deleted file mode 100644
index 793d13f4..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-all-v7.cfg
+++ /dev/null
@@ -1,149 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-d-i partman-auto/disk string /dev/sda
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-# (standard system utilities, OpenSSH server, Basic Ubuntu server)
-tasksel tasksel/first standard system utilities
-
-# Individual additional packages to install
-# pkgsel/include disabled because it seems to cause non-deterministic installer
-# errors with Ubuntu LTS 16.04.2; installing in late_command instead
-#d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-
-# Halt after installation
-#d-i debian-installer/exit/poweroff boolean true
-#ubiquity ubiquity/poweroff boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
-mkdir -v $DIR; \
-chmod 700 $DIR; \
-echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
-in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
-echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
-echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers; \
-in-target apt-get -y install openssh-server; \
-echo "installed openssh" >> /target/root/preseed.log; \
-in-target apt-get -y install localepurge; \
-echo "installed localepurge" >> /target/root/preseed.log; \
-in-target apt-get -y install dkms; \
-echo "installed dkms" >> /target/root/preseed.log; \
-chroot /target/ apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils >/target/root/01_vbox_purge 2>&1; \
-mount /dev/sr1 /target/mnt; \
-chroot /target /mnt/VBoxLinuxAdditions.run >/target/root/02_vbox_guestadd 2>&1; \
-umount /target/mnt; \
-sed -i 's/exit 0/# exit 0/' /target/etc/rc.local; \
-echo '#!/bin/bash' > /target/etc/rc.local; \
-echo 'exec > /root/bootstrap.log 2>&1;set -x;SCR=/media/sf_bootstrap/autostart/*activate_autostart.sh;while [ ! -f $SCR ];do sleep 2;done;bash $SCR;rm -v $SCR' >> /target/etc/rc.local; \
-chmod a+x /target/etc/rc.local; \
-echo "created /etc/rc.local" >> /target/root/preseed.log;
diff --git a/labs/osbash/lib/osbash/netboot/preseed-all.cfg b/labs/osbash/lib/osbash/netboot/preseed-all.cfg
deleted file mode 100644
index 1698dcf4..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-all.cfg
+++ /dev/null
@@ -1,120 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-tasksel tasksel/first minimal
-
-# Individual additional packages to install
-d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers; apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils; mount /dev/sr1 /mnt; /mnt/VBoxLinuxAdditions.run; umount /mnt; echo -e '#!/bin/bash\nexec > /root/bootstrap.log 2>&1\nset -x\nSCR=/media/sf_bootstrap/autostart/*activate_autostart.sh\nwhile [ ! -f \$SCR ];do sleep 1;done\nbash \$SCR\nrm -v \$SCR' > /etc/rc2.d/S40osbash; chmod 755 /etc/rc2.d/S40osbash;" | chroot /target /bin/bash;
diff --git a/labs/osbash/lib/osbash/netboot/preseed-ssh-v2.cfg b/labs/osbash/lib/osbash/netboot/preseed-ssh-v2.cfg
deleted file mode 100644
index cc0d7e81..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-ssh-v2.cfg
+++ /dev/null
@@ -1,120 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-tasksel tasksel/first minimal
-
-# Individual additional packages to install
-d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers;" | chroot /target /bin/bash;
diff --git a/labs/osbash/lib/osbash/netboot/preseed-ssh-v3.cfg b/labs/osbash/lib/osbash/netboot/preseed-ssh-v3.cfg
deleted file mode 100644
index 282e1f1a..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-ssh-v3.cfg
+++ /dev/null
@@ -1,125 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-d-i partman-auto/disk string /dev/sda
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-tasksel tasksel/first minimal
-
-# Individual additional packages to install
-d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-
-# Halt after installation
-#d-i debian-installer/exit/poweroff boolean true
-#ubiquity ubiquity/poweroff boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://opendev.org/openstack/training-labs/raw/branch/master/labs/osbash/lib/osbash-ssh-keys/osbash_key.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers;" | chroot /target /bin/bash;
diff --git a/labs/osbash/lib/osbash/netboot/preseed-ssh-v4.cfg b/labs/osbash/lib/osbash/netboot/preseed-ssh-v4.cfg
deleted file mode 100644
index 55ed8478..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-ssh-v4.cfg
+++ /dev/null
@@ -1,131 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-d-i partman-auto/disk string /dev/sda
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-tasksel tasksel/first minimal
-
-# Individual additional packages to install
-d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-
-# Halt after installation
-#d-i debian-installer/exit/poweroff boolean true
-#ubiquity ubiquity/poweroff boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
-mkdir -v $DIR; \
-chmod 700 $DIR; \
-echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
-in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
-echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
-echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers
diff --git a/labs/osbash/lib/osbash/netboot/preseed-ssh-v5.cfg b/labs/osbash/lib/osbash/netboot/preseed-ssh-v5.cfg
deleted file mode 100644
index 5b2300f5..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-ssh-v5.cfg
+++ /dev/null
@@ -1,132 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-d-i partman-auto/disk string /dev/sda
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-tasksel tasksel/first minimal
-
-# Individual additional packages to install
-d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-d-i grub-installer/bootdev string /dev/sda
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-
-# Halt after installation
-#d-i debian-installer/exit/poweroff boolean true
-#ubiquity ubiquity/poweroff boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
-mkdir -v $DIR; \
-chmod 700 $DIR; \
-echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
-in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
-echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
-echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers
diff --git a/labs/osbash/lib/osbash/netboot/preseed-ssh-v6.cfg b/labs/osbash/lib/osbash/netboot/preseed-ssh-v6.cfg
deleted file mode 100644
index be98ecc0..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-ssh-v6.cfg
+++ /dev/null
@@ -1,140 +0,0 @@
-# Based on
-# https://help.ubuntu.com/16.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/16.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-d-i partman-auto/disk string /dev/sda
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-# (standard system utilities, OpenSSH server, Basic Ubuntu server)
-tasksel tasksel/first standard system utilities
-
-# Individual additional packages to install
-# pkgsel/include disabled because it seems to cause non-deterministic installer
-# errors with Ubuntu LTS 16.04.2; installing in late_command instead
-#d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-
-# Halt after installation
-#d-i debian-installer/exit/poweroff boolean true
-#ubiquity ubiquity/poweroff boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
-mkdir -v $DIR; \
-chmod 700 $DIR; \
-echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
-in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
-echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
-echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers; \
-in-target apt-get -y install openssh-server; \
-echo "installed openssh" >> /target/root/preseed.log; \
-in-target apt-get -y install localepurge; \
-echo "installed localepurge" >> /target/root/preseed.log; \
-in-target apt-get -y install dkms; \
-echo "installed dkms" >> /target/root/preseed.log
diff --git a/labs/osbash/lib/osbash/netboot/preseed-ssh.cfg b/labs/osbash/lib/osbash/netboot/preseed-ssh.cfg
deleted file mode 100644
index 8bf76ee4..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-ssh.cfg
+++ /dev/null
@@ -1,120 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-tasksel tasksel/first minimal
-
-# Individual additional packages to install
-d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers;" | chroot /target /bin/bash;
diff --git a/labs/osbash/lib/osbash/netboot/preseed-vbadd-v3.cfg b/labs/osbash/lib/osbash/netboot/preseed-vbadd-v3.cfg
deleted file mode 100644
index e07eb709..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-vbadd-v3.cfg
+++ /dev/null
@@ -1,130 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-d-i partman-auto/disk string /dev/sda
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-tasksel tasksel/first minimal
-
-# Individual additional packages to install
-d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-
-# Halt after installation
-#d-i debian-installer/exit/poweroff boolean true
-#ubiquity ubiquity/poweroff boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string chroot /target/ apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils >/target/root/01_vbox_purge 2>&1; \
-mount /dev/sr1 /target/mnt; \
-chroot /target /mnt/VBoxLinuxAdditions.run >/target/root/02_vbox_guestadd 2>&1; \
-umount /target/mnt; \
-sed -i 's/exit 0/# exit 0/' /target/etc/rc.local; \
-echo 'exec > /root/bootstrap.log 2>&1;set -x;SCR=/media/sf_bootstrap/autostart/*activate_autostart.sh;while [ ! -f $SCR ];do sleep 1;done;bash $SCR;rm -v $SCR' >> /target/etc/rc.local;
diff --git a/labs/osbash/lib/osbash/netboot/preseed-vbadd-v6.cfg b/labs/osbash/lib/osbash/netboot/preseed-vbadd-v6.cfg
deleted file mode 100644
index 4e09978e..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-vbadd-v6.cfg
+++ /dev/null
@@ -1,146 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-d-i partman-auto/disk string /dev/sda
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-# (standard system utilities, OpenSSH server, Basic Ubuntu server)
-tasksel tasksel/first standard system utilities
-
-# Individual additional packages to install
-# pkgsel/include disabled because it seems to cause non-deterministic installer
-# errors with Ubuntu LTS 16.04.2; installing in late_command instead
-#d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-
-# Halt after installation
-#d-i debian-installer/exit/poweroff boolean true
-#ubiquity ubiquity/poweroff boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
-mkdir -v $DIR; \
-chmod 700 $DIR; \
-echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
-in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
-echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
-echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers; \
-in-target apt-get -y install openssh-server; \
-echo "installed openssh" >> /target/root/preseed.log; \
-in-target apt-get -y install localepurge; \
-echo "installed localepurge" >> /target/root/preseed.log; \
-in-target apt-get -y install dkms; \
-echo "installed dkms" >> /target/root/preseed.log; \
-chroot /target/ apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils >/target/root/01_vbox_purge 2>&1; \
-mount /dev/sr1 /target/mnt; \
-chroot /target /mnt/VBoxLinuxAdditions.run >/target/root/02_vbox_guestadd 2>&1; \
-umount /target/mnt; \
-sed -i 's/exit 0/# exit 0/' /target/etc/rc.local; \
-echo 'exec > /root/bootstrap.log 2>&1;set -x;SCR=/media/sf_bootstrap/autostart/*activate_autostart.sh;while [ ! -f $SCR ];do sleep 1;done;bash $SCR;rm -v $SCR' >> /target/etc/rc.local;
diff --git a/labs/osbash/lib/osbash/netboot/preseed-vbadd-v7.cfg b/labs/osbash/lib/osbash/netboot/preseed-vbadd-v7.cfg
deleted file mode 100644
index 793d13f4..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-vbadd-v7.cfg
+++ /dev/null
@@ -1,149 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-d-i partman-auto/disk string /dev/sda
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-# (standard system utilities, OpenSSH server, Basic Ubuntu server)
-tasksel tasksel/first standard system utilities
-
-# Individual additional packages to install
-# pkgsel/include disabled because it seems to cause non-deterministic installer
-# errors with Ubuntu LTS 16.04.2; installing in late_command instead
-#d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-
-# Halt after installation
-#d-i debian-installer/exit/poweroff boolean true
-#ubiquity ubiquity/poweroff boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
-mkdir -v $DIR; \
-chmod 700 $DIR; \
-echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
-in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
-echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
-echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers; \
-in-target apt-get -y install openssh-server; \
-echo "installed openssh" >> /target/root/preseed.log; \
-in-target apt-get -y install localepurge; \
-echo "installed localepurge" >> /target/root/preseed.log; \
-in-target apt-get -y install dkms; \
-echo "installed dkms" >> /target/root/preseed.log; \
-chroot /target/ apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils >/target/root/01_vbox_purge 2>&1; \
-mount /dev/sr1 /target/mnt; \
-chroot /target /mnt/VBoxLinuxAdditions.run >/target/root/02_vbox_guestadd 2>&1; \
-umount /target/mnt; \
-sed -i 's/exit 0/# exit 0/' /target/etc/rc.local; \
-echo '#!/bin/bash' > /target/etc/rc.local; \
-echo 'exec > /root/bootstrap.log 2>&1;set -x;SCR=/media/sf_bootstrap/autostart/*activate_autostart.sh;while [ ! -f $SCR ];do sleep 2;done;bash $SCR;rm -v $SCR' >> /target/etc/rc.local; \
-chmod a+x /target/etc/rc.local; \
-echo "created /etc/rc.local" >> /target/root/preseed.log;
diff --git a/labs/osbash/lib/osbash/netboot/preseed-vbadd.cfg b/labs/osbash/lib/osbash/netboot/preseed-vbadd.cfg
deleted file mode 100644
index 56eab470..00000000
--- a/labs/osbash/lib/osbash/netboot/preseed-vbadd.cfg
+++ /dev/null
@@ -1,120 +0,0 @@
-# Based on
-# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
-#
-# For details, see:
-# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
-#-------------------------------------------------------------------------------
-# Preseeding only locale sets language, country and locale.
-d-i debian-installer/locale string en_US
-
-# Disable automatic (interactive) keymap detection.
-d-i console-setup/ask_detect boolean false
-d-i keyboard-configuration/layoutcode string us
-
-d-i netcfg/get_hostname string osbash
-d-i netcfg/get_domain string unassigned-domain
-#-------------------------------------------------------------------------------
-# Proxy
-#d-i mirror/http/proxy string http://192.168.178.20:3128/
-d-i mirror/http/proxy string
-#-------------------------------------------------------------------------------
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-d-i time/zone string Etc/UTC
-#-------------------------------------------------------------------------------
-### Partitioning
-# The presently available methods are:
-# - regular: use the usual partition types for your architecture
-# - lvm: use LVM to partition the disk
-# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home: separate /home partition
-# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-#-------------------------------------------------------------------------------
-# To create a normal user account.
-d-i passwd/user-fullname string OpenStack user
-d-i passwd/username string osbash
-d-i passwd/user-password password osbash
-d-i passwd/user-password-again password osbash
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-#-------------------------------------------------------------------------------
-### Package selection
-tasksel tasksel/first minimal
-
-# Individual additional packages to install
-d-i pkgsel/include string openssh-server dkms localepurge
-
-# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
-### Pkg:localepurge
-# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
-localepurge localepurge/nopurge multiselect en_US
-# Really remove all locales?
-localepurge localepurge/none_selected boolean false
-# Also delete localized man pages?
-localepurge localepurge/mandelete boolean true
-# Avoid note that localepurge will not take any action until configured
-localepurge localepurge/remove_no note
-# Inform about new locales?
-localepurge localepurge/dontbothernew boolean false
-# Display verbose output?
-localepurge localepurge/verbose boolean false
-# Display freed disk space?
-localepurge localepurge/showfreedspace boolean true
-# Accurate disk space calculation?
-localepurge localepurge/quickndirtycalc boolean true
-# Use dpkg --path-exclude?
-localepurge localepurge/use-dpkg-feature bolean true
-#-------------------------------------------------------------------------------
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Policy for applying updates. May be "none" (no automatic updates),
-# "unattended-upgrades" (install security updates automatically), or
-# "landscape" (manage system with Landscape).
-d-i pkgsel/update-policy select none
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# Avoid warning about install CD not containing full support for language
-d-i pkgsel/install-language-support boolean false
-
-# Avoid reboot confirmation
-d-i finish-install/reboot_in_progress note
-
-d-i cdrom-detect/eject boolean true
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Use the following option to add additional boot parameters for the
-# installed system (if supported by the bootloader installer).
-# Note: options passed to the installer will be added automatically.
-
-# With Ubuntu 12.04 LTS, modesetting may result in a blank console
-d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
-#-------------------------------------------------------------------------------
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations!
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
-d-i preseed/late_command string echo "apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils; mount /dev/sr1 /mnt; /mnt/VBoxLinuxAdditions.run; umount /mnt; echo -e '#!/bin/bash\nexec > /root/bootstrap.log 2>&1\nset -x\nSCR=/media/sf_bootstrap/autostart/*activate_autostart.sh\nwhile [ ! -f \$SCR ];do sleep 1;done\nbash \$SCR\nrm -v \$SCR' > /etc/rc2.d/S40osbash; chmod 755 /etc/rc2.d/S40osbash;" | chroot /target /bin/bash;
diff --git a/labs/osbash/lib/osbash/templates/template-fedora-ifcfg-dhcp b/labs/osbash/lib/osbash/templates/template-fedora-ifcfg-dhcp
deleted file mode 100644
index 5b800ec8..00000000
--- a/labs/osbash/lib/osbash/templates/template-fedora-ifcfg-dhcp
+++ /dev/null
@@ -1,4 +0,0 @@
-# VirtualBox NAT -- for Internet access to VM
-DEVICE=%IF_NAME%
-ONBOOT=yes
-BOOTPROTO=dhcp
diff --git a/labs/osbash/lib/osbash/templates/template-fedora-ifcfg-static b/labs/osbash/lib/osbash/templates/template-fedora-ifcfg-static
deleted file mode 100644
index 0096a958..00000000
--- a/labs/osbash/lib/osbash/templates/template-fedora-ifcfg-static
+++ /dev/null
@@ -1,5 +0,0 @@
-DEVICE=%IF_NAME%
-ONBOOT=yes
-BOOTPROTO=none
-IPADDR=%IP_ADDRESS%
-NETMASK=255.255.255.0
diff --git a/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-dhcp b/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-dhcp
deleted file mode 100644
index 54928999..00000000
--- a/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-dhcp
+++ /dev/null
@@ -1,3 +0,0 @@
-# VirtualBox NAT -- for Internet access to VM
-auto %IF_NAME%
-iface %IF_NAME% inet dhcp
diff --git a/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-loopback b/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-loopback
deleted file mode 100644
index a6923a9d..00000000
--- a/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-loopback
+++ /dev/null
@@ -1,3 +0,0 @@
-# The loopback network interface
-auto lo
-iface lo inet loopback
diff --git a/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-manual b/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-manual
deleted file mode 100644
index 840b2ee2..00000000
--- a/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-manual
+++ /dev/null
@@ -1,4 +0,0 @@
-auto %IF_NAME%
-iface %IF_NAME% inet manual
-up ip link set dev $IFACE up
-down ip link set dev $IFACE down
diff --git a/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-static b/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-static
deleted file mode 100644
index 01c19476..00000000
--- a/labs/osbash/lib/osbash/templates/template-ubuntu-interfaces-static
+++ /dev/null
@@ -1,4 +0,0 @@
-auto %IF_NAME%
-iface %IF_NAME% inet static
- address %IP_ADDRESS%
- netmask 255.255.255.0
diff --git a/labs/osbash/lib/osbash/virtualbox-functions.sh b/labs/osbash/lib/osbash/virtualbox-functions.sh
deleted file mode 100644
index 3b74fcec..00000000
--- a/labs/osbash/lib/osbash/virtualbox-functions.sh
+++ /dev/null
@@ -1,857 +0,0 @@
-source "$CONFIG_DIR/provider.$PROVIDER"
-
-#-------------------------------------------------------------------------------
-# VirtualBoxManage
-#-------------------------------------------------------------------------------
-
-VBM=vbm
-: ${VBM_LOG:=$LOG_DIR/vbm.log}
-
-# vbm is a wrapper around the VirtualBox VBoxManage executable; it handles
-# logging and conditional execution (set OSBASH= to prevent the actual call to
-# VBoxManage, or WBATCH= to keep a call from being recorded for Windows batch
-# files)
-function vbm {
- ${WBATCH:-:} wbatch_log_vbm "$@"
-
- mkdir -p "$(dirname "$VBM_LOG")"
-
- if [[ -n "${OSBASH:-}" ]]; then
- echo "$@" >> "$VBM_LOG"
- local rc=0
- "$VBM_EXE" "$@" || rc=$?
- if [ $rc -ne 0 ]; then
- echo -e >&2 "${CError:-}FAILURE: VBoxManage: ${*}${CReset:-}"
- return 1
- fi
- else
- echo "(not executed) $@" >> "$VBM_LOG"
- fi
-}
-
-# Return VirtualBox version string (without distro extensions)
-function get_vb_version {
- local version=""
- # e.g. 4.1.32r92798 4.3.10_RPMFusionr93012 4.3.10_Debianr93012
- local raw=$(WBATCH= $VBM --version)
- # Sanitize version string
- local re='([0-9]+\.[0-9]+\.[0-9]+).*'
- if [[ $raw =~ $re ]]; then
- version=${BASH_REMATCH[1]}
- fi
- echo "$version"
-}
-
-#-------------------------------------------------------------------------------
-# VM status
-#-------------------------------------------------------------------------------
-
-function vm_exists {
- local vm_name=$1
- return $(WBATCH= $VBM list vms | grep -q "\"$vm_name\"")
-}
-
-function vm_is_running {
- local vm_name=$1
- return $(WBATCH= $VBM showvminfo --machinereadable "$vm_name" | \
- grep -q 'VMState="running"')
-}
-
-function vm_wait_for_shutdown {
- local vm_name=$1
-
- ${WBATCH:-:} wbatch_wait_poweroff "$vm_name"
- # Return if we are just faking it for wbatch
- ${OSBASH:+:} return 0
-
- echo -e >&2 -n "${CStatus:-}Machine shutting down${CReset:-}"
- until WBATCH= $VBM showvminfo --machinereadable "$vm_name" 2>/dev/null | \
- grep -q '="poweroff"'; do
- echo -n .
- sleep 1
- done
- echo >&2 -e "${CStatus:-}\nMachine powered off.${CReset:-}"
-}
-
-function vm_power_off {
- local vm_name=$1
- if vm_is_running "$vm_name"; then
- echo -e >&2 "${CStatus:-}Powering off VM ${CData:-}\"$vm_name\"${CReset:-}"
- $VBM controlvm "$vm_name" poweroff
- fi
- # VirtualBox VM needs a break before taking new commands
- conditional_sleep 1
-}
-
-function vm_acpi_shutdown {
- local vm_name=$1
- echo -e >&2 "${CStatus:-}ACPI shutdown for VM ${CData:-}\"$vm_name\"${CReset:-}"
- $VBM controlvm "$vm_name" acpipowerbutton
-
- # VirtualBox VM needs a break before taking new commands
- conditional_sleep 1
-}
-
-# Shut down all VMs in group VM_GROUP
-function stop_running_cluster_vms {
- local vm_id
-
- # Get VM ID from a line looking like this:
- # "My VM" {0a13e26d-9543-460d-82d6-625fa657b7c4}
- $VBM list runningvms | sed 's/.* {\(.*\)}/\1/' | while read vm_id; do
- if $VBM showvminfo --machinereadable "$vm_id" |
- grep -qe '^groups="/'$VM_GROUP; then
- # vm_id instead of vm_name works just as well
- vm_acpi_shutdown "$vm_id"
- vm_wait_for_shutdown "$vm_id"
- fi
- done
-}
-
-#-------------------------------------------------------------------------------
-# Snapshots
-#-------------------------------------------------------------------------------
-
-function vm_snapshot_list_tree {
- local vm_name=$1
-
- local rc
- # Hide VBM error message on stderr if no snapshots exist and proceed even
- # if exit status indicates error
- $VBM snapshot "$vm_name" list 2>/dev/null || rc=$?
-}
-
-function vm_snapshot_list {
- local vm_name=$1
-
- # Hide VBM error on stderr if no snapshots exist
- $VBM snapshot "$vm_name" list --machinereadable 2>/dev/null
-}
-
-function vm_snapshot_exists {
- local vm_name=$1
- local shot_name=$2
-
- vm_snapshot_list "$vm_name" | grep -q "SnapshotName.*=\"$shot_name\""
-}
-
-function vm_snapshot {
- local vm_name=$1
- local shot_name=$2
-
- $VBM snapshot "$vm_name" take "$shot_name"
- # VirtualBox VM needs a break before taking new commands
- conditional_sleep 1
-}
-
-function vm_snapshot_restore {
- local vm_name=$1
- local shot_name=$2
-
- $VBM snapshot "$vm_name" restore "$shot_name"
- # VirtualBox VM needs a break before taking new commands
- conditional_sleep 1
-}
-
-function vm_snapshot_restore_current {
- local vm_name=$1
-
- $VBM snapshot "$vm_name" restorecurrent
- # VirtualBox VM needs a break before taking new commands
- conditional_sleep 1
-}
-
-#-------------------------------------------------------------------------------
-# Host-only network functions
-#-------------------------------------------------------------------------------
-
-# Get ssh port from node name and wait for node to respond
-function ssh_env_for_node {
- local node=$1
-
- VM_SSH_PORT=$(source "$CONFIG_DIR/config.$node"; echo "$VM_SSH_PORT")
- SSH_IP=127.0.0.1
- if [ -n "${PXE_TMP_NODE_IP:-""}" ]; then
- SSH_IP=$PXE_TMP_NODE_IP
- SSH_PORT=22
- echo >&2 "PXE_TMP_NODE_IP is set -> SSH_IP=$SSH_IP, SSH_PORT=$SSH_PORT."
- fi
-}
-
-function hostonlyif_in_use {
- local if_name=$1
- return $(WBATCH= $VBM list -l runningvms | \
- grep -q "Host-only Interface '$if_name'")
-}
-
-function ip_to_hostonlyif {
- local ip=$1
- local prevline=""
- WBATCH= $VBM list hostonlyifs | grep -e "^Name:" -e "^IPAddress:" | \
- while read line; do
- if [[ "$line" == *$ip* ]]; then
- # match longest string that ends with a space
- echo ${prevline##Name:* }
- break
- fi
- prevline=$line
- done
-}
-
-function create_hostonlyif {
- local out=$(WBATCH= $VBM hostonlyif create 2> /dev/null | grep "^Interface")
- # out is something like "Interface 'vboxnet3' was successfully created"
- local re="Interface '(.*)' was successfully created"
- if [[ $out =~ $re ]]; then
- echo "${BASH_REMATCH[1]}"
- else
- echo -e >&2 "${CError:-}Host-only interface creation failed${CReset:-}"
- return 1
- fi
-}
-
-function fake_hostif {
- local numifs
- if [ "${NET_IFNAME[0]:-""}" = "" ]; then
- numifs=0
- else
- numifs=${#NET_IFNAME[@]}
- fi
- NET_IFNAME[index]="vboxnet${numifs}"
-}
-
-function create_network {
- local index=$1
- # The host-side interface is the default gateway of the network
- local if_ip=${NET_GW[index]}
-
- # If we are here only for wbatch, ignore actual network interfaces; just
- # return a vboxnetX identifier (so it can be replaced with the interface
- # name used by Windows).
- ${OSBASH:+:} fake_hostif
- ${OSBASH:+:} return 0
-
- local if_name=$(ip_to_hostonlyif "$if_ip")
- if [ -n "$if_name" ]; then
- if hostonlyif_in_use "$if_name"; then
- echo >&2 "Host-only interface $if_name ($if_ip) is in use." \
- "Using it, too."
- fi
- else
- echo -e >&2 "${CStatus:-}Creating host-only interface${CReset:-}"
- if_name=$(create_hostonlyif)
- fi
-
- echo -e >&2 "${CStatus:-}Configuring host-only network ${CData:-}$if_ip ($if_name)${CReset:-}"
- $VBM hostonlyif ipconfig "$if_name" \
- --ip "$if_ip" \
- --netmask 255.255.255.0 >/dev/null
- NET_IFNAME[index]=$if_name
-}
-
-#-------------------------------------------------------------------------------
-# Disk functions
-#-------------------------------------------------------------------------------
-
-function get_base_disk_path {
- echo "$DISK_DIR/$(get_base_disk_name).vdi"
-}
-
-function base_disk_exists {
- local base_disk_path=$(get_base_disk_path)
-
- test -f "$base_disk_path"
-}
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Creating, registering and unregistering disk images with VirtualBox
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# disk can be either a path or a disk UUID
-function disk_registered {
- local disk=$1
- return $(WBATCH= $VBM list hdds | grep -q "$disk")
-}
-
-# disk can be either a path or a disk UUID
-function disk_unregister {
- local disk=$1
- echo >&2 -e "${CStatus:-}Unregistering disk\n\t${CData:-}$disk${CReset:-}"
- $VBM closemedium disk "$disk"
-}
-
-function create_vdi {
- local hd_path=$1
- local size=$2
- echo >&2 -e "${CStatus:-}Creating disk:\n\t${CData:-}$hd_path${CReset:-}"
- $VBM createhd --format VDI --filename "$hd_path" --size "$size"
-}
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Attaching and detaching disks from VMs
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# disk can be either a path or a disk UUID
-function get_next_child_uuid {
- local disk=$1
- local child_uuid=""
- local line=""
- if disk_registered "$disk"; then
- line=$(WBATCH= $VBM showhdinfo "$disk" | grep -e "^Child UUIDs:")
- child_uuid=${line##Child UUIDs:* }
- fi
- echo -e "next_child_uuid $disk:\n\t$line\n\t$child_uuid" >> "$VBM_LOG"
- echo "$child_uuid"
-}
-
-# disk can be either a path or a disk UUID
-function path_to_disk_uuid {
- local disk=$1
- local uuid=""
- local line=$(WBATCH= $VBM showhdinfo "$disk" | grep -e "^UUID:")
- local re='UUID:[ ]+([^ ]+)'
- if [[ $line =~ $re ]]; then
- uuid=${BASH_REMATCH[1]}
- fi
- echo -e "path_to_disk_uuid $disk:\n\t$line\n\t$uuid" >> "$VBM_LOG"
- echo "$uuid"
-}
-
-# disk can be either a path or a disk UUID
-function disk_to_path {
- local disk=$1
- local fpath=""
- local line=$(WBATCH= $VBM showhdinfo "$disk" | grep -e "^Location:")
- local re='Location:[ ]+([^ ]+)'
- if [[ $line =~ $re ]]; then
- fpath=${BASH_REMATCH[1]}
- fi
- echo -e "disk_to_path $disk:\n\t$line\n\t$fpath" >> "$VBM_LOG"
- echo "$fpath"
-}
-
-# disk can be either a path or a disk UUID
-function disk_to_vm {
- local disk=$1
- local vm_name=""
- local line=$(WBATCH= $VBM showhdinfo "$disk" | grep -e "^In use by VMs:")
- local re='In use by VMs:[ ]+([^ ]+) '
- if [[ $line =~ $re ]]; then
- vm_name=${BASH_REMATCH[1]}
- fi
- echo -e "disk_to_vm $disk:\n\t$line\n\t$vm_name" >> "$VBM_LOG"
- echo "$vm_name"
-}
-
-function vm_get_disk_path {
- local vm_name=$1
- local line=$(WBATCH= $VBM showvminfo --machinereadable "$vm_name" | \
- grep '^"SATA-0-0"=.*vdi"$')
- local hd_path=${line##\"SATA-0-0\"=\"}
- hd_path=${hd_path%\"}
- echo "$hd_path"
-}
-
-function vm_detach_disk {
- local vm_name=$1
- local port=${2:-0}
- echo >&2 "Detaching disk from VM \"$vm_name\""
- $VBM storageattach "$vm_name" \
- --storagectl SATA \
- --port "$port" \
- --device 0 \
- --type hdd \
- --medium none
- # VirtualBox VM needs a break before taking new commands
- conditional_sleep 1
-}
-
-# disk can be either a path or a disk UUID
-function vm_attach_disk {
- local vm_name=$1
- local disk=$2
- local port=${3:-0}
- echo >&2 -e "Attaching to VM \"$vm_name\":\n\t$disk"
- $VBM storageattach "$vm_name" \
- --storagectl SATA \
- --port "$port" \
- --device 0 \
- --type hdd \
- --medium "$disk"
-}
-
-# disk can be either a path or a disk UUID
-function vm_attach_disk_multi {
- local vm_name=$1
- local disk=$2
- local port=${3:-0}
-
- $VBM modifyhd --type multiattach "$disk"
-
- echo >&2 -e "Attaching to VM \"$vm_name\":\n\t$disk"
- $VBM storageattach "$vm_name" \
- --storagectl SATA \
- --port "$port" \
- --device 0 \
- --type hdd \
- --medium "$disk"
-}
-
-function base_disk_delete {
- local base_disk_path=$(get_base_disk_path)
-
- if disk_registered "$base_disk_path"; then
- # Remove users of base disk
- echo >&2 "Unregistering and removing all disks attached to" \
- "base disk path."
- disk_delete_child_vms "$base_disk_path"
- echo >&2 "Unregistering old base disk."
- disk_unregister "$base_disk_path"
- fi
- echo -e >&2 "${CStatus:-}Removing old base disk.${CReset:-}"
- rm -f "$base_disk_path"
-}
-
-#-------------------------------------------------------------------------------
-# VM create and configure
-#-------------------------------------------------------------------------------
-
-function vm_mem {
- local vm_name="$1"
- local mem="$2"
- $VBM modifyvm "$vm_name" --memory "$mem"
-}
-
-function vm_cpus {
- local vm_name="$1"
- local cpus="$2"
- $VBM modifyvm "$vm_name" --cpus "$cpus"
-}
-
-# Port forwarding from host to VM (binding to host's 127.0.0.1)
-function vm_port {
- local vm_name="$1"
- local desc="$2"
- local hostport="$3"
- local guestport="$4"
- $VBM modifyvm "$vm_name" \
- --natpf1 "$desc,tcp,127.0.0.1,$hostport,,$guestport"
-}
-
-function netname_to_hostif {
- local netname=$1
-
- for index in "${!NET_NAME[@]}"; do
- if [ "$netname" = "${NET_NAME[index]}" ]; then
- echo "${NET_IFNAME[index]}"
- return 0
- fi
- done
-
- echo >&2 "ERROR: No host interface for network $netname. Exiting."
- exit 1
-}
-
-function vm_nic_base {
- local vm_name=$1
- # We start counting interfaces at 0, but VirtualBox starts NICs at 1
- local nic=$(($2 + 1))
- $VBM modifyvm "$vm_name" "--nictype$nic" "$NICTYPE" "--nic$nic" nat
-}
-
-function vm_nic_std {
- local vm_name=$1
- local index=$2
- # We start counting interfaces at 0, but VirtualBox starts NICs at 1
- local nic=$((index + 1))
- local netname=$(ip_to_netname "${NODE_IF_IP[index]}")
- local hostif=$(netname_to_hostif "$netname")
- $VBM modifyvm "$vm_name" \
- "--nictype$nic" "$NICTYPE" \
- "--nic$nic" hostonly \
- "--hostonlyadapter$nic" "$hostif" \
- "--nicpromisc$nic" allow-all
-}
-
-function vm_nic_set_boot_prio {
- local vm_name=$1
- local index=$2
- local prip=$3
- # We start counting interfaces at 0, but VirtualBox starts NICs at 1
- local nic=$((index + 1))
-
- $VBM modifyvm "$vm_name" "--nicbootprio$nic" "$3"
-}
-
-function vm_create {
- # NOTE: We assume that a VM with a matching name is ours.
- # Remove and recreate just in case someone messed with it.
- local vm_name=$1
-
- ${WBATCH:-:} wbatch_abort_if_vm_exists "$vm_name"
-
- # Don't write to wbatch scripts, and don't execute when we are faking it
- # it for wbatch
- WBATCH= ${OSBASH:-:} vm_delete "$vm_name"
-
- # XXX ostype is distro-specific; moving it to modifyvm disables networking
-
- # Note: The VirtualBox GUI may not notice group changes after VM creation
- # until GUI is restarted. Moving a VM with group membership will
- # fail in cases (lingering files from old VM) where creating a
- # VM in that location succeeds.
- #
- # XXX temporary hack
- # --groups not supported in VirtualBox 4.1 (Mac OS X 10.5)
- echo -e >&2 "${CStatus:-}Creating VM ${CData:-}\"$vm_name\"${CReset:-}"
- local ver=$(get_vb_version)
- if [[ $ver = 4.1* ]]; then
- $VBM createvm \
- --name "$vm_name" \
- --register \
- --ostype "$VBOX_OSTYPE" >/dev/null
- else
- $VBM createvm \
- --name "$vm_name" \
- --register \
- --ostype "$VBOX_OSTYPE" \
- --groups "/$VM_GROUP" >/dev/null
- fi
-
- if WBATCH= $VBM showvminfo --machinereadable "$vm_name" | \
- grep -q 'longmode="off"'; then
- echo -e >&2 "${CStatus:-}Nodes run 32-bit OS, enabling PAE.${CReset:-}"
- # Ubuntu 14.04 LTS i386 needs PAE
- $VBM modifyvm "$vm_name" --pae on
- fi
-
- $VBM modifyvm "$vm_name" --rtcuseutc on
- $VBM modifyvm "$vm_name" --biosbootmenu disabled
- $VBM modifyvm "$vm_name" --largepages on
- $VBM modifyvm "$vm_name" --boot1 disk
- $VBM modifyvm "$vm_name" --boot3 net
-
- # XXX temporary hack
- # --portcount not supported in VirtualBox 4.1 (Mac OS X 10.5)
- if [[ $ver == 4.1* ]]; then
- $VBM storagectl "$vm_name" --name SATA --add sata
- else
- # Enough ports for three disks
- $VBM storagectl "$vm_name" --name SATA --add sata --portcount 3
- fi
- $VBM storagectl "$vm_name" --name SATA --hostiocache on
-
- $VBM storagectl "$vm_name" --name IDE --add ide
- echo -e >&2 "${CStatus:-}Created VM ${CData:-}\"$vm_name\"${CReset:-}"
-}
-
-#-------------------------------------------------------------------------------
-# VM export
-#-------------------------------------------------------------------------------
-
-# Export node VMs to OVA package file
-function vm_export_ova {
- local ova_file=$1
- local nodes=$2
- echo >&2 "Removing shared folders for export"
- local -a share_paths
- local node
- for node in $nodes; do
- local share_path=$(vm_get_share_path "$node")
- share_paths+=("$share_path")
- if [ -n "$share_path" ]; then
- vm_rm_share "$node" "$SHARE_NAME"
- fi
- done
- rm -f "$ova_file"
- mkdir -pv "$IMG_DIR"
- $VBM export $nodes --output "$ova_file"
- echo >&2 "Appliance exported"
- echo >&2 "Reattaching shared folders"
- local ii=0
- for node in $nodes; do
- if [ -n "${share_paths[$ii]}" ]; then
- vm_add_share "$node" "${share_paths[$ii]}" "$SHARE_NAME"
- fi
- ii=$((ii + 1))
- done
-}
-
-# Export node VMs by cloning VMs to directory
-function vm_export_dir {
- local export_dir=$1
- local nodes=$2
-
- rm -rvf "$export_dir"
-
- for node in $nodes; do
- if vm_is_running "$node"; then
- echo "Powering off node VM $node."
- echo "$VBM controlvm $node poweroff"
- $VBM controlvm "$node" poweroff
- fi
- sleep 1
- local share_path=$(vm_get_share_path "$node")
- if [ -n "$share_path" ]; then
- echo >&2 "Removing shared folder for export"
- vm_rm_share "$node" "$SHARE_NAME"
- fi
- sleep 1
- echo "Exporting VM $node to $export_dir"
- # Use all: machineandchildren works only if --snapshot is given as UUID
- $VBM clonevm "$node" \
- --mode all \
- --options keepallmacs,keepdisknames \
- --name "$node-e" \
- --groups "/$VM_GROUP" \
- --basefolder "$export_dir" \
- --register
- # VirtualBox registers disks and snapshots of the clone VM even if we
- # don't register the VM above. Unregistering the registered VM takes
- # care of the snapshots, but we still have to unregister the clone
- # basedisk.
- local snapshot_path=$(vm_get_disk_path "$node-e")
- local hd_dir=${snapshot_path%Snapshots/*}
- local hd_path=$hd_dir$(get_base_disk_name).vdi
- $VBM unregistervm "$node-e"
- if [ -n "$hd_path" ]; then
- disk_unregister "$hd_path"
- fi
- if [ -n "$share_path" ]; then
- echo >&2 "Reattaching shared folder"
- vm_add_share "$node" "$share_path" "$SHARE_NAME"
- fi
- done
-}
-
-#-------------------------------------------------------------------------------
-# VM unregister, remove, delete
-#-------------------------------------------------------------------------------
-
-function vm_unregister_del {
- local vm_name=$1
- echo -e >&2 "${CStatus:-}Unregistering and deleting VM ${CData:-}\"$vm_name\"${CReset:-}"
- $VBM unregistervm "$vm_name" --delete
-}
-
-function vm_delete {
- local vm_name=$1
- echo >&2 -n "Asked to delete VM \"$vm_name\" "
- if vm_exists "$vm_name"; then
- echo >&2 "(found)"
- vm_power_off "$vm_name"
- local hd_path=$(vm_get_disk_path "$vm_name")
- if [ -n "$hd_path" ]; then
- echo >&2 -e "${CInfo:-}Disk attached: ${CData:-}$hd_path${CReset:-}"
- vm_detach_disk "$vm_name"
- disk_unregister "$hd_path"
- echo >&2 -e "Deleting: $hd_path"
- rm -f "$hd_path"
- fi
- vm_unregister_del "$vm_name"
- else
- echo >&2 "(not found)"
- fi
-}
-
-# Remove VMs using disk and its children disks
-# disk can be either a path or a disk UUID
-function disk_delete_child_vms {
- local disk=$1
- if ! disk_registered "$disk"; then
- # VirtualBox doesn't know this disk; we are done
- echo >&2 -e "${CError:-}Disk not registered with VirtualBox:\n\t${CData:-}$disk${CReset:-}"
- return 0
- fi
-
- # XXX temporary hack
- # No Child UUIDs through showhdinfo in VirtualBox 4.1 (Mac OS X 10.5)
- local ver=$(get_vb_version)
- if [[ $ver == 4.1* ]]; then
- local vm_name=""
- for vm_name in controller network compute base; do
- vm_delete "$vm_name"
- done
- return 0
- fi
-
- while : ; do
- local child_uuid=$(get_next_child_uuid "$disk")
- if [ -n "$child_uuid" ]; then
- local child_disk=$(disk_to_path "$child_uuid")
- echo >&2 -e "\nChild disk UUID: $child_uuid\n\t$child_disk"
-
- local vm_name=$(disk_to_vm "$child_uuid")
- if [ -n "$vm_name" ]; then
- echo 2>&1 -e "\tstill attached to VM \"$vm_name\""
- vm_delete "$vm_name"
- else
- echo -e >&2 "${CStatus:-}Unregistering and deleting: ${CData:-}$child_uuid${CReset:-}"
- disk_unregister "$child_uuid"
- echo >&2 -e "\t$child_disk"
- rm -f "$child_disk"
- fi
- else
- break
- fi
- done
-}
-
-#-------------------------------------------------------------------------------
-# VM shared folders
-#-------------------------------------------------------------------------------
-
-# Return the host path for a VM's shared directory; assumes there is only one.
-function vm_get_share_path {
- local vm_name=$1
- local line=$(WBATCH= $VBM showvminfo --machinereadable "$vm_name" | \
- grep '^SharedFolderPathMachineMapping1=')
- local share_path=${line##SharedFolderPathMachineMapping1=\"}
- share_path=${share_path%\"}
- echo "$share_path"
-}
-
-function vm_add_share_automount {
- local vm_name=$1
- local share_dir=$2
- local share_name=$3
- $VBM sharedfolder add "$vm_name" \
- --name "$share_name" \
- --hostpath "$share_dir" \
- --automount
-}
-
-function vm_add_share {
- local vm_name=$1
- local share_dir=$2
- local share_name=$3
- $VBM sharedfolder add "$vm_name" \
- --name "$share_name" \
- --hostpath "$share_dir"
-}
-
-function vm_rm_share {
- local vm_name=$1
- local share_name=$2
- $VBM sharedfolder remove "$vm_name" --name "$share_name"
-}
-
-#-------------------------------------------------------------------------------
-# VirtualBox guest add-ons
-#-------------------------------------------------------------------------------
-
-# Download VirtualBox guest-additions. Returns local path of ISO image.
-function _download_guestadd-iso {
- local iso=VBoxGuestAdditions.iso
- local ver=$(get_vb_version)
- if [[ -n "$ver" ]]; then
- local url="http://download.virtualbox.org/virtualbox/$ver/VBoxGuestAdditions_$ver.iso"
- download "$url" "$ISO_DIR" $iso
- fi
- echo "$ISO_DIR/$iso"
-}
-
-function _get_guestadd-iso {
- local iso=VBoxGuestAdditions.iso
-
- local add_iso="$IMG_DIR/$iso"
- if [ -f "$add_iso" ]; then
- echo "$add_iso"
- return 0
- fi
-
- add_iso="/Applications/VirtualBox.app/Contents/MacOS/$iso"
- if [ -f "$add_iso" ]; then
- echo "$add_iso"
- return 0
- fi
-
- echo >&2 "Searching filesystem for VBoxGuestAdditions. This may take a while..."
- add_iso=$(find / -name "$iso" 2>/dev/null) || true
- if [ -n "$add_iso" ]; then
- echo "$add_iso"
- return 0
- fi
-
- echo >&2 "Looking on the Internet"
- add_iso=$(_download_guestadd-iso)
- if [ -f "$add_iso" ]; then
- echo "$add_iso"
- return 0
- fi
-}
-
-function _vm_attach_guestadd-iso {
- local vm_name=$1
- local guestadd_iso=$2
- local rc=0
- $VBM storageattach "$vm_name" --storagectl IDE --port 1 --device 0 --type dvddrive --medium "$guestadd_iso" 2>/dev/null || rc=$?
- return $rc
-}
-
-function vm_attach_guestadd-iso {
- local vm_name=$1
-
- OSBASH= ${WBATCH:-:} _vm_attach_guestadd-iso "$vm_name" emptydrive
- OSBASH= ${WBATCH:-:} _vm_attach_guestadd-iso "$vm_name" additions
- # Return if we are just faking it for wbatch
- ${OSBASH:+:} return 0
-
- if [ -z "${GUESTADD_ISO-}" ]; then
-
- # No location provided, asking VirtualBox for one
-
- # An existing drive is needed to make additions shortcut work
- # (at least VirtualBox 4.3.12 and below)
- WBATCH= _vm_attach_guestadd-iso "$vm_name" emptydrive
-
- if WBATCH= _vm_attach_guestadd-iso "$vm_name" additions; then
- echo >&2 "Using VBoxGuestAdditions provided by VirtualBox"
- return 0
- fi
- # Neither user nor VirtualBox are helping, let's go guessing
- GUESTADD_ISO=$(_get_guestadd-iso)
- if [ -z "GUESTADD_ISO" ]; then
- # No ISO found
- return 2
- fi
- fi
- if WBATCH= _vm_attach_guestadd-iso "$vm_name" "$GUESTADD_ISO"; then
- echo >&2 "Attached $GUESTADD_ISO"
- return 0
- else
- echo -e >&2 "${CError:-}Failed to attach ${CData:-}$GUESTADD_ISO${CReset:-}"
- return 3
- fi
-}
-
-#-------------------------------------------------------------------------------
-# Booting a VM and passing boot parameters
-#-------------------------------------------------------------------------------
-
-source "$OSBASH_LIB_DIR/virtualbox-keycodes.sh"
-
-function _keyboard_push_scancode {
- local vm_name=$1
- shift
- # Split string (e.g. '01 81') into arguments (works also if we
- # get each hexbyte as a separate argument)
- # Not quoting $@ is intentional -- we want to split on blanks
- local scan_code=( $@ )
- $VBM controlvm "$vm_name" keyboardputscancode "${scan_code[@]}"
-}
-
-function vm_boot {
- local vm_name=$1
-
- echo -e >&2 "${CStatus:-}Starting VM ${CData:-}\"$vm_name\"${CReset:-}"
- if [ -n "${VM_UI:-}" ]; then
- $VBM startvm "$vm_name" --type "$VM_UI"
- else
- $VBM startvm "$vm_name"
- fi
-}
-
-#-------------------------------------------------------------------------------
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/virtualbox-install_base.sh b/labs/osbash/lib/osbash/virtualbox-install_base.sh
deleted file mode 100644
index 21aa09a1..00000000
--- a/labs/osbash/lib/osbash/virtualbox-install_base.sh
+++ /dev/null
@@ -1,134 +0,0 @@
-# This bash library contains the main function that creates the base disk.
-
-function vm_install_base {
- local base_disk_path=$(get_base_disk_path)
- local base_build_disk=$DISK_DIR/tmp-disk.vdi
- local vm_name=base
-
- echo >&2 "$(date) osbash vm_install starts."
-
- ${WBATCH:-:} wbatch_begin_base
-
- # Don't remove base_build_disk if we are just faking it for wbatch
- ${OSBASH:-:} rm -f "$base_build_disk"
- ${WBATCH:-:} wbatch_delete_disk "$base_build_disk"
-
- vm_create "$vm_name"
- (
- source "$CONFIG_DIR/config.$vm_name"
-
- vm_mem "$vm_name" "${VM_MEM}"
- )
-
- if [ -z "${INSTALL_ISO-}" ]; then
-
- if [ -z "$ISO_URL" ]; then
- echo -e >&2 "${CMissing:-}Either ISO URL or name needed (ISO_URL, INSTALL_ISO).${CReset:-}"
- exit 1
- fi
- # Don't look for ISO image if we are only doing wbatch
- ${OSBASH:-:} find_install-iso
-
- INSTALL_ISO=$ISO_DIR/$(get_iso_name)
- fi
-
- echo >&2 -e "${CInfo:-}Install ISO:\n\t${CData:-}$INSTALL_ISO${CReset:-}"
-
- ${OSBASH:-:} check_md5 "$INSTALL_ISO" "$ISO_MD5"
-
- $VBM storageattach "$vm_name" \
- --storagectl IDE \
- --port 0 \
- --device 0 \
- --type dvddrive \
- --medium "$INSTALL_ISO"
-
- ${WBATCH:-:} vm_attach_guestadd-iso "$vm_name"
-
- ${OSBASH:-:} mkdir -pv "$DISK_DIR"
- create_vdi "$base_build_disk" "${BASE_DISK_SIZE:=10000}"
- vm_attach_disk "$vm_name" "$base_build_disk"
-
- #---------------------------------------------------------------------------
- # Set up communication with base VM: ssh port forwarding by default,
- # VirtualBox shared folders for wbatch
-
- (
- # Get the VM_SSH_PORT for the base disk
- source "$CONFIG_DIR/config.$vm_name"
-
- # wbatch runs cannot use ssh, so skip port forwarding in that case
- ${WBATCH:+:} vm_port "$vm_name" ssh "$VM_SSH_PORT" 22
- )
-
- # Automounted on /media/sf_bootstrap for first boot
- ${WBATCH:-:} vm_add_share_automount "$vm_name" "$SHARE_DIR" bootstrap
- # Mounted on /$SHARE_NAME after first boot
- ${WBATCH:-:} vm_add_share "$vm_name" "$SHARE_DIR" "$SHARE_NAME"
- #---------------------------------------------------------------------------
-
- $VBM modifyvm "$vm_name" --boot1 dvd
- $VBM modifyvm "$vm_name" --boot2 disk
-
- # Configure autostart
- autostart_reset
-
- # For wbatch, install osbashauto as a boot service
- ${WBATCH:-:} autostart osbash/activate_autostart.sh
-
- autostart osbash/base_fixups.sh
-
- # By default, set by lib/osbash/lib.* to something like scripts.ubuntu_base
- autostart_from_config "$BASE_INSTALL_SCRIPTS"
-
- autostart zero_empty.sh shutdown.sh
-
- # Boot VM into distribution installer
- vm_boot "$vm_name"
-
- # Note: It takes about 5 seconds for the installer in the VM to be ready
- # on a fairly typical laptop. If we don't wait long enough, the
- # installation will fail. Ideally, we would have a different method
- # of making sure the installer is ready. For now, we just have to
- # try and err on the side of caution.
- local delay=10
- echo >&2 "Waiting $delay seconds for VM \"$vm_name\" to come up"
- conditional_sleep "$delay"
-
- distro_start_installer "$vm_name"
-
- echo -e >&2 "${CStatus:-}Installing operating system; waiting for reboot${CReset:-}"
-
- # Wait for ssh connection and execute scripts in autostart directory
- # (for wbatch, osbashauto does the processing instead)
- ${WBATCH:+:} ssh_process_autostart "$vm_name" &
- # After reboot
- wait_for_autofiles
- echo -e >&2 "${CStatus:-}Installation done for VM ${CData:-}$vm_name${CReset:-}"
-
- vm_wait_for_shutdown "$vm_name"
-
- # Detach disk from VM now or it will be deleted by vm_unregister_del
- vm_detach_disk "$vm_name"
-
- vm_unregister_del "$vm_name"
-
- echo >&2 "Compacting $base_build_disk"
- $VBM modifyhd "$base_build_disk" --compact
-
- # This disk will be moved to a new name, and this name will be used for
- # a new disk next time the script runs.
- disk_unregister "$base_build_disk"
-
- echo -e >&2 "${CStatus:-}Base disk created${CReset:-}"
-
- echo >&2 "Moving base disk to $base_disk_path"
- ${OSBASH:-:} mv -vf "$base_build_disk" "$base_disk_path"
- ${WBATCH:-:} wbatch_rename_disk "$base_build_disk" "$base_disk_path"
-
- ${WBATCH:-:} wbatch_end_file
-
- echo >&2 -e "${CData:-}$(date) ${CStatus:-}osbash vm_install ends\n${CReset:-}"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/virtualbox-install_nodes.sh b/labs/osbash/lib/osbash/virtualbox-install_nodes.sh
deleted file mode 100644
index 74ed039b..00000000
--- a/labs/osbash/lib/osbash/virtualbox-install_nodes.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-# This bash library contains the main function that creates a node VM.
-
-# Boot node VM; wait until autostart files are processed
-function _vm_boot_with_autostart {
- local vm_name=$1
-
- vm_boot "$vm_name"
-
- # Wait for ssh connection and execute scripts in autostart directory
- # (for wbatch, osbashauto does the processing instead)
- ${WBATCH:+:} ssh_process_autostart "$vm_name" &
-
- wait_for_autofiles
- echo >&2 "VM \"$vm_name\": autostart files executed"
-}
-
-# Create a new node VM
-function vm_create_node {
- # XXX Run this function in sub-shell to protect our caller's environment
- # (which might be _our_ environment if we get called again)
- (
- source "$CONFIG_DIR/config.$vm_name"
-
- vm_name=$1
-
- vm_create "$vm_name"
-
- # Set VM_MEM in config/config.NODE_NAME to override
- vm_mem "$vm_name" "${VM_MEM:-512}"
-
- # Set VM_CPUS in config/config.NODE_NAME to override
- vm_cpus "$vm_name" "${VM_CPUS:-1}"
-
- configure_node_netifs "$vm_name"
-
- # Port forwarding
- if [ -n "${VM_SSH_PORT:-}" ]; then
- vm_port "$vm_name" ssh "$VM_SSH_PORT" 22
- fi
- if [ -n "${VM_WWW_PORT:-}" ]; then
- vm_port "$vm_name" http "$VM_WWW_PORT" 80
- fi
-
- vm_add_share "$vm_name" "$SHARE_DIR" "$SHARE_NAME"
-
- if [ "${FIRST_DISK_SIZE:-0}" -gt 0 ]; then
- # Used for PXE build (does not use basedisk)
- local first_disk_path=$DISK_DIR/$vm_name-sda.vdi
- create_vdi "$first_disk_path" "${FIRST_DISK_SIZE}"
- # Port 0 is default
- vm_attach_disk "$vm_name" "$first_disk_path"
- else
- # Use copy-on-write disk over basedisk
- vm_attach_disk_multi "$vm_name" "$(get_base_disk_path)"
- fi
-
- if [ "${SECOND_DISK_SIZE:-0}" -gt 0 ]; then
- local second_disk_path=$DISK_DIR/$vm_name-sdb.vdi
- create_vdi "$second_disk_path" "${SECOND_DISK_SIZE}"
- # Use port 1
- vm_attach_disk "$vm_name" "$second_disk_path" 1
- fi
- )
-}
-
-function vm_build_nodes {
- CONFIG_NAME=$(get_distro_name "$DISTRO")_$1
- echo -e "${CInfo:-}Configuration file: ${CData:-}$CONFIG_NAME${CReset:-}"
-
- ${WBATCH:-:} wbatch_begin_node "$CONFIG_NAME"
- #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- autostart_reset
- autostart_from_config "scripts.$CONFIG_NAME"
- #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- ${WBATCH:-:} wbatch_end_file
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/osbash/virtualbox-keycodes.sh b/labs/osbash/lib/osbash/virtualbox-keycodes.sh
deleted file mode 100644
index 8c040731..00000000
--- a/labs/osbash/lib/osbash/virtualbox-keycodes.sh
+++ /dev/null
@@ -1,310 +0,0 @@
-# The functions in this library are used to get scancode strings for VirtualBox
-# keyboard input (keyboardputscancode).
-#
-# It was generated mostly from output of Cameron Kerr's scancodes.l:
-# http://humbledown.org/keyboard-scancodes.xhtml
-#
-# The library works with bash 3.2 (shipped with Mac OS X as of 2014).
-
-function char2scancode {
- local key=$1
- case "$key" in
- 'a')
- echo -n " 1e 9e"
- ;;
- 'b')
- echo -n " 30 b0"
- ;;
- 'c')
- echo -n " 2e ae"
- ;;
- 'd')
- echo -n " 20 a0"
- ;;
- 'e')
- echo -n " 12 92"
- ;;
- 'f')
- echo -n " 21 a1"
- ;;
- 'g')
- echo -n " 22 a2"
- ;;
- 'h')
- echo -n " 23 a3"
- ;;
- 'i')
- echo -n " 17 97"
- ;;
- 'j')
- echo -n " 24 a4"
- ;;
- 'k')
- echo -n " 25 a5"
- ;;
- 'l')
- echo -n " 26 a6"
- ;;
- 'm')
- echo -n " 32 b2"
- ;;
- 'n')
- echo -n " 31 b1"
- ;;
- 'o')
- echo -n " 18 98"
- ;;
- 'p')
- echo -n " 19 99"
- ;;
- 'q')
- echo -n " 10 90"
- ;;
- 'r')
- echo -n " 13 93"
- ;;
- 's')
- echo -n " 1f 9f"
- ;;
- 't')
- echo -n " 14 94"
- ;;
- 'u')
- echo -n " 16 96"
- ;;
- 'v')
- echo -n " 2f af"
- ;;
- 'w')
- echo -n " 11 91"
- ;;
- 'x')
- echo -n " 2d ad"
- ;;
- 'y')
- echo -n " 15 95"
- ;;
- 'z')
- echo -n " 2c ac"
- ;;
- 'A')
- echo -n " 2a 1e 9e aa"
- ;;
- 'B')
- echo -n " 2a 30 b0 aa"
- ;;
- 'C')
- echo -n " 2a 2e ae aa"
- ;;
- 'D')
- echo -n " 2a 20 a0 aa"
- ;;
- 'E')
- echo -n " 2a 12 92 aa"
- ;;
- 'F')
- echo -n " 2a 21 a1 aa"
- ;;
- 'G')
- echo -n " 2a 22 a2 aa"
- ;;
- 'H')
- echo -n " 2a 23 a3 aa"
- ;;
- 'I')
- echo -n " 2a 17 97 aa"
- ;;
- 'J')
- echo -n " 2a 24 a4 aa"
- ;;
- 'K')
- echo -n " 2a 25 a5 aa"
- ;;
- 'L')
- echo -n " 2a 26 a6 aa"
- ;;
- 'M')
- echo -n " 2a 32 b2 aa"
- ;;
- 'N')
- echo -n " 2a 31 b1 aa"
- ;;
- 'O')
- echo -n " 2a 18 98 aa"
- ;;
- 'P')
- echo -n " 2a 19 99 aa"
- ;;
- 'Q')
- echo -n " 2a 10 90 aa"
- ;;
- 'R')
- echo -n " 2a 13 93 aa"
- ;;
- 'S')
- echo -n " 2a 1f 9f aa"
- ;;
- 'T')
- echo -n " 2a 14 94 aa"
- ;;
- 'U')
- echo -n " 2a 16 96 aa"
- ;;
- 'V')
- echo -n " 2a 2f af aa"
- ;;
- 'W')
- echo -n " 2a 11 91 aa"
- ;;
- 'X')
- echo -n " 2a 2d ad aa"
- ;;
- 'Z')
- echo -n " 2a 2c ac aa"
- ;;
- 'Y')
- echo -n " 2a 15 95 aa"
- ;;
- '1')
- echo -n " 02 82"
- ;;
- '2')
- echo -n " 03 83"
- ;;
- '3')
- echo -n " 04 84"
- ;;
- '4')
- echo -n " 05 85"
- ;;
- '5')
- echo -n " 06 86"
- ;;
- '6')
- echo -n " 07 87"
- ;;
- '7')
- echo -n " 08 88"
- ;;
- '8')
- echo -n " 09 89"
- ;;
- '9')
- echo -n " 0a 8a"
- ;;
- '0')
- echo -n " 0b 8b"
- ;;
- '!')
- echo -n " 2a 02 82 aa"
- ;;
- '@')
- echo -n " 2a 03 83 aa"
- ;;
- '#')
- echo -n " 2a 04 84 aa"
- ;;
- '$')
- echo -n " 2a 05 85 aa"
- ;;
- '%')
- echo -n " 2a 06 86 aa"
- ;;
- '^')
- echo -n " 2a 07 87 aa"
- ;;
- '&')
- echo -n " 2a 08 88 aa"
- ;;
- '*')
- echo -n " 2a 09 89 aa"
- ;;
- '(')
- echo -n " 2a 0a 8a aa"
- ;;
- ')')
- echo -n " 2a 0b 8b aa"
- ;;
- '-')
- echo -n " 0c 8c"
- ;;
- '_')
- echo -n " 2a 0c 8c aa"
- ;;
- '=')
- echo -n " 0d 8d"
- ;;
- '+')
- echo -n " 2a 0d 8d aa"
- ;;
- ' ')
- echo -n " 39 b9"
- ;;
- '[')
- echo -n " 1a 9a"
- ;;
- ']')
- echo -n " 1b 9b"
- ;;
- '{')
- echo -n " 2a 1a 9a aa"
- ;;
- '}')
- echo -n " 2a 1b 9b aa"
- ;;
- ';')
- echo -n " 27 a7"
- ;;
- ':')
- echo -n " 2a 27 a7 aa"
- ;;
- ',')
- echo -n " 33 b3"
- ;;
- '.')
- echo -n " 34 b4"
- ;;
- '/')
- echo -n " 35 b5"
- ;;
- '\')
- echo -n " 2b ab"
- ;;
- '|')
- echo -n " 2a 2b ab aa"
- ;;
- '?')
- echo -n " 2a 35 b5 aa"
- ;;
- '"')
- echo -n " 2a 28 a8 aa"
- ;;
- "'")
- echo -n " 28 a8"
- ;;
- ">")
- echo -n " 2a 34 b4 aa"
- ;;
- "<")
- echo -n " 2a 33 b3 aa"
- ;;
- esac
-}
-
-function esc2scancode {
- echo -n " 01 81"
-}
-
-function enter2scancode {
- echo -n " 1c 9c"
-}
-
-function backspace2scancode {
- echo -n " 0e 8e"
-}
-
-function f6_2scancode {
- echo -n " 40 c0"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/wbatch/README.rst b/labs/osbash/lib/wbatch/README.rst
deleted file mode 100644
index 03423220..00000000
--- a/labs/osbash/lib/wbatch/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-The files in this directory are used to create Windows batch scripts that
-can build base disks and VM clusters.
diff --git a/labs/osbash/lib/wbatch/batch_for_windows.sh b/labs/osbash/lib/wbatch/batch_for_windows.sh
deleted file mode 100644
index 3dc499e0..00000000
--- a/labs/osbash/lib/wbatch/batch_for_windows.sh
+++ /dev/null
@@ -1,297 +0,0 @@
-# This bash library contains the functions that allow osbash to produce
-# Windows batch files.
-
-: ${WBATCH_DIR:="$TOP_DIR/wbatch"}
-
-# By default, Windows batch file templates are in the same directory as this
-# file
-: ${WBATCH_TEMPLATE_DIR:=$(dirname "$BASH_SOURCE")}
-
-# wbatch cannot use ssh for talking to the VM; install VirtualBox guest
-# additions
-VM_ACCESS=vbadd
-
-# With VirtualBox 5.1.6, console type "headless" often gives no access to the
-# VM console which on Windows is the main method for interacting with the
-# cluster. Use "separate" which works at least on 5.0.26 and 5.1.6.
-VM_UI=separate
-
-#-------------------------------------------------------------------------------
-# Helper functions
-#-------------------------------------------------------------------------------
-
-# See functions.host for definition and explanation of exec_cmd
-WBATCH=exec_cmd
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-function wbatch_reset {
- clean_dir "$WBATCH_DIR"
- cp -v "$WBATCH_TEMPLATE_DIR/config_bat" "$WBATCH_DIR/config.bat"
-}
-
-function wbatch_new_file {
- local file_name=$1
- mkdir -p "$WBATCH_DIR"
- WBATCH_OUT="$WBATCH_DIR/$file_name"
- echo -n > "$WBATCH_OUT"
-}
-
-function wbatch_close_file {
- unset WBATCH_OUT
-}
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-function wbatch_write_line {
- if [ -n "${WBATCH_OUT:-}" ]; then
- # Don't expand backslash escapes except for ending the line with CRLF
- #
- # Note: Windows batch scripts with LF may seem to work, but (for
- # instance) jump labels don't work properly
- echo -n "$@" >> "$WBATCH_OUT"
- echo -e "\r" >> "$WBATCH_OUT"
- fi
-}
-
-function wbatch_write_stdin {
- local line=""
-
- # Set IFS to preserve leading whitespace
- while IFS= read -r line; do
- wbatch_write_line "$line"
- done
-}
-
-function wbatch_echo {
- wbatch_write_line "ECHO %time% $@"
-}
-
-#-------------------------------------------------------------------------------
-# Batch function calls
-#-------------------------------------------------------------------------------
-
-function wbatch_abort_if_vm_exists {
- local vm_name=$1
- wbatch_write_line "CALL :vm_exists $vm_name"
-}
-
-function wbatch_wait_poweroff {
- local vm_name=$1
- cat << WBAT | wbatch_write_stdin
-ECHO %time% Waiting for VM $vm_name to power off.
-CALL :wait_poweroff $vm_name
-ECHO %time% VM $vm_name powered off.
-WBAT
-}
-
-function wbatch_wait_auto {
- cat << WBAT | wbatch_write_stdin
-ECHO %time% Waiting for autostart files to execute.
-CALL :wait_auto
-ECHO %time% All autostart files executed.
-WBAT
-}
-
-#-------------------------------------------------------------------------------
-# Batch commands
-#-------------------------------------------------------------------------------
-
-function wbatch_delete_disk {
- local disk=$(basename "$1")
- wbatch_write_line "IF EXIST %IMGDIR%\\$disk DEL %IMGDIR%\\$disk"
-}
-
-function wbatch_rename_disk {
- local src=$(basename "$1")
- local target=$(basename "$2")
-
- wbatch_write_line "MOVE /y %IMGDIR%\\$src %IMGDIR%\\$target"
-}
-
-function wbatch_cp_auto {
- local src=$(wbatch_path_to_windows "$1")
- local target=$(basename "$2")
- src=${src//\//\\}
- wbatch_write_line "COPY %TOPDIR%\\$src %AUTODIR%\\$target"
-}
-
-function wbatch_sleep {
- local sec=$1
- wbatch_write_line "TIMEOUT /T $sec /NOBREAK"
-}
-
-#-------------------------------------------------------------------------------
-# Templated parts
-#-------------------------------------------------------------------------------
-
-# Note: BSD and GNU sed behavior is different. Don't try anything fancy
-# like inserting \r or in-place editing (-i).
-
-function wbatch_file_header {
- local product=$1
-
- sed -e "
- s,%PRODUCT%,$product,g;
- " "$WBATCH_TEMPLATE_DIR/template-file_header_bat" | wbatch_write_stdin
-}
-
-function wbatch_end_file {
- cat "$WBATCH_TEMPLATE_DIR/template-end_file_bat" | wbatch_write_stdin
- wbatch_close_file
-}
-
-function wbatch_elevate_privileges {
- cat "$WBATCH_TEMPLATE_DIR/template-elevate_privs_bat" | wbatch_write_stdin
-}
-
-function wbatch_find_vbm {
- cat "$WBATCH_TEMPLATE_DIR/template-find_vbm_bat" | wbatch_write_stdin
-}
-
-function wbatch_mkdirs {
- local autodir=$(wbatch_path_to_windows "$AUTOSTART_DIR")
- local imgdir=$(wbatch_path_to_windows "$IMG_DIR")
- local logdir=$(wbatch_path_to_windows "$LOG_DIR")
- local statusdir=$(wbatch_path_to_windows "$STATUS_DIR")
-
- autodir=$(wbatch_escape_backslash "$autodir")
- imgdir=$(wbatch_escape_backslash "$imgdir")
- logdir=$(wbatch_escape_backslash "$logdir")
- statusdir=$(wbatch_escape_backslash "$statusdir")
-
- sed -e "
- s,%P_AUTODIR%,$autodir,g;
- s,%P_IMGDIR%,$imgdir,g;
- s,%P_LOGDIR%,$logdir,g;
- s,%P_STATUSDIR%,$statusdir,g;
- " "$WBATCH_TEMPLATE_DIR/template-mkdirs_bat" | wbatch_write_stdin
-}
-
-function wbatch_create_hostnet {
- wbatch_new_file "create_hostnet.bat"
- wbatch_file_header "host-only networks"
- cat "$WBATCH_TEMPLATE_DIR/template-begin_hostnet_bat" | wbatch_write_stdin
- # Creating networks requires elevated privileges
- wbatch_elevate_privileges
- wbatch_find_vbm
-
- local index
- local if_name
- local win_adapter
- for index in "${!NET_NAME[@]}"; do
- if_name=${NET_IFNAME[index]}
- # The host-side interface is the default gateway of the network
- if_ip=${NET_GW[index]}
- # Translate if_name to Windows-type interface name
- win_adapter=$if_name
- sed -e "
- s,%IFNAME%,${win_adapter},g;
- s,%IFIP%,${if_ip},g;
- " "$WBATCH_TEMPLATE_DIR/template-create_hostnet_bat" | wbatch_write_stdin
- echo | wbatch_write_stdin
- done
-
- wbatch_end_file
-}
-
-function wbatch_begin_base {
- local iso_name=$(get_iso_name)
-
- if [ -z "$iso_name" ]; then
- echo >&2 "Windows batch file needs install ISO URL (ISO_URL)."
- exit 1
- fi
-
- wbatch_new_file "create_base.bat"
- wbatch_file_header "base disk"
- wbatch_find_vbm
- wbatch_mkdirs
-
- sed -e "
- s,%INSTALLFILE%,$iso_name,g;
- s,%ISOURL%,$ISO_URL,g;
- " "$WBATCH_TEMPLATE_DIR/template-begin_base_bat" | wbatch_write_stdin
-}
-
-function wbatch_begin_node {
- local node_name=$1
- wbatch_new_file "create_${node_name}_node.bat"
- wbatch_file_header "$node_name VM"
- wbatch_find_vbm
- wbatch_mkdirs
-
- local basedisk=$(get_base_disk_name).vdi
-
- sed -e "
- s,%BASEDISK%,$basedisk,g;
- " "$WBATCH_TEMPLATE_DIR/template-begin_node_bat" | wbatch_write_stdin
-}
-
-#-------------------------------------------------------------------------------
-# VBoxManage call handling
-#-------------------------------------------------------------------------------
-
-function wbatch_log_vbm {
- ARGS=( "$@" )
- for i in "${!ARGS[@]}"; do
- case "${ARGS[i]}" in
- --hostonlyadapter*)
- # The next arg is the host-only interface name -> change it
- ARGS[i+1]=\"%${ARGS[i+1]}%\"
- ;;
- --hostpath)
- # The next arg is the shared dir -> change it
- ARGS[i+1]='%SHAREDIR%'
- continue
- ;;
- esac
-
- # On Windows, ISO and base disk images must be in IMGDIR
- re='\.(iso|vdi)$'
- if [[ "${ARGS[i]}" =~ $re ]]; then
- local img_name=$(basename "${ARGS[i]}")
- ARGS[i]="%IMGDIR%\\$img_name"
- continue
- fi
- done
-
- # Echo what we are about to do
- wbatch_write_line "ECHO VBoxManage ${ARGS[@]}"
-
- wbatch_write_line "\"%VBM%\" ${ARGS[@]}"
-
- # Abort if VBoxManage call raised errorlevel
- wbatch_write_line "IF %errorlevel% NEQ 0 GOTO :vbm_error"
-
- # Blank line for readability
- wbatch_write_line ""
-}
-
-#-------------------------------------------------------------------------------
-# Windows path name helpers
-#-------------------------------------------------------------------------------
-
-# On Windows, all paths are relative to TOP_DIR
-function wbatch_path_to_windows {
- local full_path=$1
- # strip off ${TOP_DIR}/
- full_path="${full_path/$TOP_DIR\//}"
- full_path=$(wbatch_slash_to_backslash "$full_path")
- echo "$full_path"
-}
-
-# Escape backslashes in (path) variables that are given to sed
-function wbatch_escape_backslash {
- local string=$1
- string="${string//\\/\\\\}"
- echo "$string"
-}
-
-function wbatch_slash_to_backslash {
- local some_path=$1
- some_path="${some_path//\//\\}"
- echo "$some_path"
-}
-
-# vim: set ai ts=4 sw=4 et ft=sh:
diff --git a/labs/osbash/lib/wbatch/config_bat b/labs/osbash/lib/wbatch/config_bat
deleted file mode 100644
index ac9c6231..00000000
--- a/labs/osbash/lib/wbatch/config_bat
+++ /dev/null
@@ -1,6 +0,0 @@
-REM Default path for VBoxManage
-REM Example setting:
-REM SET VBM=C:\Program Files\Oracle\VirtualBox\VBoxManage.exe
-SET VBM=%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe
-
-REM vim: set ai ts=4 sw=4 et ft=dosbatch:
diff --git a/labs/osbash/lib/wbatch/template-begin_base_bat b/labs/osbash/lib/wbatch/template-begin_base_bat
deleted file mode 100644
index 33d558c9..00000000
--- a/labs/osbash/lib/wbatch/template-begin_base_bat
+++ /dev/null
@@ -1,37 +0,0 @@
-ECHO %time% Cleaning up autostart and log directories
-DEL /S /Q %AUTODIR%
-DEL /S /Q %LOGDIR%
-
-ECHO %time% Looking for %IMGDIR%\%INSTALLFILE%
-IF EXIST %IMGDIR%\%INSTALLFILE% goto got_install_iso
-
-ECHO.
-ECHO %INSTALLFILE% not found in %IMGDIR%.
-ECHO.
-ECHO Trying to download the install ISO from
-ECHO %ISOURL%
-ECHO.
-ECHO Expect this to take several minutes or longer, depending on your
-ECHO Internet connection.
-ECHO.
-cscript /nologo %TOOLSDIR%\downloader.js %ISOURL%
-RENAME downloaded.bin %INSTALLFILE%
-MOVE %INSTALLFILE% %IMGDIR%
-IF EXIST %IMGDIR%\%INSTALLFILE% goto got_install_iso
-ECHO.
-ECHO %INSTALLFILE% still not found in %IMGDIR%.
-ECHO Aborting.
-ECHO.
-
-goto :terminate
-
-:got_install_iso
-ECHO.
-ECHO %time% Found %IMGDIR%\%INSTALLFILE%
-ECHO.
-ECHO %time% Initialization done. Hit any key to continue.
-ECHO.
-PAUSE
-
-REM vim: set ai ts=4 sw=4 et ft=dosbatch:
-
diff --git a/labs/osbash/lib/wbatch/template-begin_hostnet_bat b/labs/osbash/lib/wbatch/template-begin_hostnet_bat
deleted file mode 100644
index 032e87cb..00000000
--- a/labs/osbash/lib/wbatch/template-begin_hostnet_bat
+++ /dev/null
@@ -1,6 +0,0 @@
-ECHO %time% Deleting old iface_config.bat
-IF EXIST "%~dp0\iface_config.bat" DEL "%~dp0\iface_config.bat"
-ECHO.
-
-REM vim: set ai ts=4 sw=4 et ft=dosbatch:
-
diff --git a/labs/osbash/lib/wbatch/template-begin_node_bat b/labs/osbash/lib/wbatch/template-begin_node_bat
deleted file mode 100644
index a7d8d8eb..00000000
--- a/labs/osbash/lib/wbatch/template-begin_node_bat
+++ /dev/null
@@ -1,26 +0,0 @@
-ECHO %time% Loading network interface names
-CALL "%~dp0\iface_config.bat"
-
-ECHO %time% Cleaning up autostart and log directories
-DEL /S /Q %AUTODIR%
-DEL /S /Q %LOGDIR%
-
-ECHO %time% Looking for %IMGDIR%\%BASEDISK%
-IF EXIST %IMGDIR%\%BASEDISK% goto got_base_disk
-ECHO.
-ECHO %BASEDISK% not found in %IMGDIR%.
-ECHO.
-ECHO You need to build a base disk before you can create node VMs.
-ECHO.
-goto :terminate
-
-:got_base_disk
-ECHO.
-ECHO %time% Found %IMGDIR%\%BASEDISK%
-ECHO.
-ECHO %time% Initialization done. Hit any key to continue.
-ECHO.
-PAUSE
-
-REM vim: set ai ts=4 sw=4 et ft=dosbatch:
-
diff --git a/labs/osbash/lib/wbatch/template-create_hostnet_bat b/labs/osbash/lib/wbatch/template-create_hostnet_bat
deleted file mode 100644
index 6257dfcf..00000000
--- a/labs/osbash/lib/wbatch/template-create_hostnet_bat
+++ /dev/null
@@ -1,12 +0,0 @@
-REM Using "'" as a delimiter, the second token is the name of the VirtualBox
-REM Ethernet interface
-FOR /F "tokens=2 delims='" %%A IN ('"%VBM%" hostonlyif create') DO SET IFACE=%%A
-IF %errorlevel% NEQ 0 GOTO :vbm_error
-ECHO SET %IFNAME%=%IFACE%
-SET %IFNAME%=%IFACE%
-ECHO SET %IFNAME%=%IFACE%>> "%~dp0\iface_config.bat"
-
-ECHO VBoxManage hostonlyif ipconfig "%%IFNAME%%" --ip %IFIP% --netmask 255.255.255.0
-"%VBM%" hostonlyif ipconfig "%%IFNAME%%" --ip %IFIP% --netmask 255.255.255.0
-
-REM vim: set ai ts=4 sw=4 et ft=dosbatch:
diff --git a/labs/osbash/lib/wbatch/template-elevate_privs_bat b/labs/osbash/lib/wbatch/template-elevate_privs_bat
deleted file mode 100644
index e6df3632..00000000
--- a/labs/osbash/lib/wbatch/template-elevate_privs_bat
+++ /dev/null
@@ -1,26 +0,0 @@
-REM Elevate credentials, code courtesy of Matthew Newton
-REM http://blog.mnewton.com/articles/Windows-Installer-Batch-Script-Revisited.html
-REM Check for permissions
->nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
-
-REM If error flag set, we do not have admin.
-if '%errorlevel%' NEQ '0' (
- echo Requesting administrative privileges...
- goto UACPrompt
-) else ( goto gotAdmin )
-
-
-:UACPrompt
- echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
- echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
-
- "%temp%\getadmin.vbs"
- REM we are done, exiting recursive call
- exit /B
-
-:gotAdmin
- if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
- echo We have admin privileges, proceeding...
-
-REM vim: set ai ts=4 sw=4 et ft=dosbatch:
-
diff --git a/labs/osbash/lib/wbatch/template-end_file_bat b/labs/osbash/lib/wbatch/template-end_file_bat
deleted file mode 100644
index 43472399..00000000
--- a/labs/osbash/lib/wbatch/template-end_file_bat
+++ /dev/null
@@ -1,59 +0,0 @@
-ECHO.
-ECHO %time% Batch script seems to have succeeded.
-ECHO.
-
-GOTO :terminate
-
-REM Note: vbm_error falls through to terminate
-:vbm_error
-ECHO.
-ECHO %time% VBoxManage returned with an error. Aborting.
-ECHO.
-
-:terminate
-ENDLOCAL
-PAUSE
-EXIT
-GOTO :eof
-
-REM ============================================================================
-REM
-REM End of program, function definitions follow
-REM
-REM ============================================================================
-:wait_auto
-IF EXIST %STATUSDIR%\done (
- DEL %STATUSDIR%\done
- GOTO :eof
-)
-IF EXIST %STATUSDIR%\error (
- ECHO.
- ECHO %time% ERROR Script returned error:
- ECHO.
- TYPE %STATUSDIR%\error
- ECHO.
- ECHO %time% Aborting.
- ECHO.
- DEL %STATUSDIR%\error
- GOTO :terminate
-)
-TIMEOUT /T 5 /NOBREAK
-GOTO :wait_auto
-REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-:wait_poweroff
-"%VBM%" showvminfo %~1 --machinereadable|findstr poweroff
-IF %errorlevel% EQU 0 GOTO :eof
-TIMEOUT /T 2 /NOBREAK
-GOTO :wait_poweroff
-REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-:vm_exists
-"%VBM%" list vms|findstr %~1
-IF %errorlevel% NEQ 0 GOTO :eof
-ECHO.
-ECHO %time% VM %~1 already exists. Aborting.
-ECHO.
-GOTO :terminate
-REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-REM vim: set ai ts=4 sw=4 et ft=dosbatch:
-
diff --git a/labs/osbash/lib/wbatch/template-file_header_bat b/labs/osbash/lib/wbatch/template-file_header_bat
deleted file mode 100644
index 81e8f0c8..00000000
--- a/labs/osbash/lib/wbatch/template-file_header_bat
+++ /dev/null
@@ -1,16 +0,0 @@
-@ECHO OFF
-
-REM This is an automatically generated Windows batch file. It creates the
-REM %PRODUCT% for an OpenStack training-labs setup.
-
-SETLOCAL ENABLEDELAYEDEXPANSION
-
-ECHO.
-ECHO OpenStack labs for VirtualBox on Windows
-ECHO Generated by osbash
-ECHO.
-ECHO Create %PRODUCT%
-ECHO.
-
-REM vim: set ai ts=4 sw=4 et ft=dosbatch:
-
diff --git a/labs/osbash/lib/wbatch/template-find_vbm_bat b/labs/osbash/lib/wbatch/template-find_vbm_bat
deleted file mode 100644
index c4d7449b..00000000
--- a/labs/osbash/lib/wbatch/template-find_vbm_bat
+++ /dev/null
@@ -1,47 +0,0 @@
-REM Load likely VBoxManage location from configuration file
-CALL "%~dp0\CONFIG.BAT"
-
-IF EXIST "%VBM%" GOTO vbm_found
-
-REM Before searching, try a likely alternative
-
-SET VBM=d:\Program Files\Oracle\VirtualBox\VBoxManage.exe
-
-IF EXIST "%VBM%" GOTO vbm_found
-
-ECHO.
-ECHO %time% Searching %SystemDrive% for VBoxManage, this may take a while
-ECHO.
-ECHO To skip the search process and speed up script execution, edit
-ECHO config.bat so that VBM contains the full path to VBoxManage.exe.
-ECHO.
-
-FOR /r %SystemDrive%\ %%a IN (*) DO (
- IF "%%~nxa"=="VBoxManage.exe" SET VBM=%%~dpnxa && GOTO vbm_found
-)
-
-ECHO.
-ECHO %time% Cannot find VBoxManage.exe (part of VirtualBox) on %SystemDrive%.
-
-ECHO.
-ECHO %time% Searching D: for VBoxManage, this may take a while
-ECHO.
-
-FOR /r D:\ %%a IN (*) DO (
- IF "%%~nxa"=="VBoxManage.exe" SET VBM=%%~dpnxa && GOTO vbm_found
-)
-
-ECHO.
-ECHO %time% Cannot find VBoxManage.exe (part of VirtualBox) on D:.
-ECHO %time% Giving up. Program stops.
-ECHO.
-GOTO :terminate
-
-:vbm_found
-ECHO VBoxManage.exe found:
-ECHO "%VBM%"
-ECHO Version:
-"%VBM%" --version
-
-REM vim: set ai ts=4 sw=4 et ft=dosbatch:
-
diff --git a/labs/osbash/lib/wbatch/template-mkdirs_bat b/labs/osbash/lib/wbatch/template-mkdirs_bat
deleted file mode 100644
index 192240d4..00000000
--- a/labs/osbash/lib/wbatch/template-mkdirs_bat
+++ /dev/null
@@ -1,20 +0,0 @@
-SET BATDIR=%~dp0
-PUSHD %BATDIR%..
-SET TOPDIR=%cd%
-POPD
-
-SET AUTODIR=%TOPDIR%\%P_AUTODIR%
-SET IMGDIR=%TOPDIR%\%P_IMGDIR%
-SET LOGDIR=%TOPDIR%\%P_LOGDIR%
-SET STATUSDIR=%TOPDIR%\%P_STATUSDIR%
-SET SHAREDIR=%TOPDIR%
-SET TOOLSDIR=%TOPDIR%\tools
-
-ECHO %time% Creating directories (if needed)
-IF NOT EXIST %AUTODIR% mkdir %AUTODIR%
-IF NOT EXIST %IMGDIR% mkdir %IMGDIR%
-IF NOT EXIST %LOGDIR% mkdir %LOGDIR%
-IF NOT EXIST %SHAREDIR% mkdir %SHAREDIR%
-
-REM vim: set ai ts=4 sw=4 et ft=dosbatch:
-
diff --git a/labs/osbash/log/README.rst b/labs/osbash/log/README.rst
deleted file mode 100644
index 911d6277..00000000
--- a/labs/osbash/log/README.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-The log files in this directory are written (and removed) by osbash/wbatch and
-the scripts running within the VMs.
-
-The status subdirectory is used by the VM scripts to inform osbash/wbatch
-about their progress.
diff --git a/labs/osbash/osbash.sh b/labs/osbash/osbash.sh
deleted file mode 100755
index f335d56f..00000000
--- a/labs/osbash/osbash.sh
+++ /dev/null
@@ -1,264 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit
-set -o nounset
-
-# Kill entire process group
-trap 'kill -- -$$' SIGINT
-
-TOP_DIR=$(cd "$(dirname "$0")" && pwd)
-
-# Abort for Windows environment before sourcing scripts that may result
-# in other errors.
-if uname | grep -i -e "cygwin" -e "mingw"; then
- echo "Running osbash.sh in Windows is not supported. Instead, use the"
- echo "Windows batch scripts in the wbatch directory."
- exit 1
-fi
-
-source "$TOP_DIR/config/localrc"
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/openstack"
-source "$CONFIG_DIR/deploy.osbash"
-source "$OSBASH_LIB_DIR/lib.$DISTRO.sh"
-source "$OSBASH_LIB_DIR/functions-host.sh"
-source "$OSBASH_LIB_DIR/$PROVIDER-functions.sh"
-source "$OSBASH_LIB_DIR/$PROVIDER-install_base.sh"
-source "$LIB_DIR/osbash/lib-color.sh"
-
-# Skip snap cycles by default (SNAP_CYCLE=no)
-: ${SNAP_CYCLE="no"}
-
-function usage {
- echo "Usage: $0 {-b|-w} [-g GUI] [--no-color] [-n] [-t SNAP] {TARGET}"
- # Don't advertise export until it is working properly
- # echo " $0 [-e EXPORT] [-n] NODE [NODE..]"
- echo
- echo "-h|--help Help"
- echo "-n Print configuration status and exit"
- echo "-b Build basedisk (if necessary) and node VMs (if any)"
-
- # Don't use -t directly, have tools/repeat-test.sh call it
- #echo "-t SNAP Jump to snapshot SNAP and continue build"
-
- echo "-w Create Windows batch files"
- echo "-g GUI GUI type during build"
- #echo "-e EXPORT Export node VMs"
- echo "--no-color Disables colors during build"
- echo "--no-snap-cycle Disables snapshot cycles during build"
- echo
- echo "TARGET basedisk: build configured basedisk"
- echo " cluster : build OpenStack cluster [all nodes]"
- echo " (and basedisk if necessary)"
- echo "GUI console type: gui, sdl (VirtualBox only), vnc (KVM only),"
- echo " or headless"
-
- # Don't use -t SNAP directly, have tools/repeat-test.sh call it
- #echo "SNAP Name of snapshot from which build continues"
-
- #echo "EXPORT ova (OVA package file) or dir (VM clone directory)"
- exit
-}
-
-function print_config {
- local basedisk=$(get_base_disk_name)
- if [ "$CMD" = "basedisk" ]; then
- echo -e "${CInfo:-}Target is base disk:${CData:-} $basedisk${CReset:-}"
- else
- echo -e "${CInfo:-}Base disk:${CData:-} $basedisk${CReset:-}"
- echo -e "${CInfo:-}Distribution name: ${CData:-} $(get_distro_name "$DISTRO")${CReset:-}"
- fi
-
- echo -e "${CInfo:-}Virtualization provider:${CReset:-}" \
- "${CData:-}$PROVIDER${CReset:-}"
-
- if [ "${SNAP_CYCLE:-}" = "no" ]; then
- echo -e "${CInfo:-}Skipping snapshot cycles.${CReset:-}"
- fi
-
- if [ -n "${EXPORT_OVA:-}" ]; then
- echo "Exporting to OVA: ${EXPORT_OVA}"
- elif [ -n "${EXPORT_VM_DIR:-}" ]; then
- echo "Exporting to directory: ${EXPORT_VM_DIR}"
- else
- echo -e -n "${CInfo:-}Creating Windows batch scripts:${CReset:-} "
- ${WBATCH:-:} echo -e "${CData:-}yes${CReset:-}"
- ${WBATCH:+:} echo -e "${CData:-}no${CReset:-}"
-
- echo -e -n "${CInfo:-}Creating $CMD on this machine:${CReset:-} "
- ${OSBASH:-:} echo -e "${CData:-}yes${CReset:-}"
- ${OSBASH:+:} echo -e "${CData:-}no${CReset:-}"
-
- echo -e "${CInfo:-}VM access method:${CData:-} $VM_ACCESS${CReset:-}"
-
- # GUI is the VirtualBox default
- echo -e "${CInfo:-}GUI type:${CData:-} ${VM_UI:-gui}${CReset:-}"
-
- if [ -n "${JUMP_SNAPSHOT:-}" ]; then
- echo -e "${CInfo:-}Continuing from snapshot:" \
- "${CData:-}${JUMP_SNAPSHOT}${CReset:-}"
- fi
- fi
-
-}
-
-if [ $(whoami) = "root" ]; then
- echo "Please run this program as a regular user, not as root or with sudo."
- exit 1
-fi
-
-while getopts :be:g:-:hnt:w opt; do
- case $opt in
- e)
- if [ "$OPTARG" = ova ]; then
- EXPORT_OVA=$IMG_DIR/labs-$DISTRO.ova
- elif [ "$OPTARG" = dir ]; then
- EXPORT_VM_DIR=$IMG_DIR/labs-$DISTRO
- else
- echo -e "${CError:-}Error: -e argument must be ova or dir${CReset:-}"
- exit
- fi
- OSBASH=exec_cmd
- ;;
- b)
- OSBASH=exec_cmd
- ;;
- g)
- if [[ "$OPTARG" =~ (headless|gui|sdl|vnc) ]]; then
- VM_UI=$OPTARG
- else
- echo -e "${CError:-}Error: -g argument must be gui, sdl, vnc, or headless${CReset:-}"
- exit
- fi
- ;;
- -)
- case $OPTARG in
- no-color)
- unset CError CStatus CInfo CProcess CData CMissing CReset
- ;;
- no-snap-cycle)
- SNAP_CYCLE="no"
- ;;
- help)
- usage
- ;;
- *)
- echo -e "${CError:-}Error: invalid option -$OPTARG${CReset:-}"
- echo
- usage
- ;;
- esac
- ;;
- h)
- usage
- ;;
- n)
- INFO_ONLY=1
- ;;
- t)
- JUMP_SNAPSHOT=$OPTARG
- ;;
- w)
- source "$LIB_DIR/wbatch/batch_for_windows.sh"
- ;;
- :)
- echo -e "${CError:-}Error: -$OPTARG needs argument${CReset:-}"
- ;;
- ?)
- echo -e "${CError:-}Error: invalid option -$OPTARG${CReset:-}"
- echo
- usage
- ;;
- esac
-done
-
-# Remove processed options from arguments
-shift $(( OPTIND - 1 ));
-
-if [ $# -eq 0 ]; then
- # No argument given
- usage
-else
- CMD=$1
-fi
-
-# Install over ssh by default
-: ${VM_ACCESS:=ssh}
-
-print_config
-
-if [ "${INFO_ONLY:-0}" -eq 1 ]; then
- exit
-fi
-
-# Clean wbatch directory
-${WBATCH:-:} wbatch_reset
-
-if [ -n "${EXPORT_OVA:-}" ]; then
- vm_export_ova "$EXPORT_OVA" "$nodes"
- exit
-fi
-
-if [ -n "${EXPORT_VM_DIR:-}" ]; then
- vm_export_dir "$EXPORT_VM_DIR" "$nodes"
- exit
-fi
-
-if [ -z "${OSBASH:-}" -a -z "${WBATCH:-}" ]; then
- echo
- echo -e "${CMissing:-}No -b, -w, or -e option given. Exiting.${CReset:-}"
- exit
-fi
-
-STARTTIME=$(date +%s)
-echo -e >&2 "${CStatus:-} $(date) osbash starting ${CReset:-}"
-
-clean_dir "$LOG_DIR"
-
-function check_existing_base_disk {
- if [ "$CMD" = basedisk ]; then
- if base_disk_exists; then
-
- echo >&2 "Found existing base disk: $(get_base_disk_name)"
-
- if ! yes_or_no "Keep this base disk?"; then
- base_disk_delete
- else
- echo -e >&2 "${CMissing:-}Nothing to do. Exiting.${CReset:-}"
- exit
- fi
- fi
- fi
-}
-
-${OSBASH:-:} check_existing_base_disk
-
-#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-if ! base_disk_exists; then
- echo -e >&2 "${CStatus:-}Creating basedisk.${CReset:-}"
- vm_install_base
-else
- echo -e >&2 "${CStatus:-}basedisk already exists.${CReset:-}"
- # Leave base disk alone, but call the function if wbatch is active
- OSBASH= ${WBATCH:-:} vm_install_base
-fi
-#-------------------------------------------------------------------------------
-if [ "$CMD" = basedisk ]; then
- exit
-fi
-
-# Don't stop VMs if LEAVE_VMS_RUNNING is set (needed by repeat-test)
-${LEAVE_VMS_RUNNING:+:} stop_running_cluster_vms
-
-echo "Building nodes using base disk $(get_base_disk_name)"
-
-create_host_networks
-${WBATCH:-:} wbatch_create_hostnet
-#-------------------------------------------------------------------------------
-source "$OSBASH_LIB_DIR/$PROVIDER-install_nodes.sh"
-vm_build_nodes "$CMD"
-#-------------------------------------------------------------------------------
-ENDTIME=$(date +%s)
-echo -e >&2 "${CStatus:-}$(date) osbash finished successfully${CReset:-}"
-echo -e >&2 "${CStatus:-}osbash completed in $((ENDTIME - STARTTIME))" \
- "seconds.${CReset:-}"
diff --git a/labs/osbash/scripts/README.rst b/labs/osbash/scripts/README.rst
deleted file mode 100644
index 3b1f0775..00000000
--- a/labs/osbash/scripts/README.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-All scripts in this directory run within the VMs.
-
-They install and configure OpenStack components and any other required
-software (such as databases).
-
-Before these generic scripts run, scripts from the osbash subdirectory
-set up the VM and configure basic networking.
diff --git a/labs/osbash/scripts/TOP_DIR b/labs/osbash/scripts/TOP_DIR
deleted file mode 100644
index f3229c5b..00000000
--- a/labs/osbash/scripts/TOP_DIR
+++ /dev/null
@@ -1 +0,0 @@
-..
diff --git a/labs/osbash/scripts/centos/yum_init.sh b/labs/osbash/scripts/centos/yum_init.sh
deleted file mode 100755
index f4368d2d..00000000
--- a/labs/osbash/scripts/centos/yum_init.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/openstack"
-# Pick up VM_PROXY
-source "$CONFIG_DIR/localrc"
-source "$LIB_DIR/functions.guest.sh"
-
-indicate_current_auto
-
-exec_logfile
-
-function set_yum_proxy {
- local YUM_FILE=/etc/yum.conf
- if [ -z "${VM_PROXY-}" ]; then
- return 0;
- fi
- echo "proxy=${VM_PROXY}" | sudo tee -a $YUM_FILE
-}
-
-set_yum_proxy
-
-# Enable RDO repo
-case "${OPENSTACK_RELEASE:-}" in
- kilo)
- sudo yum install -y "https://repos.fedorapeople.org/repos/openstack/openstack-kilo/rdo-release-kilo-1.noarch.rpm"
- ;;
- liberty)
- sudo yum install -y "https://repos.fedorapeople.org/repos/openstack/openstack-liberty/rdo-release-liberty-2.noarch.rpm"
- ;;
- mitaka)
- sudo yum install -y "https://repos.fedorapeople.org/repos/openstack/openstack-mitaka/rdo-release-mitaka-3.noarch.rpm"
- ;;
- *)
- echo 2>&1 "ERROR Unknown OpenStack release."
- exit 1
-esac
diff --git a/labs/osbash/scripts/centos/yum_update.sh b/labs/osbash/scripts/centos/yum_update.sh
deleted file mode 100755
index cf2b53aa..00000000
--- a/labs/osbash/scripts/centos/yum_update.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/openstack"
-source "$LIB_DIR/functions.guest.sh"
-
-indicate_current_auto
-
-exec_logfile
-
-# Upgrade installed packages
-sudo yum -y update
diff --git a/labs/osbash/scripts/config_private_network.sh b/labs/osbash/scripts/config_private_network.sh
deleted file mode 100755
index 28c08924..00000000
--- a/labs/osbash/scripts/config_private_network.sh
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Create private network
-# https://docs.openstack.org/install-guide/launch-instance-networks-selfservice.html
-#------------------------------------------------------------------------------
-
-echo -n "Waiting for first DHCP namespace."
-until [ "$(ip netns | grep -c -o "^qdhcp-[a-z0-9-]*")" -gt 0 ]; do
- sleep 1
- echo -n .
-done
-echo
-
-echo -n "Waiting for first bridge to show up."
-# Bridge names are something like brq219ddb93-c9
-until [ "$(/sbin/brctl show | grep -c -o "^brq[a-z0-9-]*")" -gt 0 ]; do
- sleep 1
- echo -n .
-done
-echo
-
-# Wait for neutron to start
-wait_for_neutron
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Create the self-service network
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-(
-echo "Sourcing the demo credentials."
-source "$CONFIG_DIR/demo-openstackrc.sh"
-
-echo "Creating the private network."
-openstack network create selfservice
-
-echo "Creating a subnet on the private network."
-openstack subnet create --network selfservice \
- --dns-nameserver "$DNS_RESOLVER" --gateway "$SELFSERVICE_NETWORK_GATEWAY" \
- --subnet-range "$SELFSERVICE_NETWORK_CIDR" selfservice
-)
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Not in install-guide:
-echo -n "Waiting for second DHCP namespace."
-until [ "$(ip netns | grep -c -o "^qdhcp-[a-z0-9-]*")" -gt 1 ]; do
- sleep 1
- echo -n .
-done
-echo
-
-echo -n "Waiting for second bridge."
-until [ "$(/sbin/brctl show | grep -c -o "^brq[a-z0-9-]*")" -gt 1 ]; do
- sleep 1
- echo -n .
-done
-echo
-
-echo "Bridges are:"
-/sbin/brctl show
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Create a router
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-(
-echo "Sourcing the demo credentials."
-source "$CONFIG_DIR/demo-openstackrc.sh"
-
-echo "Creating a router."
-openstack router create router
-)
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Not in install-guide:
-
-function wait_for_agent {
- local agent=$1
-
- echo -n "Waiting for neutron agent $agent."
- (
- source "$CONFIG_DIR/admin-openstackrc.sh"
- while openstack network agent list | grep "$agent" | grep -q "XXX"; do
- sleep 1
- echo -n .
- done
- echo
- )
-}
-
-wait_for_agent neutron-l3-agent
-
-echo "linuxbridge-agent and dhcp-agent must be up before we can add interfaces."
-wait_for_agent neutron-linuxbridge-agent
-wait_for_agent neutron-dhcp-agent
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-(
-source "$CONFIG_DIR/demo-openstackrc.sh"
-
-echo "Adding the private network subnet as an interface on the router."
-openstack router add subnet router selfservice
-)
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Not in install-guide:
-
-# The following tests for router namespace, qr-* interface and bridges are just
-# for show. They are not needed to prevent races.
-
-echo -n "Getting router namespace."
-until ip netns | grep qrouter; do
- echo -n "."
- sleep 1
-done
-nsrouter=$(ip netns | grep qrouter)
-
-echo -n "Waiting for interface qr-* in router namespace."
-until sudo ip netns exec "$nsrouter" ip addr|grep -Po "(?<=: )qr-.*(?=:)"; do
- echo -n "."
- sleep 1
-done
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-(
-source "$CONFIG_DIR/demo-openstackrc.sh"
-
-echo "Setting a gateway on the public network on the router."
-openstack router set router --external-gateway provider
-)
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Not in install-guide:
-
-# The following test for qg-* is just for show.
-echo -n "Waiting for interface qg-* in router namespace."
-until sudo ip netns exec "$nsrouter" ip addr|grep -Po "(?<=: )qg-.*(?=:)"; do
- echo -n "."
-sleep 1
-done
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Verify operation
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Listing network namespaces."
-ip netns
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-echo "Getting the router's IP address in the public network."
-echo "openstack port list --router router"
-openstack port list --router router
-
-# Get router IP address in given network
-function get_router_ip_address {
- local net_name=$1
- local public_network=$(netname_to_network "$net_name")
- local network_part=$(remove_last_octet "$public_network")
- local line
-
- while : ; do
- line=$(openstack port list --router router -c"Fixed IP Addresses" | grep "$network_part")
- if [ -z "$line" ]; then
- # Wait for the network_part to appear in the list
- sleep 1
- echo -n >&2 .
- continue
- fi
- router_ip=$(echo "$line"|grep -Po "$network_part\.\d+")
- echo "$router_ip"
- return 0
- done
-}
-
-PUBLIC_ROUTER_IP=$(get_router_ip_address "provider")
-
-echo -n "Waiting for ping reply from public router IP ($PUBLIC_ROUTER_IP)."
-cnt=0
-until ping -c1 "$PUBLIC_ROUTER_IP" > /dev/null; do
- cnt=$((cnt + 1))
- if [ $cnt -eq 20 ]; then
- echo "ERROR No reply from public router IP in 20 seconds, aborting."
- exit 1
- fi
- sleep 1
- echo -n .
-done
-echo
diff --git a/labs/osbash/scripts/config_public_network.sh b/labs/osbash/scripts/config_public_network.sh
deleted file mode 100755
index ba09265f..00000000
--- a/labs/osbash/scripts/config_public_network.sh
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Create the provier (external) network and a subnet on it
-# https://docs.openstack.org/install-guide/launch-instance-networks-provider.html
-#------------------------------------------------------------------------------
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-# Wait for neutron to start
-wait_for_neutron
-
-function wait_for_agent {
- local agent=$1
-
- echo -n "Waiting for neutron agent $agent."
- (
- source "$CONFIG_DIR/admin-openstackrc.sh"
- while openstack network agent-list|grep "$agent"|grep "XXX" >/dev/null; do
- sleep 1
- echo -n .
- done
- echo
- )
-}
-
-wait_for_agent neutron-l3-agent
-
-echo "linuxbridge-agent and dhcp-agent must be up before we can add interfaces."
-wait_for_agent neutron-linuxbridge-agent
-wait_for_agent neutron-dhcp-agent
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Create the provider network
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Creating the public network."
-openstack network create --share --external \
- --provider-physical-network provider \
- --provider-network-type flat provider
-
-echo "Creating a subnet on the public network."
-openstack subnet create --network provider \
- --allocation-pool start="$START_IP_ADDRESS,end=$END_IP_ADDRESS" \
- --dns-nameserver "$DNS_RESOLVER" --gateway "$PROVIDER_NETWORK_GATEWAY" \
- --subnet-range "$PROVIDER_NETWORK_CIDR" provider
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Not in install-guide:
-echo -n "Waiting for DHCP namespace."
-until [ "$(ip netns | grep -c -o "^qdhcp-[a-z0-9-]*")" -gt 0 ]; do
- sleep 1
- echo -n .
-done
-echo
-
-echo -n "Waiting for bridge to show up."
-# Bridge names are something like brq219ddb93-c9
-until [ "$(/sbin/brctl show | grep -c -o "^brq[a-z0-9-]*")" -gt 0 ]; do
- sleep 1
- echo -n .
-done
-echo
-
-/sbin/brctl show
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/labs/osbash/scripts/etc_hosts.sh b/labs/osbash/scripts/etc_hosts.sh
deleted file mode 100755
index c9bc4b13..00000000
--- a/labs/osbash/scripts/etc_hosts.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-indicate_current_auto
-
-exec_logfile
-
-# The install-guide wants to use the hostname as the name of the interface
-# in the mgmt network. We cannot allow 127.0.0.1 to share the name.
-HOST_NAME=$(hostname)-lo
-HOST_FILE=/etc/hosts
-
-if ! grep -q "^[^#].*$HOST_NAME" $HOST_FILE; then
- # No active entry for our hostname
- HOST_IP=127.0.1.1
- if grep -q "^$HOST_IP" $HOST_FILE; then
- # Fix the entry for the IP address we want to use
- sudo sed -i "s/^$HOST_IP.*/$HOST_IP $HOST_NAME/" $HOST_FILE
- else
- echo "$HOST_IP $HOST_NAME" | sudo tee -a $HOST_FILE
- fi
-fi
-
-# Add entries for the OpenStack training-labs cluster
-cat "$CONFIG_DIR/hosts.multi" | sudo tee -a /etc/hosts
diff --git a/labs/osbash/scripts/osbash/activate_autostart.sh b/labs/osbash/scripts/osbash/activate_autostart.sh
deleted file mode 100755
index 8e6309c3..00000000
--- a/labs/osbash/scripts/osbash/activate_autostart.sh
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-# This script is the first to run and the only one to run as root.
-
-# XXX The name activate_autostart.sh is hard-coded in ks.cfg and preseed.cfg.
-
-readonly RCAUTOSTART=osbashauto
-
-# Remove any sysvinit files that called us (written by {ks,preseed}.cfg)
-rm -f /etc/init.d/osbash /etc/rc2.d/S40osbash
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-# source_deploy doesn't work here
-source "$CONFIG_DIR/deploy.osbash"
-source "$LIB_DIR/functions.guest.sh"
-
-indicate_current_auto
-
-# This guest script doesn't write to $HOME; the log file's extension is .auto
-exec_logfile "$LOG_DIR" "auto"
-
-# Clean up rc.local (used for activating autostart in systemd systems)
-if grep activate_autostart.sh /etc/rc.local; then
- # systemd
- echo "Restoring /etc/rc.local."
- sed -i 's/# exit 0/exit 0/' /etc/rc.local
- # Leave our deactivated code so it can be found and checked
- sed -i '/activate_autostart.sh/ s/^/#/' /etc/rc.local
- OSBASH_AUTO=/root/$RCAUTOSTART
-else
- # sysvinit
- OSBASH_AUTO=/etc/init.d/$RCAUTOSTART
-fi
-
-# Some guest additions leave a broken symlink /sbin/mount.vboxsf
-as_root_fix_mount_vboxsf_link
-
-if ! id -u "$VM_SHELL_USER" >/dev/null 2>&1; then
- echo "User $VM_SHELL_USER does not exist -> adding it."
- useradd osbash -G vboxsf
- echo "$VM_SHELL_USER:$VM_SHELL_USER" | chpasswd
-elif ! id -Gn "$VM_SHELL_USER" >/dev/null 2>&1 | grep -q vboxsf; then
- echo "User $VM_SHELL_USER is not in group vboxsf -> adding it."
- usermod -a -G vboxsf "$VM_SHELL_USER"
-fi
-
-echo "Adding sudo privileges for user VM_SHELL_USER."
-as_root_inject_sudoer
-
-if [ ! -f "$OSBASH_SCRIPTS_DIR/template-$RCAUTOSTART" ]; then
- echo "Template not found: $OSBASH_SCRIPTS_DIR/template-$RCAUTOSTART"
- exit 1
-fi
-
-# LOG_DIR and SHARE_DIR are based on the temporary mount point /media/sf_*
-# which won't be there after reboot; use new paths for osbashauto
-
-NLOG_DIR="/$SHARE_NAME/$(basename "$LOG_DIR")"
-
-echo "Creating $OSBASH_AUTO."
-sed -e "
- s,%SHARE_NAME%,$SHARE_NAME,g;
- s,%VM_SHELL_USER%,$VM_SHELL_USER,g;
- s,%NLOG_DIR%,$NLOG_DIR,g;
- s,%RCAUTOSTART%,$RCAUTOSTART,g;
- " "$OSBASH_SCRIPTS_DIR/template-$RCAUTOSTART" > "$OSBASH_AUTO"
-
-chmod 755 "$OSBASH_AUTO"
-
-echo "Making devstack's OS detection work with nounset."
-init_os_ident
-
-if [ "$OSBASH_AUTO" = "/root/$RCAUTOSTART" ]; then
- echo "Creating systemd service $RCAUTOSTART.service."
- cat << SERVICE > /etc/systemd/system/$RCAUTOSTART.service
-[Unit]
-Description=OpenStack autostart
-Requires=vboxadd-service.service
-
-[Service]
-Type=simple
-ExecStart=$OSBASH_AUTO
-TimeoutSec=0
-# Consider service running even after all our processes have exited
-RemainAfterExit=yes
-
-[Install]
-WantedBy=multi-user.target
-SERVICE
-
- systemctl enable "$RCAUTOSTART.service"
- systemctl start "$RCAUTOSTART.service"
-else
- ln -sv "../init.d/$RCAUTOSTART" "/etc/rc2.d/S99$RCAUTOSTART"
-fi
diff --git a/labs/osbash/scripts/osbash/base_fixups.sh b/labs/osbash/scripts/osbash/base_fixups.sh
deleted file mode 100755
index 21938639..00000000
--- a/labs/osbash/scripts/osbash/base_fixups.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-indicate_current_auto
-
-exec_logfile
-
-# This script is run by vm_install_base. It should work on all supported
-# distributions.
-
-# match Vagrant which removes 70-persistent-net.rules (so we get the same
-# names for our network interfaces)
-sudo rm -f /etc/udev/rules.d/70-persistent-net.rules
diff --git a/labs/osbash/scripts/osbash/copy_openrc.sh b/labs/osbash/scripts/osbash/copy_openrc.sh
deleted file mode 100755
index 7fce8aeb..00000000
--- a/labs/osbash/scripts/osbash/copy_openrc.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-
-# This script copies the openrc.sh credentials files to the home directory
-# in order to make them easier to find for the user.
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-source "$CONFIG_DIR/openstack"
-source "$CONFIG_DIR/credentials"
-
-indicate_current_auto
-
-exec_logfile
-
-# We replace the hostname "controller" with the equivalent IP address to
-# make the openrc file work on the user's host machine without them
-# changing their /etc/hosts
-CONTROLLER_MGMT_IP=$(get_node_ip_in_network "controller" "mgmt")
-
-# Replace variables with constants and keep only lines starting with "export"
-
-cat "$CONFIG_DIR/admin-openstackrc.sh" | sed -ne "
- s/\$ADMIN_PROJECT_NAME/$ADMIN_PROJECT_NAME/
- s/\$ADMIN_USER_NAME/$ADMIN_USER_NAME/
- s/\$ADMIN_PASS/$ADMIN_PASS/
- s/controller/$CONTROLLER_MGMT_IP/
- /^export/p
- " > "$HOME/admin-openrc.sh"
-
-cat "$CONFIG_DIR/demo-openstackrc.sh" | sed -ne "
- s/\$DEMO_PROJECT_NAME/$DEMO_PROJECT_NAME/
- s/\$DEMO_USER_NAME/$DEMO_USER_NAME/
- s/\$DEMO_PASS/$DEMO_PASS/
- s/controller/$CONTROLLER_MGMT_IP/
- /^export/p
- " > "$HOME/demo-openrc.sh"
diff --git a/labs/osbash/scripts/osbash/enable_osbash_ssh_keys.sh b/labs/osbash/scripts/osbash/enable_osbash_ssh_keys.sh
deleted file mode 100755
index 206465af..00000000
--- a/labs/osbash/scripts/osbash/enable_osbash_ssh_keys.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-
-# This script installs the insecure osbash ssh keys. This allows users to
-# log into the VMs using these keys instead of a password.
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-indicate_current_auto
-
-exec_logfile
-
-mkdir -p "$HOME/.ssh"
-chmod 700 "$HOME/.ssh"
-
-# Install the requested osbash insecure key to $HOME/.ssh.
-function get_osbash_key {
- local key_name=$1
- local osbash_key_dir=$LIB_DIR/osbash-ssh-keys
-
- if [ -f "$HOME/.ssh/$key_name" ]; then
- echo "osbash insecure key already installed: $HOME/.ssh/$key_name."
- else
- echo "Installing osbash insecure key $key_name."
- cp -v "$osbash_key_dir/$key_name" "$HOME/.ssh"
- fi
-}
-
-# Authorize named key for ssh logins into this VM.
-function authorize_osbash_key {
- local pub_key_path=$1
- local auth_key_path=$HOME/.ssh/authorized_keys
- if grep -qs "osbash insecure public key" "$auth_key_path"; then
- echo "Already authorized."
- else
- cat "$pub_key_path" >> "$auth_key_path"
- fi
-}
-
-echo "Installing osbash insecure private key (connections to other VMs)."
-get_osbash_key "osbash_key"
-chmod 400 "$HOME/.ssh/osbash_key"
-
-get_osbash_key "osbash_key.pub"
-chmod 444 "$HOME/.ssh/osbash_key.pub"
-
-echo "Authorizing osbash public key (connections from host and other VMs)."
-authorize_osbash_key "$HOME/.ssh/osbash_key.pub"
diff --git a/labs/osbash/scripts/osbash/init_xxx_node.sh b/labs/osbash/scripts/osbash/init_xxx_node.sh
deleted file mode 100755
index 30100ff1..00000000
--- a/labs/osbash/scripts/osbash/init_xxx_node.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-
-# This scripts configures hostname and networking for all nodes. The filename
-# determines the node name.
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-# Determine hostname from script name
-re=".*init_(.*)_node.sh$"
-if [[ $0 =~ $re ]]; then
- NODE_NAME=${BASH_REMATCH[1]}
- NODE_NAME="${NODE_NAME}"
-else
- echo "ERROR Unable to determine hostname"
- exit 1
-fi
-
-indicate_current_auto
-
-exec_logfile
-
-set_iface_list
-
-# Set hostname for now and for rebooted system
-sudo hostname "$NODE_NAME" >/dev/null
-echo "$NODE_NAME" | sudo tee /etc/hostname > /dev/null
-
-# Configure network interfaces
-config_network
-netcfg_show
-
-for iface in ${IF_NAMES[@]}; do
- sudo ifup "$iface"
-done
diff --git a/labs/osbash/scripts/osbash/template-osbashauto b/labs/osbash/scripts/osbash/template-osbashauto
deleted file mode 100644
index 0d9dd63b..00000000
--- a/labs/osbash/scripts/osbash/template-osbashauto
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/bash
-
-# By default, this file is /root/osbashauto (with systemd) or
-# /etc/init.d/osbashauto (for sysvinit) on the guest system.
-# On boot-up, it executes in order all files that have been put into
-# the autostart folder.
-
-# The name of this file is hard-coded in activate_autostart.sh.
-
-SHARE_NAME=%SHARE_NAME%
-
-# Make sure we have a mount point for the shared directory
-mkdir -p /$SHARE_NAME
-
-# Wait for mountpoint to become available (keep log file so we can copy it to
-# the share once it is mounted)
-SHARE_MOUNT_LOG=share_mount.log
-while ! mountpoint -q /$SHARE_NAME; do
- if mount -t vboxsf -ouid=%VM_SHELL_USER%,gid=%VM_SHELL_USER% $SHARE_NAME /$SHARE_NAME; then
- echo "$(date) Mounting succeeded!" >> /tmp/$SHARE_MOUNT_LOG
- else
- echo "$(date) Mounting failed, trying again." >> /tmp/$SHARE_MOUNT_LOG
- fi
- sleep 1
-done
-
-# LOG_DIR is set in activate_autostart.sh as NLOG_DIR
-LOG_DIR=%NLOG_DIR%
-
-# Save share mount log for all reboots in one file
-cat /tmp/$SHARE_MOUNT_LOG >> "$LOG_DIR/$SHARE_MOUNT_LOG"
-
-STATUS_DIR=%NLOG_DIR%/status
-
-mkdir -p $STATUS_DIR
-
-TOP_DIR=/$SHARE_NAME
-
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logpath "$LOG_DIR/%RCAUTOSTART%.log"
-
-echo "$(date) starting"
-
-shopt -s nullglob
-for AUTODIR in "/$SHARE_NAME/autostart" "/$SHARE_NAME/autostart/$HOSTNAME"; do
- if [ -d "$AUTODIR" ]; then
- echo "$(date) autodir $AUTODIR"
- for SCRIPT in $AUTODIR/*.sh; do
- if ! as_root_exec_script "$SCRIPT"; then
- echo >&2 "Script returned with error, giving up."
- # Tell host about the error
- echo "ERROR in $SCRIPT" >> "$STATUS_DIR/error"
- exit 1
- fi
- # Remove script after execution
- rm "$SCRIPT"
- done
- fi
-done
-
-echo "$(date) autostart done"
-
-# This file is seen and removed by scripts running on the host
-touch "$STATUS_DIR/done"
-
-exit 0
-
-# vim: set ai ts=4 sw=4 et:
diff --git a/labs/osbash/scripts/osbash/wait_debug.sh b/labs/osbash/scripts/osbash/wait_debug.sh
deleted file mode 100755
index d3e93a82..00000000
--- a/labs/osbash/scripts/osbash/wait_debug.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-indicate_current_auto
-
-exec_logfile
-
-# Wait for removal of /tmp/remove_to_continue
-wait_for_file
diff --git a/labs/osbash/scripts/pre-download.sh b/labs/osbash/scripts/pre-download.sh
deleted file mode 100755
index 93ae2293..00000000
--- a/labs/osbash/scripts/pre-download.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/openstack"
-source "$CONFIG_DIR/localrc"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-if [ -n "${VM_PROXY:-""}" ]; then
- echo "Using VM_PROXY as http_proxy: $VM_PROXY"
- export http_proxy=$VM_PROXY
- export https_proxy=$VM_PROXY
-fi
-
-# Download CirrOS image
-function get_cirros {
- local file_name=$(basename $CIRROS_URL)
- local remote_dir=$(dirname $CIRROS_URL)
- local md5_f=$file_name.md5sum
-
- mkdir -p "$IMG_DIR"
-
- # Download to IMG_DIR to cache the data if the directory is shared
- # with the host computer.
- if [ ! -f "$IMG_DIR/$md5_f" ]; then
- wget -O - "$remote_dir/MD5SUMS"|grep "$file_name" > "$IMG_DIR/$md5_f"
- fi
-
- if [ ! -f "$IMG_DIR/$file_name" ]; then
- wget --directory-prefix="$IMG_DIR" "$CIRROS_URL"
- fi
-
- # Make sure we have image and MD5SUM on the basedisk.
- if [ "$IMG_DIR" != "$HOME/img" ]; then
- mkdir -p "$HOME/img"
- cp -a "$IMG_DIR/$file_name" "$IMG_DIR/$md5_f" "$HOME/img"
- fi
-
- cd "$HOME/img"
- md5sum -c "$HOME/img/$md5_f"
- cd -
-}
-
-function pre-download_remote_file {
- local file=$1
- local url=$2
- local dir=${3:-$HOME}
-
- if [ ! -f "$dir/$file" ]; then
- wget --directory-prefix "$dir" -O "$file" "$url"
- fi
-}
-
-# Get cirros image.
-get_cirros
diff --git a/labs/osbash/scripts/pxe_server/install_pxeserver.sh b/labs/osbash/scripts/pxe_server/install_pxeserver.sh
deleted file mode 100755
index 0b0db9a5..00000000
--- a/labs/osbash/scripts/pxe_server/install_pxeserver.sh
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/usr/bin/env bash
-
-# This script executes on the pxeserver and installs the PXE services
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$CONFIG_DIR/openstack"
-source "$LIB_DIR/functions.guest.sh"
-source "$CONFIG_DIR/config.pxeserver"
-
-exec_logfile
-
-indicate_current_auto
-
-PXE_NET_IP=$(get_node_ip_in_network "$(hostname)" "mgmt")
-echo "IP on the management network: $PXE_NET_IP."
-
-# IP minus the last octet, something like "10.0.0"
-PXE_NET_PREFIX=$(remove_last_octet "$PXE_NET_IP")
-
-# Network interface on the network of the default gateway
-PXE_NET_IFACE=$(ip route | grep "$PXE_NET_PREFIX" | awk '{print $3}')
-echo "Network interface on the network of the default gateway: $PXE_NET_IFACE."
-
-echo "Editing /etc/hosts to include pxeserver"
-echo "$PXE_NET_IP pxeserver" | sudo tee -a /etc/hosts
-#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "Installing the dhcp server."
-sudo apt install -y isc-dhcp-server
-
-echo "Setting dhcp server interface to $PXE_NET_IFACE."
-sudo sed -i "s/^INTERFACES=.*/INTERFACES='$PXE_NET_IFACE'/" /etc/default/isc-dhcp-server
-
-TMPF=/etc/dhcp/dhcpd.conf
-echo "Editing $TMPF."
-
-cat << DHCPD | sudo tee -a "$TMPF"
-subnet ${PXE_NET_PREFIX}.0 netmask 255.255.255.0 {
- range ${PXE_NET_PREFIX}.230 ${PXE_NET_PREFIX}.240;
- option routers $PXE_GATEWAY;
- option domain-name-servers $PXE_GATEWAY;
- option broadcast-address ${PXE_NET_PREFIX}.255;
-}
-
-allow booting;
-allow bootp;
-option option-128 code 128 = string;
-option option-129 code 129 = text;
-next-server $PXE_NET_IP;
-filename "pxelinux.0";
-DHCPD
-
-sudo sed -i 's/^#authoritative;/authoritative;/' "$TMPF"
-
-echo "Restarting dhcp server."
-sudo service isc-dhcp-server restart
-#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Setup the tftp server with inetd and apache
-echo "Installing apache, tftpd, and inetd."
-sudo apt install -y apache2 tftpd-hpa inetutils-inetd
-
-TMPF=/etc/default/tftpd-hpa
-echo "Editing $TMPF."
-
-echo 'RUN_DAEMON="yes"' | sudo tee -a "$TMPF"
-echo 'OPTIONS="-l -s /var/lib/tftpboot"' | sudo tee -a "$TMPF"
-
-echo "Enabling tftpd in /etc/inetd.conf."
-echo "tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot" | sudo tee -a /etc/inetd.conf
-
-echo "Restarting tftpd server."
-sudo service tftpd-hpa restart
-#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "Extracting and configuring the Ubuntu boot image."
-
-ISO_NAME=$(echo $IMG_DIR/ubuntu-*.iso | tail -1)
-sudo mount -o loop "$ISO_NAME" /mnt/
-
-sudo cp -fr /mnt/install/netboot/* /var/lib/tftpboot/
-
-sudo mkdir -p /var/www/html/ubuntu
-sudo cp -fr /mnt/* /var/www/html/ubuntu/
-
-sudo rm -f /var/lib/tftpboot/pxelinux.cfg/default
-#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "Configuring DNS server."
-sudo apt -y install bind9
-
-sudo cp /etc/bind/named.conf.options /etc/bind/named.conf.options.BK
-sudo sed -i 's|// forwarders {|forwarders {\n\
-\t\t8.8.8.8;\n\
-\t\t8.8.4.4;\n\
-\t};\n|' /etc/bind/named.conf.options
-
-echo "Restarting DNS server."
-sudo service bind9 restart
-#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-set_iface_list
-IFACE_0=$(ifnum_to_ifname 0)
-IFACE_1=$(ifnum_to_ifname 1)
-echo "Creating a VLAN IP as gateway (interfaces $IFACE_0, $IFACE_1)."
-sudo apt -y install vlan
-sudo modprobe 8021q
-sudo vconfig add "$IFACE_1" 10
-sudo su -c 'echo "8021q" >> /etc/modules'
-
-cat << VLAN_IP | sudo tee -a /etc/network/interfaces
-
-auto $IFACE_1.10
-iface $IFACE_1.10 inet static
- address $PXE_GATEWAY
- netmask 255.255.255.0
- vlan-raw-device $IFACE_1
-VLAN_IP
-
-sudo ifup "$IFACE_1".10
-
-# Forward traffic from eth0.10 to eth0 and eth1
-
-echo "Editing /etc/sysctl.conf: enabling IPv4 forwarding."
-sudo sed -i 's/.*net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
-
-# Reload changed file
-sudo sysctl -p /etc/sysctl.conf
-
-echo 1 | sudo tee -a /proc/sys/net/ipv4/ip_forward
-#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "Configuring iptables."
-sudo iptables -F
-sudo iptables -t nat -F
-sudo iptables -t mangle -F
-sudo iptables -X
-
-sudo iptables --table nat --append POSTROUTING --out-interface $IFACE_0 -j MASQUERADE
-sudo iptables --append FORWARD --in-interface $IFACE_0 -j ACCEPT
-sudo iptables --append FORWARD --in-interface $IFACE_1 -j ACCEPT
-
-echo "Making iptable rules persistent."
-echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
-echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
-sudo apt -y install iptables-persistent
diff --git a/labs/osbash/scripts/shutdown.sh b/labs/osbash/scripts/shutdown.sh
deleted file mode 100755
index 0bac29b3..00000000
--- a/labs/osbash/scripts/shutdown.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-indicate_current_auto
-
-exec_logfile
-
-echo "Shutting down"
-
-# Shutdown some time after returning so our caller has time to finish
-sudo -b sh -c 'sleep 2; systemctl poweroff'
diff --git a/labs/osbash/scripts/test/README.rst b/labs/osbash/scripts/test/README.rst
deleted file mode 100644
index 1d35896a..00000000
--- a/labs/osbash/scripts/test/README.rst
+++ /dev/null
@@ -1 +0,0 @@
-The scripts in this directory can be used to test the training-cluster.
diff --git a/labs/osbash/scripts/test/get_auth_token.sh b/labs/osbash/scripts/test/get_auth_token.sh
deleted file mode 100755
index 30053591..00000000
--- a/labs/osbash/scripts/test/get_auth_token.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$CONFIG_DIR/openstack"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Use OpenStack client environment script
-# http://docs.openstack.org/mitaka/install-guide-ubuntu/keystone-openrc.html
-#------------------------------------------------------------------------------
-
-# Test in subshell environment to keep our environment clean
-(
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-echo "Requesting an authentication token."
-openstack token issue
-)
-
-(
-echo "Sourcing the demo user credentials."
-source "$CONFIG_DIR/demo-openstackrc.sh"
-
-echo "Requesting an authentication token."
-openstack token issue
-)
diff --git a/labs/osbash/scripts/test/heat_stack.sh b/labs/osbash/scripts/test/heat_stack.sh
deleted file mode 100755
index 8080354c..00000000
--- a/labs/osbash/scripts/test/heat_stack.sh
+++ /dev/null
@@ -1,159 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-source "$CONFIG_DIR/openstack"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Verify the Orchestration Service installation
-# http://docs.openstack.org/mitaka/install-guide-ubuntu/launch-instance-heat.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Create a template
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Verifying heat installation."
-echo "Waiting for heat-engine to start."
-
-AUTH="source $CONFIG_DIR/demo-openstackrc.sh"
-if node_ssh controller "$AUTH; openstack stack list 2>&1 | " \
- "grep 'orchestration service not found'"; then
- echo "SUM HEAT NOT INSTALLED"
- exit 1
-fi
-
-until node_ssh controller "$AUTH; openstack stack list" >/dev/null 2>&1; do
- sleep 1
-done
-
-function check_for_other_vms {
- echo "Verifying that no other instance VMs are left."
- (
- source "$CONFIG_DIR/admin-openstackrc.sh"
- if [ "$(openstack server list --all-projects | wc -l)" -gt 4 ]; then
- echo "WARNING Existing VMs found. There may not be enough resources" \
- "for this test."
- openstack server list --all-projects
- fi
- )
-}
-check_for_other_vms
-
-echo "Creating a test heat template."
-
-# FIXME mykey is created in launch_instance_private_net.sh
-
-# Note: unlike install-guide, we use m1.nano (default flavors like m1.tiny
-# are no longer installed)
-node_ssh controller "cat > demo-template.yml" << HEAT
-heat_template_version: 2015-10-15
-description: Launch a basic instance with CirrOS image using the
- ``m1.nano`` flavor, ``mykey`` key, and one network.
-
-parameters:
- NetID:
- type: string
- description: Network ID to use for the instance.
-
-resources:
- server:
- type: OS::Nova::Server
- properties:
- image: cirros
- flavor: m1.nano
- key_name: mykey
- networks:
- - network: { get_param: NetID }
-
-outputs:
- instance_name:
- description: Name of the instance.
- value: { get_attr: [ server, name ] }
- instance_ip:
- description: IP address of the instance.
- value: { get_attr: [ server, first_address ] }
-HEAT
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Create m1.nano flavor
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# Nova does no longer create default flavors:
-# http://docs.openstack.org/releasenotes/nova/unreleased.html 2016-09-25
-(
-echo
-
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-if openstack flavor list | grep m1.nano; then
- echo "Proceeding, m1.nano flavor exists."
-else
- echo "Creating m1.nano flavor which is just big enough for CirrOS."
- openstack flavor create --id 0 --vcpus 1 --ram 64 --disk 1 m1.nano
-fi
-
-echo "Current flavors:"
-openstack flavor list
-echo
-)
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Create a stack
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-TEST_STACK_NAME=stack
-DEMO_NET=provider
-NET_ID=$(node_ssh controller "$AUTH; openstack network list" | awk "/ $DEMO_NET / { print \$2 }")
-
-echo "NET_ID: $NET_ID"
-
-node_ssh controller "$AUTH; openstack stack create -t demo-template.yml \
- --parameter 'NetID=$NET_ID' $TEST_STACK_NAME"
-
-echo "Verifying successful creation of stack."
-
-cnt=0
-echo "openstack stack list"
-until node_ssh controller "$AUTH; openstack stack list" 2>/dev/null | grep "CREATE_COMPLETE"; do
- cnt=$((cnt + 1))
- if [ $cnt -eq 60 ]; then
- # Print current stack list to help with debugging
- echo
- node_ssh controller "$AUTH; openstack stack list"
- echo "Heat stack creation failed. Exiting."
- echo "[Warning]: Please debug heat services on the
- controller node. Heat may not work."
- exit 1
- else
- sleep 1
- echo -n "."
- fi
-done
-
-echo "Showing the name and IP address of the instance."
-node_ssh controller "$AUTH; openstack stack output show --all $TEST_STACK_NAME; nova list"
-
-echo "Deleting the test stack."
-heat_stack_id=$(node_ssh controller "$AUTH; openstack stack list" | awk "/ $TEST_STACK_NAME / {print \$2}")
-
-# Log memory use
-sed 's|^|SUM HEAT MEM |' <<< "$(free -m) "
-
-node_ssh controller "$AUTH; openstack stack delete $heat_stack_id"
-
-echo -n "Waiting for test stack to disappear."
-while node_ssh controller "$AUTH; openstack stack list|grep $heat_stack_id" >/dev/null 2>&1; do
- sleep 1
- echo -n .
-done
-echo
diff --git a/labs/osbash/scripts/test/launch_instance_private_net.sh b/labs/osbash/scripts/test/launch_instance_private_net.sh
deleted file mode 100755
index 75357021..00000000
--- a/labs/osbash/scripts/test/launch_instance_private_net.sh
+++ /dev/null
@@ -1,814 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-source "$CONFIG_DIR/demo-openstackrc.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Launch a demo instance.
-#------------------------------------------------------------------------------
-
-# Packets from the instance VM destined for the Internet will have its
-# floating IP address as the sender address. For your instance VM to
-# get Internet access, you will probably have to configure masquerading
-# on your host computer.
-
-# On Linux, turning on masquerading may look something like this:
-
-# echo "1" > /proc/sys/net/ipv4/ip_forward
-# modprobe ip_tables
-# modprobe ip_conntrack
-# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
-# iptables -A FORWARD -i eth0 -o vboxnet2 -m state \
-# --state RELATED,ESTABLISHED -j ACCEPT
-# iptables -A FORWARD -i vboxnet2 -o eth0 -j ACCEPT
-
-# Set this true if you have masquerading enabled to allow instance VMs access
-# to the Internet.
-: ${MASQUERADING:=true}
-
-# Set this true if you want the instance to use the Google Public DNS name
-# server. The default uses dnsmasq running on a node.
-: ${EXT_DNS:=true}
-
-DEMO_INSTANCE_NAME=private-instance
-
-echo "SUM --- BEGIN"
-
-function ssh_no_chk_node {
- ssh_no_chk -i "$HOME/.ssh/osbash_key" "$@"
-}
-
-function ssh_no_chk {
- echo "ssh $*"
- # Options set to disable strict host key checking and related messages.
- ssh \
- -o "UserKnownHostsFile /dev/null" \
- -o "StrictHostKeyChecking no" \
- -o LogLevel=error \
- "$@"
-}
-
-# Work around neutron client failing with unsupported locale settings
-if [[ "$(neutron --help)" == "unsupported locale setting" ]]; then
- echo "Locale not supported on node, setting LC_ALL=C."
- export LC_ALL=C
-fi
-
-function wait_for_service {
- local node=$1
- local service=$2
- local cnt=0
- echo -n "Node $node, service $service:"
- until ssh_no_chk_node "$node" service "$service" status | \
- grep -q "active (running)"; do
- cnt=$((cnt + 1))
- if [ $((cnt % 150)) -eq 0 ]; then
- echo " does not seem to come up. Forcing restart."
-
- echo
- echo "SUM ERROR $service on node $node not coming up."
- ssh_no_chk_node "$node" \
- sudo service "$service" restart
- SERVICE_RESTARTS="${SERVICE_RESTARTS:-""}$service@$node "
- fi
- sleep 2
- echo -n .
- done
- echo " up"
-}
-
-echo "Running on host: $(hostname)"
-
-echo "Checking network connection to compute1 node."
-ping -c1 compute1
-echo
-
-echo "Checking services on controller node."
-wait_for_service controller neutron-l3-agent
-wait_for_service controller neutron-dhcp-agent
-wait_for_service controller neutron-metadata-agent
-echo
-
-echo "Checking services on compute1 node."
-wait_for_service compute1 nova-compute
-echo
-
-function wait_for_nova_compute {
-
- echo " Waiting for nova-compute service in state 'up'."
- if ssh_no_chk_node compute1 service nova-compute status | \
- grep -q "start/running"; then
- echo -n " Service is up, waiting (may take a few minutes)."
- fi
-
- local cnt=0
- local start=$(date +%s)
- (
- source "$CONFIG_DIR/admin-openstackrc.sh"
- until openstack compute service list --service nova-compute | grep -q "| up "; do
- cnt=$((cnt + 1))
- sleep 5
- if ssh_no_chk_node compute1 service nova-compute status | \
- grep -q "start/running"; then
- if [ $cnt -eq 300 ]; then
- # This should never happen.
- echo "SUM ABORT nova-compute status remains down while service is up."
- echo "Aborting."
- exit 1
- fi
- echo -n .
- else
- echo
- echo "SUM ERROR nova-compute on compute node has died."
- echo "Restarting nova-compute on compute node."
- ssh_no_chk_node compute1 \
- sudo service nova-compute restart
- echo "SUM ERROR nova-compute restart in wait_for_nova_compute"
- fi
- done
- )
- echo
-}
-
-function wait_for_nova_services {
- local start=$(date +%s)
-
- (
- source "$CONFIG_DIR/admin-openstackrc.sh"
- echo "Checking for nova services in openstack compute service list."
-
- echo -n " nova-scheduler"
- until openstack compute service list --service nova-scheduler | \
- grep -q '| up '; do
- sleep 1
- echo -n .
- done
- echo
-
- echo -n " nova-conductor"
- until openstack compute service list --service nova-conductor | \
- grep -q '| up '; do
- sleep 1
- echo -n .
- done
- echo
-
- echo -n " nova-compute"
- if ! openstack compute service list --service nova-compute | \
- grep -q '| up '; then
- wait_for_nova_compute
- fi
- echo
- )
-
- echo
- echo "SUM wait for nova services: $(($(date +%s) - start))"
-}
-
-wait_for_nova_services
-
-(
-source "$CONFIG_DIR/admin-openstackrc.sh"
-echo "All services are ready:"
-openstack compute service list
-echo
-)
-
-function show_compute_resource_usage {
- echo "openstack server list:"
- openstack server list
- (
- source "$CONFIG_DIR/admin-openstackrc.sh"
- echo "As admin user, openstack host list:"
- openstack host list
- echo "As admin user, openstack host show compute1:"
- openstack host show compute1
- )
-}
-
-function wait_for_neutron_agents {
- local agent_list=$LOG_DIR/test-agent.list
- local start=$(date +%s)
- echo -n "Waiting for agents in openstack network agent list."
- (
- source "$CONFIG_DIR/admin-openstackrc.sh"
- openstack network agent list | sort > "$agent_list"
- local out=$(grep " :-) " "$agent_list" || rc=$?)
- if [ -n "$out" ]; then
- echo
- echo "$out"
- fi
- while : ; do
- openstack network agent list | sort > "$agent_list.new"
- out=$(comm -13 "$agent_list" "$agent_list.new")
- if [ -n "$out" ]; then
- echo
- echo "$out"
- fi
- if ! grep -q " XXX " "$agent_list"; then
- break
- fi
- mv "$agent_list.new" "$agent_list"
- sleep 1
- echo -n .
- done
- echo
- echo "All agents are ready."
- openstack network agent list
- echo
- )
- echo "SUM wait for neutron agents: $(($(date +%s) - start))"
-}
-
-wait_for_neutron_agents
-
-#------------------------------------------------------------------------------
-# Launch an instance
-# https://docs.openstack.org/install-guide/launch-instance.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Create m1.nano flavor
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-(
-echo
-echo "Check if m1.nano flavor is existing or else, create the flavor."
-
-source "$CONFIG_DIR/admin-openstackrc.sh"
-echo "Current flavors:"
-openstack flavor list
-
-if openstack flavor list | grep m1.nano; then
- echo "Proceeding, m1.nano flavor exists."
-else
- echo "Creating m1.nano flavor which is just big enough for CirrOS."
- openstack flavor create --id 0 --vcpus 1 --ram 64 --disk 1 m1.nano
-fi
-echo
-)
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Generate a key pair
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-if [ ! -f ~/.ssh/id_rsa ]; then
- echo "Generating an ssh key pair (saved to ~/.ssh/id_rsa*)."
- # For training cluster: no password protection on keys to make scripting
- # easier
- ssh-keygen -f ~/.ssh/id_rsa -N ""
-fi
-
-function check_demo_key {
- echo -n "Checking if 'mykey' is already in our OpenStack environment: "
- if openstack keypair show mykey >/dev/null 2>&1; then
- echo "yes."
-
- echo -n "Checking if the 'mykey' key pair matches our ssh key: "
-
- ssh_key=$(< ~/.ssh/id_rsa.pub awk '{print $2}')
- stored_key=$(openstack keypair show --public-key mykey | \
- awk '{print $2}')
-
- if [ "$ssh_key" != "$stored_key" ]; then
- echo "no."
- echo "Removing the 'mykey' from the OpenStack envirnoment."
- openstack keypair delete mykey
- else
- echo "yes."
- fi
- else
- echo "no."
- fi
-}
-check_demo_key
-
-if ! openstack keypair show mykey 2>/dev/null; then
- echo "Adding the public key to our OpenStack environment."
- openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
-fi
-
-
-echo "Verifying addition of the public key."
-openstack keypair list
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Add security group rules
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo
-echo "Permitting ICMP (ping) to our instances."
-openstack security group rule create --proto icmp default || rc=$?
-if [ ${rc:-0} -ne 0 ]; then
- echo "Rule was already there."
-fi
-
-echo
-echo "Permitting secure shell (SSH) access to our instances."
-openstack security group rule create --proto tcp --dst-port 22 default || rc=$?
-if [ ${rc:-0} -ne 0 ]; then
- echo "Rule was already there."
-fi
-
-echo
-echo "Verifying security group rules."
-openstack security group list
-openstack security group show default
-
-#------------------------------------------------------------------------------
-# Launch an instance on the self-service network
-# https://docs.openstack.org/install-guide/launch-instance-selfservice.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Determine instance options
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Listing available flavors."
-openstack flavor list
-
-echo "Listing available images."
-openstack image list
-
-# Wait for neutron to start
-wait_for_neutron
-
-echo "Listing available networks."
-openstack network list
-
-PRIVATE_SUBNET=selfservice
-
-PRIVATE_NET_ID=$(openstack network list | awk "/ $PRIVATE_SUBNET / {print \$2}")
-echo "ID for demo-net tenant network: $PRIVATE_NET_ID"
-
-echo "Listing available security groups."
-openstack security group list
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# XXX Network settings
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Settings for $PRIVATE_SUBNET:"
-openstack subnet show $PRIVATE_SUBNET
-echo
-
-echo "Checking for DNS name servers in subnet $PRIVATE_SUBNET" \
- "(passed to booting instance VMs)."
-current_dns_string=$(openstack subnet show -c dns_nameservers \
- -fvalue $PRIVATE_SUBNET)
-if [ "$EXT_DNS" = true ]; then
- if [ -n "$current_dns_string" ]; then
- echo "DNS name server already set ($current_dns_string)."
- else
- echo "Setting DNS name server for subnet $PRIVATE_SUBNET."
- openstack subnet set $PRIVATE_SUBNET --dns-nameserver 8.8.8.8
- fi
-else
- echo "Clearing DNS name server(s) for subnet $PRIVATE_SUBNET."
- # Servers are comma separated (e.g., "8.8.4.4, 8.8.8.8")
- dns_servers=$(echo $current_dns_string | tr ' ,' '\n')
- for server in $dns_servers; do
- openstack subnet unset --dns-nameserver $server $PRIVATE_SUBNET
- done
-fi
-
-echo "Settings for $PRIVATE_SUBNET:"
-openstack subnet show $PRIVATE_SUBNET
-echo
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Clean out old instances
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-openstack server list
-openstack server list | awk " / $DEMO_INSTANCE_NAME / {print \$2}" | while read instance; do
- echo "Removing instance $DEMO_INSTANCE_NAME ($instance)."
- openstack server delete "$instance"
-done
-echo -n "Waiting for removed instances to disappear (may take > 1 min)."
-while openstack server list|grep -q "$DEMO_INSTANCE_NAME"; do
- sleep 1
- echo -n .
-done
-echo
-
-function check_for_other_vms {
- echo "Verifying that no other instance VMs are left."
- (
- source "$CONFIG_DIR/admin-openstackrc.sh"
- if [ "$(openstack server list --all-projects | wc -l)" -gt 4 ]; then
- echo "SUM ERROR Unexpected VMs found. Aborting..."
- openstack server list --all-projects
- exit 1
- fi
- )
-}
-check_for_other_vms
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-NOVA_SCHED_LOG=/var/log/nova/nova-scheduler.log
-NOVA_API_LOG=/var/log/nova/nova-api.log
-
-
-VM_LAUNCHES=0
-
-function request_instance {
- # Keep a copy of current state of nova-scheduler.log
- sudo cp -vf $NOVA_SCHED_LOG $NOVA_API_LOG /tmp
-
- if [ -n "${instance_info:-""}" ]; then
- rm -f "$instance_info"
- else
- instance_info=$LOG_DIR/test-instance.info
- echo "Instance info: $instance_info"
- fi
-
- echo "Requesting an instance."
- openstack server create \
- --flavor m1.nano \
- --image "$CIRROS_IMG_NAME" \
- --nic net-id="$PRIVATE_NET_ID" \
- --security-group default \
- --key-name mykey \
- "$DEMO_INSTANCE_NAME" > "$instance_info"
- VM_LAUNCHES=$(( VM_LAUNCHES + 1 ))
-}
-
-BOOT_LOG=$LOG_DIR/test-instance.boot
-echo "Boot log: $BOOT_LOG"
-
-function save_boot_log {
- local rc=0
- rm -f "$BOOT_LOG"
- openstack console log show "$DEMO_INSTANCE_NAME" >"$BOOT_LOG" 2>&1 || rc=$?
- if [ $rc -ne 0 ]; then
- echo >&2 "openstack console log show returned error status $rc"
- fi
- return $rc
-}
-
-function explain_instance_failure {
- cat << TXT_INSTANCE_FAILURE
-
- After deleting an instance, it can take nova up to a minute to realize that
- the compute node is free. Under tight space constraints, this becomes a
- common source of failure.
-
- As an admin, we could list hosts (including compute hosts):
-
- $ openstack host list
-
- And check resource usage in description of host 'compute':
-
- $ openstack host show compute1
-
- As a regular user, we would have to keep trying for up to a minute and hope
- it works soon.
-
- The fastest way to update the database, however, is to restart nova-compute
- on the compute node.
-
-TXT_INSTANCE_FAILURE
-}
-
-function status_409_fixed {
- echo "Checking log files for cause of failure."
-
- if sudo comm -13 /tmp/nova-scheduler.log $NOVA_SCHED_LOG |
- grep "has not been heard from in a while"; then
- echo
- echo "SUM ERROR Missing connection with nova-compute on compute node."
- echo "(Did controller node boot after compute node?)"
- echo
- elif sudo comm -13 /tmp/nova-scheduler.log $NOVA_SCHED_LOG |
- grep "Filter RamFilter returned 0 hosts"; then
- echo "SUM ERROR Filter RamFilter returned 0 hosts"
- explain_instance_failure
- show_compute_resource_usage
- elif sudo comm -13 /tmp/nova-api.log $NOVA_API_LOG |
- grep "HTTP exception thrown:"; then
- # Just waiting should be enough to fix this
- echo -n "Waiting for HTTP status 409 to cure itself."
- local cnt=0
- until [ $cnt -eq 5 ]; do
- if ! console_status_409; then
- HTTP_EXCEPTIONS="${HTTP_EXCEPTIONS:-""}$cnt "
- echo "okay"
- # We can continue with this instance
- return 0
- fi
- cnt=$((cnt + 1))
- sleep 2
- echo -n .
- done
- HTTP_EXCEPTIONS="${HTTP_EXCEPTIONS:-""}${cnt}-fail "
- echo "failed"
- else
- echo "Unknown reason. See for yourself."
- echo "nova-scheduler.log:"
- sudo comm -13 /tmp/nova-scheduler.log $NOVA_SCHED_LOG
- echo "nova-api.log:"
- sudo comm -13 /tmp/nova-api.log $NOVA_API_LOG
- echo "SUM ABORT Unknown 409 error"
- exit 1
- fi
- # Not fixed, need to try with new VM
- return 1
-}
-
-function console_status_409 {
- ! save_boot_log 2>/dev/null &&
- grep -q "is not ready (HTTP 409)" "$BOOT_LOG"
-}
-
-function console_status_404 {
- ! save_boot_log 2>/dev/null &&
- grep -q "Unable to get console (HTTP 404)" "$BOOT_LOG"
-}
-
-function instance_status {
- openstack server list | awk "/$DEMO_INSTANCE_NAME/ {print \$6}"
-}
-
-function instance_status_is {
- local status=$1
- openstack server list | grep "$DEMO_INSTANCE_NAME" | grep -q "$status"
-}
-
-while : ; do
- echo "###################################################################"
- echo "Launching an instance VM ($VM_LAUNCHES)."
- request_instance > /dev/null
-
- if console_status_409; then
- echo "openstack console log show returned:"
- cat "$BOOT_LOG"
- echo
-
- if ! status_409_fixed; then
-
- echo "Instance build failed."
- echo "Deleting failed instance VM."
- openstack server delete "$DEMO_INSTANCE_NAME"
-
- echo "Checking nova-compute on the compute node."
- wait_for_nova_compute
-
- echo -n "Requesting new instance VMs until it works."
- cnt=0
- while : ; do
- request_instance >/dev/null
- if console_status_409; then
- openstack server delete "$DEMO_INSTANCE_NAME"
- cnt=$((cnt + 1))
- if [ $cnt -eq 5 ]; then
- echo
- echo "SUM ERROR console status remains 409."
- echo "Restarting nova-compute on compute node."
- ssh_no_chk_node compute1 \
- sudo service nova-compute restart
- echo "SUM ERROR nova-compute restart (status 409)"
- fi
- sleep 2
- echo -n .
- else
- # Either no error or a different error
- echo
- break
- fi
- done
- fi
- fi
-
- if console_status_404; then
- echo "openstack console log show returned:"
- cat "$BOOT_LOG"
- echo
-
- echo -n "Waiting for console."
- # Console status 404 may persist after instance status becomes ERROR.
- while console_status_404 && instance_status_is BUILD; do
- sleep 1
- echo -n .
- done
- echo
- if ! console_status_404; then
- echo "Console status is no longer 404."
- fi
-
- fi
-
- echo -n "Waiting for instance to get out of BUILD status."
- while instance_status_is BUILD; do
- sleep 1
- echo -n .
- done
- echo
-
- if instance_status_is ERROR; then
- echo "Instance VM status: ERROR"
-
- if sudo comm -13 /tmp/nova-scheduler.log $NOVA_SCHED_LOG |
- grep "Filter RetryFilter returned 0 hosts"; then
- echo "SUM ERROR RetryFilter returned 0 hosts"
- show_compute_resource_usage
- echo "Restarting nova-compute on compute node."
- ssh_no_chk_node compute1 \
- sudo service nova-compute restart
- echo "SUM ERROR nova-compute restart (RetryFilter)"
- fi
-
- echo "Deleting failed instance VM."
- openstack server delete "$DEMO_INSTANCE_NAME"
- elif instance_status_is ACTIVE; then
- echo "Instance VM status: ACTIVE."
- break
- fi
-
- if [ $VM_LAUNCHES -eq 10 ]; then
- echo "SUM ABORT $VM_LAUNCHES launch attempts failed. Giving up."
- exit 1
- fi
-done
-
-if [ "${HTTP_EXCEPTIONS:-0}" != "0" ]; then
- echo "SUM ERROR HTTP exceptions: ${HTTP_EXCEPTIONS:-0}"
-fi
-
-echo -n "Waiting for DHCP discover."
-until grep -q "Sending discover..." "$BOOT_LOG"; do
- sleep 2
- echo -n .
- save_boot_log
-done
-echo
-
-echo -n "Waiting for DHCP success."
-until grep -q "^Lease of" "$BOOT_LOG"; do
- DHCP_WAIT=$((${DHCP_WAIT:-0} + 1))
- if grep "No lease, failing" "$BOOT_LOG"; then
- echo "SUM ABORT DHCP wait: fail (${DHCP_WAIT:-0})"
- echo "Aborting."
- exit 1
- fi
- sleep 2
- echo -n .
- save_boot_log
-done
-echo
-echo "SUM DHCP wait: ${DHCP_WAIT:-0}"
-echo
-
-echo -n "Waiting for metadata success."
-until grep -q "successful after" "$BOOT_LOG"; do
- if grep "failed to read iid from metadata" "$BOOT_LOG"; then
- echo "SUM ABORT failed to get metadata"
- echo "Aborting."
- exit 1
- fi
- sleep 2
- echo -n .
- save_boot_log
-done
-echo
-
-echo -n "Waiting for login prompt."
-until grep -q "$DEMO_INSTANCE_NAME login:" "$BOOT_LOG"; do
- sleep 2
- echo -n .
- save_boot_log
-done
-echo
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Access the instance using a virtual console
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Obtaining a VNC session URL for our instance."
-openstack console url show "$DEMO_INSTANCE_NAME"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Access the instance remotely
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo
-echo "Creating a floating IP address on the public network."
-floating_ip=$(openstack floating ip create provider | awk '/ floating_ip_address / {print $4}')
-openstack floating ip list
-
-echo
-echo "Associating the floating IP address with our instance."
-openstack server add floating ip "$DEMO_INSTANCE_NAME" "$floating_ip"
-
-echo
-echo "Checking the status of your floating IP address."
-openstack server list
-
-echo
-echo -n "Verifying network connectivity to instance VM (may take 2+ min)."
-# Since Juno, the floating IP often takes a long time to become pingable.
-# Hopefully, this will be fixed, but for the time being we just ping the
-# floating IP until we get a reply (or we reach a time limit and give up).
-function patient_ping {
- local ip=$1
- local cnt=0
-
- while : ; do
- echo -n .
- sleep 1
-
- # Ping the instance VM every ten seconds
- if [[ $((cnt % 10)) -eq 0 ]]; then
- if ping -c1 "$ip" > /dev/null ; then
- echo
- ping -c1 "$ip"
- echo "SUM ping instance VM after $cnt seconds."
- break
- fi
- fi
-
- # Abort if it takes too long
- if [[ $cnt -gt 600 ]]; then
- echo
- echo "SUM ERROR no ping for instance VM in $cnt seconds. Aborting."
- exit 1
- fi
-
- cnt=$((cnt + 1))
- done
-}
-
-patient_ping "$floating_ip"
-
-echo
-echo "Accessing our instance using SSH from the controller node."
-ssh_no_chk "cirros@$floating_ip" uptime
-
-echo
-echo "Interface configuration on instance VM."
-ssh_no_chk "cirros@$floating_ip" /sbin/ip addr
-
-echo
-echo "Routing information on instance VM."
-ssh_no_chk "cirros@$floating_ip" /sbin/route -n
-
-echo
-echo "/etc/resolv.conf on instance VM."
-ssh_no_chk "cirros@$floating_ip" cat /etc/resolv.conf
-
-echo
-echo "Pinging our own floating IP from inside the instance."
-ssh_no_chk "cirros@$floating_ip" ping -c1 "$floating_ip"
-
-function test_internet {
- if [ "$MASQUERADING" = true ]; then
- local ext_ping=1
- echo
- echo "Pinging Google Public DNS name server."
- until ssh_no_chk "cirros@$floating_ip" ping -c1 8.8.8.8; do
- if [ $ext_ping -eq 3 ]; then
- echo "Failed. Giving up."
- echo "Check IP masquerading (Internet sharing) for the VMs" \
- "on the host system."
- echo "SUM ERROR ping Internet: failed ($ext_ping)"
- ext_ping="$ext_ping (failed)"
- return 0
- fi
- echo
- echo "Trying again in 1 s."
- sleep 1
- ext_ping=$((ext_ping + 1))
- done
- echo "SUM ping Internet: $ext_ping"
-
- echo
- echo "Testing DNS name resolution within instance VM."
- ssh_no_chk "cirros@$floating_ip" ping -c1 openstack.org
- fi
-}
-
-test_internet
-
-# Log memory use
-sed 's|^|SUM MEM |' <<< "$(free -m) "
-
-echo
-echo "Summary"
-echo "======="
-echo "SUM service restarts: ${SERVICE_RESTARTS:--}"
-echo "SUM instance launches: $VM_LAUNCHES"
-echo "SUM END"
-
-echo
-echo "Try this, it should work:"
-echo "Command: 'ssh cirros@$floating_ip' [ password: 'gocubsgo' ]"
-
diff --git a/labs/osbash/scripts/test/test_horizon.sh b/labs/osbash/scripts/test/test_horizon.sh
deleted file mode 100755
index 601c91cb..00000000
--- a/labs/osbash/scripts/test/test_horizon.sh
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$CONFIG_DIR/config.controller"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-## This script access the OpenStack installation trough the dashboard by making
-## wget or curl requests (whichever is available).
-## It goes in this order:
-## 1: retrieve cookie
-## 2: use that cookie for authenticating with user/password and get the session id
-## 3: use the session id and token for getting the (provider) network id
-## 4: similar to step 3 but get the ID of the cirros image
-## 5: launch an instance using the data from steps 2,3 and 4
-
-echo "Testing horizon."
-
-IP=$(echo "$NET_IF_1" |awk '{print $2}')
-AUTH_URL="http://$IP/horizon/auth/login/"
-DOMAIN="default"
-REGION="default"
-USER=${ADMIN_USER_NAME}
-PASSWORD=${ADMIN_PASS}
-OUTPUT_DIR="test_horizon_out"
-COOKIE_FILE="$OUTPUT_DIR/cookie.txt"
-OUTPUT_FILE1="$OUTPUT_DIR/1.get_cookie.html"
-OUTPUT_FILE2="$OUTPUT_DIR/2.check_credentials.html"
-OUTPUT_FILE3="$OUTPUT_DIR/3.check_net_id.html"
-OUTPUT_FILE4="$OUTPUT_DIR/4.check_image_id.html"
-OUTPUT_FILE5="$OUTPUT_DIR/5.launch_instance.html"
-
-echo "Clean previous files and clear variables before starting."
-rm -f $COOKIE_FILE $OUTPUT_FILE1 $OUTPUT_FILE2 $OUTPUT_FILE3 $OUTPUT_FILE4 \
- $OUTPUT_FILE5
-
-mkdir -p $OUTPUT_DIR
-
-# Ensure wget or curl are installed
-echo "Testing availability of wget or curl."
-if which wget &> /dev/null ; then
- REQUEST_TOOL="wget"
-elif which curl &> /dev/null; then
- REQUEST_TOOL="curl"
-else
- echo "ERROR: neither wget nor curl were found. Please install one with:"
- echo " apt -y install wget"
- exit 1
-fi
-
-echo "Found $REQUEST_TOOL."
-
-function request_cmd {
- # Usage:
- # request_cmd URL OUT_FILE [POST_DATA] [REFERER]
-
- URL=$1
- OUTPUT_FILE=$2
-
- if [[ -v 3 ]];then
- DATA=$3
- fi
-
- if [[ -v 4 ]];then
- REFERER=$4
- fi
-
- POST_ARG=""
- REFERER_ARG=""
-
- if [ "$REQUEST_TOOL" = "wget" ]; then
-
- if [ -f "$COOKIE_FILE" ];then
- COOKIE_ARG="--load-cookies=$COOKIE_FILE"
- else
- COOKIE_ARG=""
- fi
-
- if [[ -v DATA ]]; then
- POST_ARG="--post-data=$DATA"
- fi
-
- if [[ -v REFERER ]]; then
- REFERER_ARG="--referer=$REFERER"
- fi
-
- #echo "wget --quiet --keep-session-cookies --save-cookies $COOKIE_FILE \
- # "$COOKIE_ARG" "$POST_ARG" "$REFERER_ARG" \
- # --output-document=$OUTPUT_FILE $URL"
- #echo
- wget --quiet --keep-session-cookies --save-cookies $COOKIE_FILE \
- $COOKIE_ARG $POST_ARG $REFERER_ARG \
- --output-document="$OUTPUT_FILE" "$URL"
-
- elif [ "$REQUEST_TOOL" = "curl" ]; then
-
- [[ -v DATA ]] && POST_ARG="-d $DATA"
- [[ -v REFERER ]] && REFERER_ARG="--referer $REFERER"
-
- curl -L -c $COOKIE_FILE -b $COOKIE_FILE $POST_ARG --output "$OUTPUT_FILE"\
- $REFERER_ARG -s "$URL"
- fi
-}
-
-# Step 1: get the cookie
-echo "Retrieving the cookie from $AUTH_URL."
-request_cmd "$AUTH_URL" $OUTPUT_FILE1
-
-# The "TOKEN" variable is the "Cross-site request forgery" prevention token
-# It prevents man in the middle attacks
-TOKEN=$(grep csrftoken $COOKIE_FILE | sed 's/^.*csrftoken\s*//')
-
-# This data is what is going to be passed as the $_POST of the http request
-DATA="username=$USER&password=$PASSWORD&domain=$DOMAIN®ion=$REGION&csrfmiddlewaretoken=$TOKEN"
-
-# Step 2: check the login credentials and obtains the session ID
-echo "Authenticating with the $USER credentials."
-request_cmd "$AUTH_URL" $OUTPUT_FILE2 "$DATA"
-
-
-# Check that "sessionid" appears in the cookie file
-# This SESSIONID keeps the session open to avoid sending the user/password
-# at every new request
-SESSIONID=$(grep sessionid $COOKIE_FILE | sed 's/^.*sessionid\s*//')
-if [ -z "$SESSIONID" ]; then
- echo "Error: sessionid not present on file $COOKIE_FILE ...Exiting."
- exit 1
-else
- echo "Login successful."
-fi
-
-# We need a new token, because it changes after step 2
-TOKEN=$(grep csrftoken $COOKIE_FILE | sed 's/^.*csrftoken\s*//')
-
-NET_URL="http://$IP/horizon/project/networks/"
-REFERER="http://$IP/horizon/identity/"
-DATA="login_region='http://controller:5000/v3'&login_domain=default&\
-csrfmiddlewaretoken=$TOKEN&sessionid=$SESSIONID"
-
-# Step 3: Load the page with the networks
-echo "Loading the networks tab and parsing the network ID for provider."
-request_cmd "$NET_URL" $OUTPUT_FILE3 "$DATA" "$REFERER"
-
-# Parse (provider) network ID
-NET_ID=$(grep "provider" $OUTPUT_FILE3 | \
- awk -F"data-object-id=" '{print $2}' | \
- awk -F'"' '{print $2}')
-
-echo "The provider NET_ID is $NET_ID"
-
-#######
-# The following part is broken.
-# The same DATA section works on the previous requests so either the
-# REFERER or the IMG_URL (not likely) have changed since Mitaka
-
-#IMG_URL="http://$IP/horizon/project/images/"
-#DATA="login_region='http://controller:5000/v3'&login_domain=default&\
-#csrfmiddlewaretoken=$TOKEN&sessionid=$SESSIONID"
-
-## Step 4: Load the page with the available images
-#echo "Loading the images tab and parsing the image ID for cirros."
-#request_cmd "$IMG_URL" $OUTPUT_FILE4 "$DATA" "$REFERER"
-#
-## Parse (cirros) image ID
-#IMAGE_ID=$(grep "cirros" $OUTPUT_FILE4 | \
-# awk -F"obj_id=" '{print $2}' | \
-# awk -F'"' '{print $1}')
-#
-#echo "The cirros IMAGE_ID is $IMAGE_ID"
diff --git a/labs/osbash/scripts/ubuntu/apt_init.sh b/labs/osbash/scripts/ubuntu/apt_init.sh
deleted file mode 100755
index 07e5c0a5..00000000
--- a/labs/osbash/scripts/ubuntu/apt_init.sh
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/openstack"
-source "$CONFIG_DIR/localrc"
-source "$LIB_DIR/functions.guest.sh"
-
-indicate_current_auto
-
-exec_logfile
-
-function set_apt_proxy {
- local PRX_KEY="Acquire::http::Proxy"
- local APT_FILE=/etc/apt/apt.conf
-
- if [ -f $APT_FILE ] && grep -q $PRX_KEY $APT_FILE; then
- # apt proxy has already been set (by preseed/kickstart)
- if [ -n "${VM_PROXY-}" ]; then
- # Replace with requested proxy
- sudo sed -i "s#^\($PRX_KEY\).*#\1 \"$VM_PROXY\";#" $APT_FILE
- else
- # No proxy requested -- remove
- sudo sed -i "s#^$PRX_KEY.*##" $APT_FILE
- fi
- elif [ -n "${VM_PROXY-}" ]; then
- # Proxy requested, but none configured: add line
- echo "$PRX_KEY \"$VM_PROXY\";" | sudo tee -a $APT_FILE
- fi
-}
-
-set_apt_proxy
-
-# Use repository redirection for faster repository access.
-# The mirror 'archive.ubuntu.com' points to the closest to your location
-# instead of the 'us.archive.ubuntu.com' ones in United States
-sudo sed -i 's/us.archive.ubuntu.com/archive.ubuntu.com/g' /etc/apt/sources.list
-
-# Get apt index files
-sudo apt update
-
-# ---------------------------------------------------------------------------
-# Enable the OpenStack repository
-# https://docs.openstack.org/install-guide/environment-packages-ubuntu.html
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# NOTE: Using pre-release staging ppa is not documented in install-guide
-# https://launchpad.net/~ubuntu-cloud-archive/+archive/ubuntu/train-staging
-#--------------------------------------------------------------------------
-
-echo "Installing packages needed for add-apt-repository."
-sudo apt -y install software-properties-common
-
-case "$OPENSTACK_RELEASE" in
- train)
- REPO=cloud-archive:train
- SRC_FILE=cloudarchive-train.list
- ;;
- train-proposed)
- REPO=cloud-archive:train-proposed
- SRC_FILE=cloudarchive-train-proposed.list
- ;;
- train-staging)
- REPO=ppa:ubuntu-cloud-archive/train-staging
- SRC_FILE=ubuntu-cloud-archive-ubuntu-train-staging-bionic.list
- ;;
- *)
- echo >&2 "Unknown OpenStack release: $OPENSTACK_RELEASE. Aborting."
- exit 1
- ;;
-esac
-
-echo "Adding cloud repo: $REPO"
-sudo add-apt-repository "$REPO"
-
-# Get index files only for ubuntu-cloud repo but keep standard lists
-if [ -f "/etc/apt/sources.list.d/$SRC_FILE" ]; then
- sudo apt update \
- -o Dir::Etc::sourcelist="sources.list.d/$SRC_FILE" \
- -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
-else
- echo "ERROR: apt source not found: /etc/apt/sources.list.d/$SRC_FILE"
- exit 1
-fi
-
-# Disable automatic updates (they compete with our scripts for the dpkg lock)
-sudo systemctl disable apt-daily.service
-sudo systemctl disable apt-daily.timer
-
-# ---------------------------------------------------------------------------
-# Not in install-guide:
-# Install mariadb-server from upstream repo (mariadb 10.1 shipping with
-# bionic breaks the neutron database upgrade process in OpenStack Train)
-# ---------------------------------------------------------------------------
-
-# Add mariadb repo
-cat << EOF | sudo tee /etc/apt/sources.list.d/mariadb.list
-# bionic mariadb 10.1 breaks neutron DB upgrade process in OpenStack Train
-deb http://downloads.mariadb.com/MariaDB/mariadb-10.3/repo/ubuntu bionic main
-EOF
-
-# Import key required for mariadb
-sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F1656F24C74CD1D8
-
-# Update apt database for mariadb repo
-sudo apt update \
- -o Dir::Etc::sourcelist="sources.list.d/mariadb.list" \
- -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
-
-# Pre-configure database root password in /var/cache/debconf/passwords.dat
-# (the upstream mariadb-server has socket_auth disabled)
-source "$CONFIG_DIR/credentials"
-echo "mysql-server mysql-server/root_password password $DATABASE_PASSWORD" | sudo debconf-set-selections
-echo "mysql-server mysql-server/root_password_again password $DATABASE_PASSWORD" | sudo debconf-set-selections
diff --git a/labs/osbash/scripts/ubuntu/apt_install_mysql.sh b/labs/osbash/scripts/ubuntu/apt_install_mysql.sh
deleted file mode 100755
index 3a3d06d0..00000000
--- a/labs/osbash/scripts/ubuntu/apt_install_mysql.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#-------------------------------------------------------------------------------
-# Controller setup
-#-------------------------------------------------------------------------------
-
-
-DB_IP=$(get_node_ip_in_network "$(hostname)" "mgmt")
-echo "Will bind MySQL server to $DB_IP."
-
-#------------------------------------------------------------------------------
-# Install and configure the database server
-# https://docs.openstack.org/install-guide/environment-sql-database-ubuntu.html
-#------------------------------------------------------------------------------
-
-echo "Sourced MySQL password from credentials: $DATABASE_PASSWORD"
-
-#sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password '$DATABASE_PASSWORD''
-#sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password '$DATABASE_PASSWORD''
-
-echo "Installing MySQL (MariaDB)."
-sudo apt install -y mariadb-server python-mysqldb
-
-# Not in the install-guide
-echo "Sanity check: check if password login works for root."
-sudo mysql -u root -p"$DATABASE_PASSWORD" -e quit
-
-# Not in install-guide
-# To drop socket auth for root user and use root password:
-# sudo mysql -u "root" -e "use mysql; update user set plugin='' where user='root'; update user set password=PASSWORD('$DATABASE_PASSWORD') where user='root'; flush privileges;"
-
-conf=/etc/mysql/mariadb.conf.d/99-openstack.cnf
-
-echo "Creating $conf."
-echo '[mysqld]' | sudo tee $conf
-
-echo "Configuring MySQL to accept requests from management network ($DB_IP)."
-iniset_sudo $conf mysqld bind-address "$DB_IP"
-
-iniset_sudo $conf mysqld default-storage-engine innodb
-iniset_sudo $conf mysqld innodb_file_per_table on
-iniset_sudo $conf mysqld max_connections 4096
-iniset_sudo $conf mysqld collation-server utf8_general_ci
-iniset_sudo $conf mysqld character-set-server utf8
-
-echo "Restarting MySQL service."
-# Close the file descriptor or the script will hang due to open ssh connection
-sudo service mysql restart 2>/dev/null
-
-# Difference to install-guide: not running mysql_secure_installation
diff --git a/labs/osbash/scripts/ubuntu/apt_pre-download.sh b/labs/osbash/scripts/ubuntu/apt_pre-download.sh
deleted file mode 100755
index 260bcf9b..00000000
--- a/labs/osbash/scripts/ubuntu/apt_pre-download.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/openstack"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-function apt_download {
- echo "apt_download: $*"
- sudo apt install -y --download-only "$@"
-}
-
-# Download packages for all nodes
-
-# MySQL, RabbitMQ
-apt_download mariadb-server python-mysqldb rabbitmq-server
-
-# NoSQL database (MongoDB)
-apt_download mongodb-server mongodb-clients python-pymongo
-
-# Other dependencies
-apt_download python-argparse python-dev python-pip
-
-# Keystone
-apt_download keystone python3-openstackclient apache2 \
- memcached python-memcache
-
-# Glance
-apt_download glance python3-glanceclient
-
-# Nova Controller
-apt_download nova-api nova-conductor nova-novncproxy nova-scheduler
-
-# Placement Controller
-apt_download placement-api
-
-# Neutron Controller
-apt_download neutron-server neutron-plugin-ml2 \
- neutron-linuxbridge-agent neutron-dhcp-agent \
- neutron-metadata-agent neutron-l3-agent python3-neutronclient conntrack
-
-# Cinder Controller
-apt_download cinder-api cinder-scheduler python3-cinderclient
-
-# Horizon
-apt_download openstack-dashboard
-
-# Cinder Volumes
-apt_download lvm2 cinder-volume thin-provisioning-tools
-
-# Nova Compute
-apt_download nova-compute nova-compute-qemu qemu sysfsutils
-
-# Neutron Compute
-apt_download neutron-linuxbridge-agent
-
-# Heat
-apt_download heat-api heat-api-cfn heat-engine python3-heatclient
-
-# Swift Controller
-apt_download swift swift-proxy python3-swiftclient \
- python3-keystoneclient python3-keystonemiddleware \
- memcached
-
-# Swift Storage
-apt_download xfsprogs rsync \
- swift swift-account swift-container swift-object
-
-# PXE server
-apt_download bind9 isc-dhcp-server apache2 tftpd-hpa inetutils-inetd vlan \
- iptables-persistent
diff --git a/labs/osbash/scripts/ubuntu/apt_upgrade.sh b/labs/osbash/scripts/ubuntu/apt_upgrade.sh
deleted file mode 100755
index 5c5b58e7..00000000
--- a/labs/osbash/scripts/ubuntu/apt_upgrade.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/openstack"
-source "$LIB_DIR/functions.guest.sh"
-
-indicate_current_auto
-
-exec_logfile
-
-#------------------------------------------------------------------------------
-# Finalize the installation
-# https://docs.openstack.org/install-guide/environment-packages-ubuntu.html
-#------------------------------------------------------------------------------
-
-# Note: We assume that apt_init.sh set up repos and updated the apt index files
-
-# Upgrade installed packages and the kernel
-# Keep our changes to /etc/sudoers from tripping up apt
-sudo DEBIAN_FRONTEND=noninteractive apt \
- -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
- -y upgrade
-sudo apt -y dist-upgrade
-
-# Clean apt cache
-sudo apt -y autoremove
-sudo apt -y clean
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install OpenStack client (install-guide)
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Installing OpenStack client."
-sudo apt install -y python3-openstackclient
-
-# Starting with bionic, the Ubuntu LTS switched to a new set of network
-# management. We install and use the legacy tools for the time being.
-sudo apt install -y ifupdown
-
-echo "Installing curl, tree (they are small and useful)."
-sudo apt install -y curl tree
diff --git a/labs/osbash/scripts/ubuntu/barbican/setup_barbican_server.sh b/labs/osbash/scripts/ubuntu/barbican/setup_barbican_server.sh
deleted file mode 100755
index 834b215e..00000000
--- a/labs/osbash/scripts/ubuntu/barbican/setup_barbican_server.sh
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-source "$CONFIG_DIR/credentials"
-
-#------------------------------------------------------------------------------
-# Install Barbican, loosely following
-# https://github.com/cloudkeep/barbican/wiki/Barbican-Quick-Start-Guide
-# https://wiki.openstack.org/wiki/Barbican/Documentation#Installation_Guides
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Prerequisites
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-BARBICAN_DB_USER=barbican
-BARBICAN_DBPASS=barbican_db_secret
-BARBICAN_PASS=barbican_user_secret
-
-echo "Setting up database for barbican."
-setup_database barbican "$BARBICAN_DB_USER" "$BARBICAN_DBPASS"
-
-# This script is not part of the standard install, cache may be stale by now.
-sudo apt update
-
-echo "Installing barbican packages."
-sudo apt install -y barbican-api barbican-worker barbican-keystone-listener
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-barbican_admin_user=barbican
-
-echo -e "\n>>> Creating a barbican user with admin privileges.\n"
-
-openstack user create \
- --domain Default \
- --password "$BARBICAN_PASS" \
- "$barbican_admin_user"
-
-echo -e "\n>>> Adding admin role to service project for barbican user.\n"
-
-openstack role add \
- --project service \
- --user "$barbican_admin_user" \
- admin
-
-echo -e "\n>>> Creating the barbican service.\n"
-
-openstack service create \
- --name barbican \
- --description "Barbican Service" \
- "key-manager"
-
-echo -e "\n>>> Add endpoints for barbican.\n"
-
-openstack endpoint create \
- --region RegionOne "key-manager" \
- public http://controller:9311/
-
-openstack endpoint create \
- --region RegionOne "key-manager" \
- internal http://controller:9311/
-
-# The Ubuntu package configures apache2 to have the admin endpoint on 9312
-openstack endpoint create \
- --region RegionOne "key-manager" \
- admin http://controller:9312/
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Mostly follwoing
-# https://docs.openstack.org/barbican/pike/configuration/keystone.html
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-function get_database_url {
- local db_user=$BARBICAN_DB_USER
- local database_host=controller
-
- echo "mysql+pymysql://$db_user:$BARBICAN_DBPASS@$database_host/barbican"
-}
-
-database_url=$(get_database_url)
-echo "Database connection: $database_url."
-
-echo "Configuring barbican.conf."
-conf=/etc/barbican/barbican.conf
-#iniset_sudo $conf DEFAULT sql_connection "$database_url"
-iniset_sudo $conf DEFAULT sql_connection "$database_url"
-
-echo "Configuring keystone."
-
-echo "Configuring RabbitMQ message queue access."
-TRANSPORT_URL="rabbit://openstack:$RABBIT_PASS@controller"
-iniset_sudo $conf DEFAULT transport_url "$TRANSPORT_URL"
-
-sudo cp $conf $conf.bak
-
-# Configure [keystone_authtoken] section.
-iniset_sudo $conf keystone_authtoken auth_type password
-iniset_sudo $conf keystone_authtoken username "$barbican_admin_user"
-iniset_sudo $conf keystone_authtoken password "$BARBICAN_PASS"
-iniset_sudo $conf keystone_authtoken user_domain_id default
-iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf keystone_authtoken project_domain_id default
-iniset_sudo $conf keystone_authtoken auth_uri http://controller:5000
-iniset_sudo $conf keystone_authtoken auth_url http://controller:5000
-iniset_sudo $conf keystone_authtoken memcached_servers controller:11211
-
-# Prevent error "inequivalent arg 'durable' for exchange 'openstack'"
-iniset_sudo $conf oslo_messaging_rabbit amqp_durable_queues False
-
-# Listen for keystone events (such as project deletion) that are relevant
-# for barbican.
-iniset_sudo $conf keystone_notifications enable True
-
-echo "Starting barbican-keystone-listener."
-sudo /etc/init.d/barbican-keystone-listener start
-
-echo "Removing default SQLite database."
-sudo rm -v /var/lib/barbican/barbican.sqlite
-
-echo "Showing barbican secret list."
-barbican secret list
-
-echo "Getting a token."
-token=$(openstack token issue -cid -fvalue)
-
-echo "token: $token"
-
-echo "Using curl, storing a payload string into a barbican secret."
-curl -s -H "X-Auth-Token: $token" \
- -X POST -H 'content-type:application/json' -H 'X-Project-Id:12345' \
- -d '{"payload": "my-secret-here", "payload_content_type": "text/plain"}' \
- http://localhost:9311/v1/secrets
-
-echo "Getting URI for secret."
-# Assuming the list contains only one item
-uri=$(barbican secret list -c"Secret href" -fvalue)
-echo "URI: $uri"
-
-echo "Showing payload via curl."
-curl -s -H "X-Auth-Token: $token" \
- -H 'Accept: text/plain' -H 'X-Project-Id: 12345' \
- "$uri"
-
-echo "Showing payload using barbican client."
-barbican secret get "$uri" --payload -fvalue
-
-echo "Deleting secret."
-barbican secret delete "$uri"
-
-echo "Using the barbican client, creating a named barbican secret."
-barbican secret store --name test_name
-
-echo "Showing named barbican secret."
-barbican secret list --name test_name -cName -fvalue
-
-echo "Getting URI for secret."
-uri=$(barbican secret list --name test_name -c"Secret href" -fvalue)
-
-echo "Writing payload."
-barbican secret update "$uri" "my_payload"
-
-echo "Showing secret payload."
-barbican secret get "$uri"
-
-echo "Showing payload using barbican client."
-barbican secret get "$uri" --payload -fvalue
-
-echo "Deleting secret."
-barbican secret delete "$uri"
diff --git a/labs/osbash/scripts/ubuntu/create_xxx_node_pxeboot.sh b/labs/osbash/scripts/ubuntu/create_xxx_node_pxeboot.sh
deleted file mode 100755
index 4b9e5235..00000000
--- a/labs/osbash/scripts/ubuntu/create_xxx_node_pxeboot.sh
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env bash
-
-# This scripts executes on the pxeserver and configures the service
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$CONFIG_DIR/openstack"
-source "$LIB_DIR/functions.guest.sh"
-source "$CONFIG_DIR/config.pxeserver"
-
-# Determine hostname from script name
-re=".*create_(.*)_node_pxeboot.sh$"
-if [[ $0 =~ $re ]]; then
- NODE_NAME=${BASH_REMATCH[1]}
- NODE_NAME="${NODE_NAME}"
-else
- echo "ERROR Unable to determine hostname"
- exit 1
-fi
-
-exec_logfile
-
-indicate_current_auto
-
-PXE_NET_IP=$(get_node_ip_in_network "$(hostname)" "mgmt")
-echo "IP on the management network: $PXE_NET_IP."
-
-# -----------------------------------------------------------------------------
-echo "Creating preseed file for training-labs."
-TMPF=/var/www/html/ubuntu/preseed/training-labs.seed
-sudo cp -v "$LIB_DIR/osbash/netboot/preseed-ssh-v5.cfg" "$TMPF"
-
-set_iface_list
-IFACE_1=$(ifnum_to_ifname 1)
-echo "Using interface $IFACE_1."
-
-# -----------------------------------------------------------------------------
-function create_boot_entry {
- local entry_name=$1
- # If no static IP address for node is given, default to PXE_INITIAL_NODE_IP
- local node_ip=${2:-$PXE_INITIAL_NODE_IP}
- menu_file=/var/lib/tftpboot/pxelinux.cfg/default
- echo "Editing the boot menu at $menu_file."
- echo " Entry name: $entry_name"
- echo " IP address: $node_ip"
- cat << PXEMENU | sudo tee -a "$menu_file"
-
-label $entry_name
- kernel ubuntu-installer/amd64/linux
- append preseed/url=http://$PXE_NET_IP/ubuntu/preseed/training-labs.seed vga=normal initrd=ubuntu-installer/amd64/initrd.gz debian-installer=en_US auto=true locale=en_US hostname=foobar debconf/frontend=noninteractive keyboard-configuration/modelcode=SKIP console-setup/ask_detect=false netcfg/choose_interface=$IFACE_1 priority=critical netcfg/get_ipaddress=$node_ip netcfg/get_netmask=255.255.255.0 netcfg/get_gateway=$PXE_GATEWAY netcfg/get_nameservers=$PXE_GATEWAY netcfg/disable_dhcp=true
-PXEMENU
-}
-
-TMPF=/var/lib/tftpboot/pxelinux.cfg/default
-echo "Editing the boot menu at $TMPF."
-
-if [ ! -f "$TMPF" ]; then
- # File does not exist yet. The first node becomes the default.
- cat << PXEMENU | sudo tee "$TMPF"
-include ubuntu-installer/amd64/boot-screens/menu.cfg
-default ubuntu-installer/amd64/boot-screens/vesamenu.c32
-
-menu hshift 13
-menu width 49
-menu margin 8
-prompt 0
-
-menu title training-labs PXE installer boot menu
-
-# Comment out default line to get boot menu on PXE booted machines
-default training_labs_generic
-
-PXEMENU
- echo "Creating a menu entry to boot the node with a default IP address."
- create_boot_entry "training_labs_generic"
-fi
-
-NODE_IP=$(get_node_ip_in_network "$NODE_NAME" "mgmt")
-echo "IP of $NODE_NAME on the management network: $NODE_IP"
-
-echo "Creating a menu entry to boot the node with its management IP address."
-create_boot_entry "$NODE_NAME" "$NODE_IP"
-# -----------------------------------------------------------------------------
diff --git a/labs/osbash/scripts/ubuntu/install_memcached.sh b/labs/osbash/scripts/ubuntu/install_memcached.sh
deleted file mode 100755
index b2fb3fe6..00000000
--- a/labs/osbash/scripts/ubuntu/install_memcached.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Memcached
-# https://docs.openstack.org/install-guide/environment-memcached-ubuntu.html
-#------------------------------------------------------------------------------
-
-echo "Installing memcache packages."
-sudo apt install -y memcached python-memcache
-
-MGMT_IP=$(get_node_ip_in_network "$(hostname)" "mgmt")
-echo "Binding memcached server to $MGMT_IP."
-
-conf=/etc/memcached.conf
-sudo sed -i "s/^-l 127.0.0.1/-l $MGMT_IP/" $conf
-
-echo "Restarting memcache service."
-sudo service memcached restart
diff --git a/labs/osbash/scripts/ubuntu/install_rabbitmq.sh b/labs/osbash/scripts/ubuntu/install_rabbitmq.sh
deleted file mode 100755
index f82aef8f..00000000
--- a/labs/osbash/scripts/ubuntu/install_rabbitmq.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#-------------------------------------------------------------------------------
-# Install the message broker service (RabbitMQ).
-# https://docs.openstack.org/install-guide/environment-messaging-ubuntu.html
-#-------------------------------------------------------------------------------
-
-echo "Installing RabbitMQ."
-sudo apt install -y rabbitmq-server
-
-echo -n "Waiting for RabbitMQ to start."
-until sudo rabbitmqctl status >/dev/null; do
- sleep 1
- echo -n .
-done
-echo
-
-echo ---------------------------------------------------------------
-echo "sudo rabbitmqctl status"
-sudo rabbitmqctl status
-echo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "sudo rabbitmqctl report"
-sudo rabbitmqctl report
-echo ---------------------------------------------------------------
-
-echo "Adding openstack user to messaging service."
-sudo rabbitmqctl add_user openstack "$RABBIT_PASS"
-
-echo "Permitting configuration, write and read access for the openstack user."
-sudo rabbitmqctl set_permissions openstack ".*" ".*" ".*"
diff --git a/labs/osbash/scripts/ubuntu/mistral/setup_mistral_server.sh b/labs/osbash/scripts/ubuntu/mistral/setup_mistral_server.sh
deleted file mode 100755
index 02985a4d..00000000
--- a/labs/osbash/scripts/ubuntu/mistral/setup_mistral_server.sh
+++ /dev/null
@@ -1,256 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-source "$CONFIG_DIR/credentials"
-
-#------------------------------------------------------------------------------
-# Install Mistral
-# https://docs.openstack.org/mistral/pike/install/installation_guide.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Prerequisites
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-MISTRAL_DB_USER=mistral
-MISTRAL_DBPASS=mistral_db_secret
-MISTRAL_PASS=mistral_user_secret
-
-echo "Setting up database for mistral."
-setup_database mistral "$MISTRAL_DB_USER" "$MISTRAL_DBPASS"
-
-# This script is not part of the standard install, cache may be stale by now.
-sudo apt update
-
-echo "Installing mistral packages."
-sudo apt install -y debconf-utils
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Authentication server password:
-echo mistral-common mistral/admin-password password admin_user_secret | \
- sudo debconf-set-selections
-
-# Password for connection to the RabbitMQ server:
-echo mistral-common mistral/rabbit_password password "$RABBIT_PASS" | \
- sudo debconf-set-selections
-
-# Username for connection to the RabbitMQ server:
-echo mistral-common mistral/rabbit_userid string openstack | \
- sudo debconf-set-selections
-
-# Set up a database for Mistral?
-echo mistral-common mistral/configure_db boolean false | \
- sudo debconf-set-selections
-
-# IP address of your RabbitMQ host:
-echo mistral-common mistral/rabbit_host string localhost | \
- sudo debconf-set-selections
-
-# Authentication server username:
-echo mistral-common mistral/admin-user string admin | \
- sudo debconf-set-selections
-
-# Authentication server hostname:
-echo mistral-common mistral/auth-host string controller | \
- sudo debconf-set-selections
-
-# Authentication server tenant name:
-echo mistral-common mistral/admin-tenant-name string admin | \
- sudo debconf-set-selections
-
-sudo apt install -y mistral-common
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Register Mistral in the Keystone endpoint catalog?
-echo mistral-api mistral/register-endpoint boolean false | \
- sudo debconf-set-selections
-
-sudo apt install -y mistral-api
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-sudo apt install -y mistral-engine mistral-executor
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-mistral_admin_user=mistral
-
-echo -e "\n>>> Creating a mistral user with admin privileges.\n"
-
-openstack user create \
- --domain Default \
- --password "$MISTRAL_PASS" \
- "$mistral_admin_user"
-
-echo -e "\n>>> Adding admin role to service project for mistral user.\n"
-
-openstack role add \
- --project service \
- --user "$mistral_admin_user" \
- admin
-
-echo -e "\n>>> Creating the mistral service.\n"
-
-openstack service create \
- --name mistral \
- --description "Mistral Service" \
- "workflowv2"
-
-echo -e "\n>>> Add endpoints for mistral.\n"
-
-openstack endpoint create \
- --region RegionOne "workflowv2" \
- public http://controller:8989/v2
-
-openstack endpoint create \
- --region RegionOne "workflowv2" \
- internal http://controller:8989/v2
-
-openstack endpoint create \
- --region RegionOne "workflowv2" \
- admin http://controller:8989/v2
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-function get_database_url {
- local db_user=$MISTRAL_DB_USER
- local database_host=controller
-
- #echo "mysql://$db_user:$MISTRAL_DBPASS@$database_host:3306/mistral"
- echo "mysql+pymysql://$db_user:$MISTRAL_DBPASS@$database_host/mistral"
-}
-
-database_url=$(get_database_url)
-echo "Database connection: $database_url."
-
-echo "Configuring mistral.conf."
-conf=/etc/mistral/mistral.conf
-
-echo "Configuring keystone."
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Mistral Dashboard Installation Guide
-# https://docs.openstack.org/mistral/pike/install/dashboard_guide.html
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Mistral Configuration Guide
-# https://docs.openstack.org/mistral/pike/configuration/index.html
-# https://github.com/openstack/mistral
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-sudo cp $conf $conf.bak
-
-# Disable deprecated options
-sudo sed -i '/^admin_/ s/^/#/' $conf
-sudo sed -i '/^auth_/ s/^/#/' $conf
-
-# Configure [keystone_authtoken] section.
-#iniset_sudo $conf keystone_authtoken auth_uri http://controller:5000/v3
-iniset_sudo $conf keystone_authtoken auth_uri http://controller:5000
-iniset_sudo $conf keystone_authtoken auth_url http://controller:5000
-#iniset_sudo $conf keystone_authtoken identity_uri http://controller:5000
-
-#iniset_sudo $conf keystone_authtoken auth_verison v3
-
-# mistral needs username, password (not admin_user, admin_password)
-iniset_sudo $conf keystone_authtoken username "$mistral_admin_user"
-#iniset_sudo $conf keystone_authtoken admin_user "$mistral_admin_user"
-iniset_sudo $conf keystone_authtoken password "$MISTRAL_PASS"
-#iniset_sudo $conf keystone_authtoken admin_password "$MISTRAL_PASS"
-
-#iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-#iniset_sudo $conf keystone_authtoken admin_tenant_name "$SERVICE_PROJECT_NAME"
-
-
-iniset_sudo $conf keystone_authtoken auth_type password
-iniset_sudo $conf keystone_authtoken user_domain_id default
-iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf keystone_authtoken project_domain_id default
-iniset_sudo $conf keystone_authtoken memcached_servers controller:11211
-
-echo "Configuring RabbitMQ message queue access."
-TRANSPORT_URL="rabbit://openstack:$RABBIT_PASS@controller"
-iniset_sudo $conf DEFAULT transport_url "$TRANSPORT_URL"
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-iniset_sudo $conf database connection "$database_url"
-
-iniset_sudo $conf oslo_policy policy_file "/etc/mistral/policy.json"
-
-sudo mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head
-
-sudo mistral-db-manage --config-file /etc/mistral/mistral.conf populate
-
-sudo systemctl restart mistral-engine
-sudo systemctl restart mistral-executor
-sudo systemctl restart mistral-api
-
-echo "Removing default SQLite database."
-sudo rm -v /var/lib/mistral/mistral.sqlite
-
-# https://docs.openstack.org/mistral/pike/install/mistralclient_guide.html
-# Test:
-echo -n "Waiting for mistral to come up."
-until mistral workbook-list >/dev/null 2>&1; do
- sleep 1
- echo -n .
-done
-echo
-
-echo "mistral workbook-list"
-mistral workbook-list
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# https://github.com/openstack/mistral/blob/master/doc/source/quickstart.rst
-cat << WORKFLOW > mistral-workflow.yaml
----
-version: "2.0"
-
-my_workflow:
- type: direct
-
- input:
- - names
-
- tasks:
- task1:
- with-items: name in <% $.names %>
- action: std.echo output=<% $.name %>
- on-success: task2
-
- task2:
- action: std.echo output="Done"
-WORKFLOW
-
-echo "Creating a workflow from file."
-mistral workflow-create mistral-workflow.yaml
-
-workflow_id=$(mistral workflow-get my_workflow -cID -fvalue)
-
-echo "Starting the workflow."
-mistral execution-create my_workflow \
- '{"names": ["John", "Mistral", "Ivan", "Crystal"]}'
-
-echo "Getting execution_id."
-execution_id=$(mistral execution-list | grep "$workflow_id" | awk '{print $2}')
-
-echo "mistral execution-get $execution_id"
-mistral execution-get "$execution_id"
-
-echo "mistral task-list $execution_id"
-mistral task-list "$execution_id"
-
-echo "Getting task_id."
-task_id=$(mistral task-list "$execution_id" -cID -cName | grep task1 | \
- awk '{print $2}')
-
-echo "mistral task-get-result $task_id"
-mistral task-get-result "$task_id"
-
-echo "mistral action-execution-list $task_id"
-mistral action-execution-list "$task_id"
diff --git a/labs/osbash/scripts/ubuntu/setup_cinder_controller.sh b/labs/osbash/scripts/ubuntu/setup_cinder_controller.sh
deleted file mode 100755
index 5e5a2b0d..00000000
--- a/labs/osbash/scripts/ubuntu/setup_cinder_controller.sh
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Set up Block Storage service controller (cinder controller node)
-# https://docs.openstack.org/cinder/train/install/cinder-controller-install-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Prerequisites
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Setting up database for cinder."
-setup_database cinder "$CINDER_DB_USER" "$CINDER_DBPASS"
-
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-cinder_admin_user=cinder
-
-# Wait for keystone to come up
-wait_for_keystone
-
-echo "Creating cinder user."
-openstack user create \
- --domain default \
- --password "$CINDER_PASS" \
- "$cinder_admin_user"
-
-echo "Linking cinder user, service tenant and admin role."
-openstack role add \
- --project "$SERVICE_PROJECT_NAME" \
- --user "$cinder_admin_user" \
- "$ADMIN_ROLE_NAME"
-
-echo "Registering cinder with keystone so that other services can locate it."
-openstack service create \
- --name cinderv2 \
- --description "OpenStack Block Storage" \
- volumev2
-
-openstack service create \
- --name cinderv3 \
- --description "OpenStack Block Storage" \
- volumev3
-
-openstack endpoint create \
- --region "$REGION" \
- volumev2 public http://controller:8776/v2/%\(project_id\)s
-
-openstack endpoint create \
- --region "$REGION" \
- volumev2 internal http://controller:8776/v2/%\(project_id\)s
-
-openstack endpoint create \
- --region "$REGION" \
- volumev2 admin http://controller:8776/v2/%\(project_id\)s
-
-openstack endpoint create \
- --region "$REGION" \
- volumev3 public http://controller:8776/v3/%\(project_id\)s
-
-openstack endpoint create \
- --region "$REGION" \
- volumev3 internal http://controller:8776/v3/%\(project_id\)s
-
-openstack endpoint create \
- --region "$REGION" \
- volumev3 admin http://controller:8776/v3/%\(project_id\)s
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install and configure components
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Installing cinder."
-sudo apt install -y cinder-api cinder-scheduler \
- qemu-utils
-# Note: The package 'qemu-utils' is required for 'qemu-img' which allows cinder
-# to convert additional image types to bootable volumes. By default only
-# raw images can be converted.
-
-function get_database_url {
- local db_user=$CINDER_DB_USER
- local database_host=controller
-
- echo "mysql+pymysql://$db_user:$CINDER_DBPASS@$database_host/cinder"
-}
-
-database_url=$(get_database_url)
-
-echo "Configuring cinder-api.conf."
-conf=/etc/cinder/cinder.conf
-
-echo "Setting database connection: $database_url."
-iniset_sudo $conf database connection "$database_url"
-
-echo "Configuring RabbitMQ message queue access."
-iniset_sudo $conf DEFAULT transport_url "rabbit://openstack:$RABBIT_PASS@controller"
-
-iniset_sudo $conf DEFAULT auth_strategy keystone
-
-# Configure [keystone_authtoken] section.
-iniset_sudo $conf keystone_authtoken www_authenticate_uri http://controller:5000
-iniset_sudo $conf keystone_authtoken auth_url http://controller:5000
-iniset_sudo $conf keystone_authtoken memcached_servers controller:11211
-iniset_sudo $conf keystone_authtoken auth_type password
-iniset_sudo $conf keystone_authtoken project_domain_id default
-iniset_sudo $conf keystone_authtoken user_domain_id default
-iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf keystone_authtoken username "$cinder_admin_user"
-iniset_sudo $conf keystone_authtoken password "$CINDER_PASS"
-
-iniset_sudo $conf DEFAULT my_ip "$(hostname_to_ip controller)"
-
-iniset_sudo $conf oslo_concurrency lock_path /var/lib/cinder/tmp
-
-echo "Populating the Block Storage database."
-sudo cinder-manage db sync
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Configure Compute to use Block Storage
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Configuring Compute to use Block Storage."
-
-conf=/etc/nova/nova.conf
-
-iniset_sudo $conf cinder os_region_name "$REGION"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Finalize installation
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Reduce memory usage (not in install-guide)
-conf=/etc/apache2/conf-available/cinder-wsgi.conf
-sudo sed -i --follow-symlinks '/WSGIDaemonProcess/ s/processes=[0-9]*/processes=1/' $conf
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# not in install-guide: as of 2017-08-22, cinder wsgi processes can not
-# read /etc/cinder due to permission problem introduced with Pike packages
-# (drwxr-x--- root cinder) vs. cinder:www-data
-if ls -ld /etc/cinder | grep "root cinder"; then
- echo "Setting owner for /etc/cinder."
- sudo chown -v cinder:cinder /etc/cinder
-else
- echo "XXX Workaround for /etc/cinder owner no longer needed."
- exit 2
-fi
-
-echo "Restarting the Compute API service."
-sudo service nova-api restart
-
-echo "Restarting the Block Storage services."
-sudo service cinder-scheduler restart
-sudo service apache2 restart
-
-AUTH="source $CONFIG_DIR/admin-openstackrc.sh"
-echo -n "Waiting for cinder to start."
-until node_ssh controller "$AUTH; openstack volume service list" >/dev/null \
- 2>&1; do
- echo -n .
- sleep 1
-done
-echo
diff --git a/labs/osbash/scripts/ubuntu/setup_cinder_volumes.sh b/labs/osbash/scripts/ubuntu/setup_cinder_volumes.sh
deleted file mode 100755
index 461d727e..00000000
--- a/labs/osbash/scripts/ubuntu/setup_cinder_volumes.sh
+++ /dev/null
@@ -1,234 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Install and configure a storage node
-# https://docs.openstack.org/cinder/train/install/cinder-storage-install-ubuntu.html
-#------------------------------------------------------------------------------
-
-MY_MGMT_IP=$(get_node_ip_in_network "$(hostname)" "mgmt")
-echo "IP address of this node's interface in management network: $MY_MGMT_IP."
-
-echo "Installing qemu support package for non-raw image types."
-sudo apt install -y qemu
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Prerequisites
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Installing the supporting utility packages."
-sudo apt install -y lvm2 thin-provisioning-tools
-
-echo "Configuring LVM physical and logical volumes."
-
-cinder_dev=sdb
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Not in install-guide
-# Avoid error due to service not running
-# XXX Alternatively, in /etc/lvm/lvm.conf, set use_lvmetad = 0
-sudo systemctl enable lvm2-lvmetad.service
-sudo systemctl enable lvm2-lvmetad.socket
-sudo systemctl start lvm2-lvmetad.service
-sudo systemctl start lvm2-lvmetad.socket
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-sudo pvcreate /dev/$cinder_dev
-sudo vgcreate cinder-volumes /dev/$cinder_dev
-
-conf=/etc/lvm/lvm.conf
-
-echo "Setting LVM filter line in $conf to only allow /dev/$cinder_dev."
-sudo sed -i '0,/# filter = / {s|# filter = .*|filter = [ "a/'$cinder_dev'/", "r/.*/"]|}' $conf
-
-echo "Verifying LVM filter."
-grep "^[[:space:]]\{1,\}filter" $conf
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install and configure components
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Installing cinder."
-sudo apt install -y cinder-volume
-
-conf=/etc/cinder/cinder.conf
-echo "Configuring $conf."
-
-function get_database_url {
- local db_user=$CINDER_DB_USER
- local database_host=controller
-
- echo "mysql+pymysql://$db_user:$CINDER_DBPASS@$database_host/cinder"
-}
-
-database_url=$(get_database_url)
-cinder_admin_user=cinder
-
-echo "Setting database connection: $database_url."
-iniset_sudo $conf database connection "$database_url"
-
-echo "Configuring RabbitMQ message queue access."
-iniset_sudo $conf DEFAULT transport_url "rabbit://openstack:$RABBIT_PASS@controller"
-
-iniset_sudo $conf DEFAULT auth_strategy keystone
-
-# Configure [keystone_authtoken] section.
-iniset_sudo $conf keystone_authtoken www_authenticate_uri http://controller:5000
-iniset_sudo $conf keystone_authtoken auth_url http://controller:5000
-iniset_sudo $conf keystone_authtoken memcached_servers controller:11211
-iniset_sudo $conf keystone_authtoken auth_type password
-iniset_sudo $conf keystone_authtoken project_domain_id default
-iniset_sudo $conf keystone_authtoken user_domain_id default
-iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf keystone_authtoken username "$cinder_admin_user"
-iniset_sudo $conf keystone_authtoken password "$CINDER_PASS"
-
-iniset_sudo $conf DEFAULT my_ip "$MY_MGMT_IP"
-
-iniset_sudo $conf DEFAULT volume_driver cinder.volume.drivers.lvm.LVMVolumeDriver
-iniset_sudo $conf DEFAULT volume_group cinder-volumes
-iniset_sudo $conf DEFAULT iscsi_protocol iscsi
-iniset_sudo $conf DEFAULT iscsi_helper tgtadm
-
-iniset_sudo $conf DEFAULT enabled_backends lvm
-iniset_sudo $conf DEFAULT glance_api_servers http://controller:9292
-
-iniset_sudo $conf oslo_concurrency lock_path /var/lib/cinder/tmp
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Finalize installation
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Restarting cinder service."
-sudo service tgt restart
-sudo service cinder-volume restart
-
-#------------------------------------------------------------------------------
-# Verify Cinder operation
-# https://docs.openstack.org/cinder/train/install/cinder-verify.html
-#------------------------------------------------------------------------------
-
-echo "Verifying Block Storage installation on controller node."
-
-echo "Sourcing the admin credentials."
-AUTH="source $CONFIG_DIR/admin-openstackrc.sh"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "Restarting restarting cinder-scheduler."
-node_ssh controller "sudo service cinder-scheduler restart"
-
-echo -n "Waiting for cinder to start."
-until node_ssh controller "$AUTH; openstack volume service list" >/dev/null \
- 2>&1; do
- echo -n .
- sleep 1
-done
-echo
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "openstack volume service list is available:"
-node_ssh controller "$AUTH; openstack volume service list"
-
-
-function check_cinder_services {
-
- # It takes some time for cinder to detect its services and update its
- # status. This method will wait for 60 seconds to get the status of the
- # cinder services.
- local i=0
- while : ; do
- # Check service-list every 5 seconds
- if [ $(( i % 5 )) -ne 0 ]; then
- if ! node_ssh controller "$AUTH; openstack volume service list" \
- 2>&1 | grep -q down; then
- echo
- echo "All cinder services seem to be up and running."
- node_ssh controller "$AUTH; openstack volume service list"
- return 0
- fi
- fi
- if [[ "$i" -eq "60" ]]; then
- echo
- echo "ERROR Cinder services are not working as expected."
- node_ssh controller "$AUTH; openstack volume service list"
- exit 1
- fi
- i=$((i + 1))
- echo -n .
- sleep 1
- done
-}
-
-# To avoid race conditions which were causing Cinder Volumes script to fail,
-# check the status of the cinder services. Cinder takes a few seconds before it
-# is aware of the exact status of its services.
-echo -n "Waiting for all cinder services to start."
-check_cinder_services
-
-#------------------------------------------------------------------------------
-# Verify the Block Storage installation
-# https://docs.openstack.org/install-guide/launch-instance-cinder.html
-# (partial implementation without instance)
-#------------------------------------------------------------------------------
-
-echo "Sourcing the demo credentials."
-AUTH="source $CONFIG_DIR/demo-openstackrc.sh"
-
-echo "openstack volume create --size 1 volume1"
-node_ssh controller "$AUTH; openstack volume create --size 1 volume1"
-
-echo -n "Waiting for cinder to list the new volume."
-until node_ssh controller "$AUTH; openstack volume list| grep volume1" > /dev/null 2>&1; do
- echo -n .
- sleep 1
-done
-echo
-
-function wait_for_cinder_volume {
-
- echo -n 'Waiting for cinder volume to become available.'
- local i=0
- while : ; do
- # Check list every 5 seconds
- if [ $(( i % 5 )) -ne 0 ]; then
- if node_ssh controller "$AUTH; openstack volume list" 2>&1 |
- grep -q "volume1 .*|.* available"; then
- echo
- return 0
- fi
- fi
- if [ $i -eq 20 ]; then
- echo
- echo "ERROR Failed to create cinder volume."
- node_ssh controller "$AUTH; openstack volume list"
- exit 1
- fi
- i=$((i + 1))
- echo -n .
- sleep 1
- done
-}
-
-# Wait for cinder volume to be created
-wait_for_cinder_volume
-
-echo "Volume successfully created:"
-node_ssh controller "$AUTH; openstack volume list"
-
-echo "Deleting volume."
-node_ssh controller "$AUTH; openstack volume delete volume1"
-
-echo "openstack volume list"
-node_ssh controller "$AUTH; openstack volume list"
diff --git a/labs/osbash/scripts/ubuntu/setup_glance.sh b/labs/osbash/scripts/ubuntu/setup_glance.sh
deleted file mode 100755
index 5397575c..00000000
--- a/labs/osbash/scripts/ubuntu/setup_glance.sh
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Install the Image Service (glance).
-# https://docs.openstack.org/glance/train/install/install-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Prerequisites
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Setting up database for glance."
-setup_database glance "$GLANCE_DB_USER" "$GLANCE_DBPASS"
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-glance_admin_user=glance
-
-# Wait for keystone to come up
-wait_for_keystone
-
-echo "Creating glance user and giving it admin role under service tenant."
-openstack user create \
- --domain default \
- --password "$GLANCE_PASS" \
- "$glance_admin_user"
-
-openstack role add \
- --project "$SERVICE_PROJECT_NAME" \
- --user "$glance_admin_user" \
- "$ADMIN_ROLE_NAME"
-
-echo "Registering glance with keystone so that other services can locate it."
-openstack service create \
- --name glance \
- --description "OpenStack Image" \
- image
-
-echo "Creating the Image service API endpoints."
-openstack endpoint create \
- --region "$REGION" \
- image public http://controller:9292
-
-openstack endpoint create \
- --region "$REGION" \
- image internal http://controller:9292
-
-openstack endpoint create \
- --region "$REGION" \
- image admin http://controller:9292
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install and configure components
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Installing glance."
-sudo apt install -y glance
-
-function get_database_url {
- local db_user=$GLANCE_DB_USER
- local database_host=controller
-
- echo "mysql+pymysql://$db_user:$GLANCE_DBPASS@$database_host/glance"
-}
-
-database_url=$(get_database_url)
-echo "Database connection: $database_url."
-
-echo "Configuring glance-api.conf."
-conf=/etc/glance/glance-api.conf
-
-# Database
-iniset_sudo $conf database connection "$database_url"
-
-# Keystone_authtoken
-iniset_sudo $conf keystone_authtoken www_authenticate_uri http://controller:5000
-iniset_sudo $conf keystone_authtoken auth_url http://controller:5000
-iniset_sudo $conf keystone_authtoken memcached_servers controller:11211
-iniset_sudo $conf keystone_authtoken auth_type password
-iniset_sudo $conf keystone_authtoken project_domain_name Default
-iniset_sudo $conf keystone_authtoken user_domain_name Default
-iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf keystone_authtoken username "$glance_admin_user"
-iniset_sudo $conf keystone_authtoken password "$GLANCE_PASS"
-
-# Paste_deploy
-iniset_sudo $conf paste_deploy flavor "keystone"
-
-# glance_store
-iniset_sudo $conf glance_store stores "file,http"
-iniset_sudo $conf glance_store default_store file
-iniset_sudo $conf glance_store filesystem_store_datadir /var/lib/glance/images/
-
-echo "Creating the database tables for glance."
-sudo glance-manage db_sync
-
-echo "Restarting glance service."
-sudo service glance-api restart
-
-#------------------------------------------------------------------------------
-# Verify the Image Service installation
-# https://docs.openstack.org/glance/train/install/verify.html
-#------------------------------------------------------------------------------
-
-echo -n "Waiting for glance to start."
-until openstack image list >/dev/null 2>&1; do
- sleep 1
- echo -n .
-done
-echo
-
-echo "Adding pre-downloaded CirrOS image as $CIRROS_IMG_NAME to glance."
-
-# XXX install-guide changed from openstack to glance client, but did not
-# change --public to --visibility public
-glance image-create --name "$CIRROS_IMG_NAME" \
- --file "$HOME/img/$(basename $CIRROS_URL)" \
- --disk-format qcow2 --container-format bare \
- --visibility public
-
-echo "Verifying that the image was successfully added to the service."
-
-echo "glance image-list"
-glance image-list
diff --git a/labs/osbash/scripts/ubuntu/setup_heat_controller.sh b/labs/osbash/scripts/ubuntu/setup_heat_controller.sh
deleted file mode 100755
index 99d8552d..00000000
--- a/labs/osbash/scripts/ubuntu/setup_heat_controller.sh
+++ /dev/null
@@ -1,197 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-# Wait for keystone to come up
-wait_for_keystone
-
-#------------------------------------------------------------------------------
-# Install the Orchestration Service (heat)
-# https://docs.openstack.org/heat/train/install/install-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Prerequisites
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Setting up database for heat."
-setup_database heat "$HEAT_DB_USER" "$HEAT_DBPASS"
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-heat_admin_user=heat
-
-# Wait for keystone to come up
-wait_for_keystone
-
-echo "Creating heat user and giving it admin role under service tenant."
-openstack user create \
- --domain default \
- --password "$HEAT_PASS" \
- "$heat_admin_user"
-
-openstack role add \
- --project "$SERVICE_PROJECT_NAME" \
- --user "$heat_admin_user" \
- "$ADMIN_ROLE_NAME"
-
-echo "Creating the heat and heat-cfn service entities."
-openstack service create \
- --name heat \
- --description "Orchestration" \
- orchestration
-
-openstack service create \
- --name heat-cfn \
- --description "Orchestration" \
- cloudformation
-
-echo "Creating heat and heat-cfn endpoints."
-openstack endpoint create \
- --region "$REGION" \
- orchestration public http://controller:8004/v1/%\(tenant_id\)s
-
-openstack endpoint create \
- --region "$REGION" \
- orchestration internal http://controller:8004/v1/%\(tenant_id\)s
-
-openstack endpoint create \
- --region "$REGION" \
- orchestration admin http://controller:8004/v1/%\(tenant_id\)s
-
-openstack endpoint create \
- --region "$REGION" \
- cloudformation public http://controller:8000/v1
-
-openstack endpoint create \
- --region "$REGION" \
- cloudformation internal http://controller:8000/v1
-
-openstack endpoint create \
- --region "$REGION" \
- cloudformation admin http://controller:8000/v1
-
-echo "Creating heat domain."
-openstack domain create \
- --description "Stack projects and users" \
- heat
-
-echo "Creating heat_domain_admin user."
-openstack user create \
- --domain heat \
- --password "$HEAT_DOMAIN_PASS" \
- heat_domain_admin
-
-openstack role add \
- --domain heat \
- --user-domain heat \
- --user heat_domain_admin \
- "$ADMIN_ROLE_NAME"
-
-echo "Creating the heat_stack_owner role."
-openstack role create "heat_stack_owner"
-
-openstack role add \
- --project "$DEMO_PROJECT_NAME" \
- --user "$DEMO_USER_NAME" \
- "heat_stack_owner"
-
-echo "Creating the heat_stack_user role."
-openstack role create "heat_stack_user"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install and configure components
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Installing heat."
-
-sudo apt install -y heat-api heat-api-cfn heat-engine
-
-function get_database_url {
- local db_user=$HEAT_DB_USER
- local database_host=controller
-
- echo "mysql+pymysql://$db_user:$HEAT_DBPASS@$database_host/heat"
-}
-
-database_url=$(get_database_url)
-echo "Database connection: $database_url."
-
-echo "Configuring heat.conf."
-conf=/etc/heat/heat.conf
-iniset_sudo $conf database connection "$database_url"
-
-echo "Configuring keystone."
-
-echo "Configuring RabbitMQ message queue access."
-iniset_sudo $conf DEFAULT transport_url "rabbit://openstack:$RABBIT_PASS@controller"
-
-# Configure [keystone_authtoken] section.
-iniset_sudo $conf keystone_authtoken www_authenticate_uri http://controller:5000
-iniset_sudo $conf keystone_authtoken auth_url http://controller:5000
-iniset_sudo $conf keystone_authtoken memcached_servers controller:11211
-iniset_sudo $conf keystone_authtoken auth_type password
-iniset_sudo $conf keystone_authtoken project_domain_name default
-iniset_sudo $conf keystone_authtoken user_domain_name default
-iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf keystone_authtoken username "$heat_admin_user"
-iniset_sudo $conf keystone_authtoken password "$HEAT_PASS"
-
-# Configure [trustee] section.
-iniset_sudo $conf trustee auth_type password
-iniset_sudo $conf trustee auth_url http://controller:5000
-iniset_sudo $conf trustee username "$heat_admin_user"
-iniset_sudo $conf trustee password "$HEAT_PASS"
-iniset_sudo $conf trustee user_domain_name default
-
-# Configure [clients_keystone] section.
-iniset_sudo $conf clients_keystone auth_uri http://controller:5000
-
-# Configure [DEFAULT] section.
-iniset_sudo $conf DEFAULT heat_metadata_server_url http://controller:8000
-iniset_sudo $conf DEFAULT heat_waitcondition_server_url http://controller:8000/v1/waitcondition
-
-# Configure [DEFAULT] section.
-iniset_sudo $conf DEFAULT stack_domain_admin heat_domain_admin
-iniset_sudo $conf DEFAULT stack_domain_admin_password "$HEAT_DOMAIN_PASS"
-iniset_sudo $conf DEFAULT stack_user_domain_name heat
-
-echo "Creating the database tables for heat."
-sudo heat-manage db_sync
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Finalize installation
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Restarting heat services."
-STARTTIME=$(date +%s)
-sudo service heat-api restart
-sudo service heat-api-cfn restart
-sudo service heat-engine restart
-
-echo -n "Waiting for openstack stack list."
-until openstack stack list; do
- sleep 1
- echo -n .
-done
-ENDTIME=$(date +%s)
-echo "Restarting heat servies took $((ENDTIME - STARTTIME)) seconds."
-
-#------------------------------------------------------------------------------
-# Verify operation
-# https://docs.openstack.org/heat/train/install/verify.html
-#------------------------------------------------------------------------------
-
-echo "Listing service components."
-openstack orchestration service list
diff --git a/labs/osbash/scripts/ubuntu/setup_horizon.sh b/labs/osbash/scripts/ubuntu/setup_horizon.sh
deleted file mode 100755
index d2bdb43e..00000000
--- a/labs/osbash/scripts/ubuntu/setup_horizon.sh
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Set up OpenStack Dashboard (horizon)
-# https://docs.openstack.org/horizon/train/install/install-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install and configure components
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# Note: Installing the dashboard here reloads the apache configuration.
-# Below, we are also changing the configuration and reloading it once we
-# are done. This race can result in a stopped apache (which also means
-# stopped keystone services). We can either sleep for a second
-# after the "apt install" call below or do a restart instead
-# of a reload when we are done changing the configuration files.
-echo "Installing horizon."
-sudo apt install -y openstack-dashboard
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Edit the /etc/openstack-dashboard/local_settings.py file.
-conf=/etc/openstack-dashboard/local_settings.py
-auth_host=controller
-
-echo "Setting OPENSTACK_HOST = \"$auth_host\"."
-iniset_sudo_no_section $conf "OPENSTACK_HOST" "\"$auth_host\""
-
-echo "Allowing all hosts to access the dashboard:"
-iniset_sudo_no_section $conf "ALLOWED_HOSTS" "['*', ]"
-
-echo "Telling horizon to use the cache for sessions."
-iniset_sudo_no_section $conf "SESSION_ENGINE" "'django.contrib.sessions.backends.cache'"
-
-echo "Setting interface location of memcached."
-sudo sed -i "/LOCATION/ s/127.0.0.1/controller/" $conf
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "Comparing $conf to memcached.conf."
-memcached_conf=/etc/memcached.conf
-# Port is a number on line starting with "-p "
-port=$(grep -Po -- '(?<=^-p )\d+' $memcached_conf)
-
-# Interface is an IP address on line starting with "-l "
-interface_ip=$(grep -Po -- '(?<=^-l )[\d\.]+' $memcached_conf)
-
-echo "memcached listening on $interface_ip:$port."
-
-# Turn IP address into corresponding host name
-interface_name=$(getent hosts "$auth_host" | awk '{ print $2 }')
-
-# Line should read something like: 'LOCATION' : 'controller:11211',
-if sudo grep "LOCATION.*$interface_name:$port" $conf; then
- echo "$conf agrees."
-else
- echo >&2 "$conf disagrees. Aborting."
- exit 1
-fi
-
-echo "CACHES configuration in $conf:"
-sudo awk '/^CACHES =/,/^}/' $conf
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Enabling Identity API version 3."
-iniset_sudo_no_section $conf "OPENSTACK_KEYSTONE_URL" '"http://%s:5000/v3" % OPENSTACK_HOST'
-
-echo "Enabling support for domains."
-iniset_sudo_no_section $conf "OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT" True
-
-cat << API | sudo tee -a $conf
-
-# Use Keystone V3 API for dashboard login.
-OPENSTACK_API_VERSIONS = {
- "identity": 3,
- "image": 2,
- "volume": 3,
-}
-API
-
-echo "Configuring 'default' as the default domain for users created via " \
- "dashboard."
-iniset_sudo_no_section $conf "OPENSTACK_KEYSTONE_DEFAULT_DOMAIN" '"Default"'
-
-echo "Configuring 'user' as the default role for users created via dashboard."
-iniset_sudo_no_section $conf "OPENSTACK_KEYSTONE_DEFAULT_ROLE" '"user"'
-
-# Here, we would disable layer-3 networking servies for networking option 1.
-
-echo "Setting timezone to UTC."
-iniset_sudo_no_section $conf "TIME_ZONE" '"UTC"'
-
-conf=/etc/apache2/conf-available/openstack-dashboard.conf
-echo "Verifying presence of 'WSGIApplicationGroup %{GLOBAL}'."
-grep "WSGIApplicationGroup %{GLOBAL}" $conf
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Customize Horizon (not in install-guide)
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Removing default Ubuntu theme."
-sudo apt remove --auto-remove -y openstack-dashboard-ubuntu-theme
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Reduce memory usage (not in install-guide)
-conf=/etc/apache2/conf-available/openstack-dashboard.conf
-sudo sed -i --follow-symlinks '/WSGIDaemonProcess/ s/processes=[0-9]*/processes=1/' $conf
-sudo sed -i --follow-symlinks '/WSGIDaemonProcess/ s/threads=[0-9]*/threads=2/' $conf
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Finalize installation
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Reloading the web server configuration."
-# Restarting instead of reloading for reasons explained in comment above.
-sudo systemctl restart apache2.service
diff --git a/labs/osbash/scripts/ubuntu/setup_keystone.sh b/labs/osbash/scripts/ubuntu/setup_keystone.sh
deleted file mode 100755
index 4cb84037..00000000
--- a/labs/osbash/scripts/ubuntu/setup_keystone.sh
+++ /dev/null
@@ -1,184 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$CONFIG_DIR/openstack"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Set up keystone for controller node
-# https://docs.openstack.org/keystone/train/install/keystone-install-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Prerequisites
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Setting up database for keystone."
-setup_database keystone "$KEYSTONE_DB_USER" "$KEYSTONE_DBPASS"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Not in install-guide:
-echo "Sanity check: local auth should work."
-mysql -u keystone -p"$KEYSTONE_DBPASS" keystone -e quit
-
-echo "Sanity check: remote auth should work."
-mysql -u keystone -p"$KEYSTONE_DBPASS" keystone -h controller -e quit
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install and configure components
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Installing keystone."
-sudo apt install -y keystone
-
-conf=/etc/keystone/keystone.conf
-echo "Editing $conf."
-
-function get_database_url {
- local db_user=$KEYSTONE_DB_USER
- local database_host=controller
-
- echo "mysql+pymysql://$db_user:$KEYSTONE_DBPASS@$database_host/keystone"
-}
-
-database_url=$(get_database_url)
-
-echo "Setting database connection: $database_url."
-iniset_sudo $conf database connection "$database_url"
-
-echo "Configuring the Fernet token provider."
-iniset_sudo $conf token provider fernet
-
-echo "Creating the database tables for keystone."
-sudo keystone-manage db_sync
-
-echo "Initializing Fernet key repositories."
-sudo keystone-manage fernet_setup \
- --keystone-user keystone \
- --keystone-group keystone
-
-sudo keystone-manage credential_setup \
- --keystone-user keystone \
- --keystone-group keystone
-
-echo "Bootstrapping the Identity service."
-sudo keystone-manage bootstrap --bootstrap-password "$ADMIN_PASS" \
- --bootstrap-admin-url http://controller:5000/v3/ \
- --bootstrap-internal-url http://controller:5000/v3/ \
- --bootstrap-public-url http://controller:5000/v3/ \
- --bootstrap-region-id "$REGION"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Configure the Apache HTTP server
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-conf=/etc/apache2/apache2.conf
-echo "Configuring ServerName option in $conf to reference controller node."
-echo "ServerName controller" | sudo tee -a $conf
-
-
-conf=/etc/apache2/sites-enabled/keystone.conf
-if [ -f $conf ]; then
- echo "Identity service virtual hosts enabled."
-else
- echo "Identity service virtual hosts not enabled."
- exit 1
-fi
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Reduce memory usage (not in install-guide)
-sudo sed -i --follow-symlinks '/WSGIDaemonProcess/ s/processes=[0-9]*/processes=1/' $conf
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Finalize the installation
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Restarting apache."
-sudo service apache2 restart
-
-# Set environment variables for authentication
-export OS_USERNAME=$ADMIN_USER_NAME
-export OS_PASSWORD=$ADMIN_PASS
-export OS_PROJECT_NAME=$ADMIN_PROJECT_NAME
-export OS_USER_DOMAIN_NAME=Default
-export OS_PROJECT_DOMAIN_NAME=Default
-export OS_AUTH_URL=http://controller:5000/v3
-export OS_IDENTITY_API_VERSION=3
-
-#------------------------------------------------------------------------------
-# Create a domain, projects, users, and roles
-# https://docs.openstack.org/keystone/train/install/keystone-users-ubuntu.html
-#------------------------------------------------------------------------------
-
-# Wait for keystone to come up
-wait_for_keystone
-
-# Not creating domain because default domain has already been created by
-# keystone-manage bootstrap
-# openstack domain create --description "An Example Domain" example
-
-echo "Creating service project."
-openstack project create --domain default \
- --description "Service Project" \
- "$SERVICE_PROJECT_NAME"
-
-echo "Creating demo project."
-openstack project create --domain default \
- --description "Demo Project" \
- "$DEMO_PROJECT_NAME"
-
-echo "Creating demo user."
-openstack user create --domain default \
- --password "$DEMO_PASS" \
- "$DEMO_USER_NAME"
-
-echo "Creating the user role."
-openstack role create \
- "$USER_ROLE_NAME"
-
-echo "Linking user role to demo project and user."
-openstack role add \
- --project "$DEMO_PROJECT_NAME" \
- --user "$DEMO_USER_NAME" \
- "$USER_ROLE_NAME"
-
-#------------------------------------------------------------------------------
-# Verify operation
-# https://docs.openstack.org/keystone/train/install/keystone-verify-ubuntu.html
-#------------------------------------------------------------------------------
-
-echo "Verifying keystone installation."
-
-# From this point on, we are going to use keystone for authentication
-unset OS_AUTH_URL OS_PASSWORD
-
-echo "Requesting an authentication token as an admin user."
-openstack \
- --os-auth-url http://controller:5000/v3 \
- --os-project-domain-name Default \
- --os-user-domain-name Default \
- --os-project-name "$ADMIN_PROJECT_NAME" \
- --os-username "$ADMIN_USER_NAME" \
- --os-auth-type password \
- --os-password "$ADMIN_PASS" \
- token issue
-
-echo "Requesting an authentication token for the demo user."
-openstack \
- --os-auth-url http://controller:5000/v3 \
- --os-project-domain-name Default \
- --os-user-domain-name Default \
- --os-project-name "$DEMO_PROJECT_NAME" \
- --os-username "$DEMO_USER_NAME" \
- --os-auth-type password \
- --os-password "$DEMO_PASS" \
- token issue
diff --git a/labs/osbash/scripts/ubuntu/setup_neutron_compute.sh b/labs/osbash/scripts/ubuntu/setup_neutron_compute.sh
deleted file mode 100755
index 2c56f513..00000000
--- a/labs/osbash/scripts/ubuntu/setup_neutron_compute.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Install and configure compute node
-# https://docs.openstack.org/neutron/train/install/compute-install-ubuntu.html
-#------------------------------------------------------------------------------
-
-echo "Installing networking components for compute node."
-sudo apt install -y neutron-linuxbridge-agent
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Configure the common component
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Configuring neutron for compute node."
-
-conf=/etc/neutron/neutron.conf
-echo "Configuring $conf."
-
-echo "Configuring RabbitMQ message queue access."
-iniset_sudo $conf DEFAULT transport_url "rabbit://openstack:$RABBIT_PASS@controller"
-
-# Configuring [DEFAULT] section
-iniset_sudo $conf DEFAULT auth_strategy keystone
-
-neutron_admin_user=neutron
-
-# Configuring [keystone_authtoken] section
-iniset_sudo $conf keystone_authtoken www_authenticate_uri http://controller:5000
-iniset_sudo $conf keystone_authtoken auth_url http://controller:5000
-iniset_sudo $conf keystone_authtoken memcached_servers controller:11211
-iniset_sudo $conf keystone_authtoken auth_type password
-iniset_sudo $conf keystone_authtoken project_domain_name default
-iniset_sudo $conf keystone_authtoken user_domain_name default
-iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf keystone_authtoken username "$neutron_admin_user"
-iniset_sudo $conf keystone_authtoken password "$NEUTRON_PASS"
-
-# lock_path, not in install-guide:
-iniset_sudo $conf oslo_concurrency lock_path /var/lib/neutron/tmp
diff --git a/labs/osbash/scripts/ubuntu/setup_neutron_compute_part_2.sh b/labs/osbash/scripts/ubuntu/setup_neutron_compute_part_2.sh
deleted file mode 100755
index 0543947e..00000000
--- a/labs/osbash/scripts/ubuntu/setup_neutron_compute_part_2.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-source "$CONFIG_DIR/openstack"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Install and configure compute node
-# https://docs.openstack.org/neutron/train/install/compute-install-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Configure the Compute service to use the Networking service
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-neutron_admin_user=neutron
-
-echo "Configuring Compute to use Networking."
-conf=/etc/nova/nova.conf
-iniset_sudo $conf neutron auth_url http://controller:5000
-iniset_sudo $conf neutron auth_type password
-iniset_sudo $conf neutron project_domain_name default
-iniset_sudo $conf neutron user_domain_name default
-iniset_sudo $conf neutron region_name "$REGION"
-iniset_sudo $conf neutron project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf neutron username "$neutron_admin_user"
-iniset_sudo $conf neutron password "$NEUTRON_PASS"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Finalize installation
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Restarting the Compute service."
-sudo service nova-compute restart
-
-echo "Restarting neutron-linuxbridge-agent."
-sudo service neutron-linuxbridge-agent restart
-
-#------------------------------------------------------------------------------
-# Networking Option 2: Self-service networks
-# https://docs.openstack.org/neutron/traitrain/install/verify-option2.html
-#------------------------------------------------------------------------------
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-echo "Listing agents to verify successful launch of the neutron agents."
-
-echo "openstack network agent list"
-openstack network agent list
diff --git a/labs/osbash/scripts/ubuntu/setup_neutron_controller.sh b/labs/osbash/scripts/ubuntu/setup_neutron_controller.sh
deleted file mode 100755
index 11a9f249..00000000
--- a/labs/osbash/scripts/ubuntu/setup_neutron_controller.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Install and configure controller node
-# https://docs.openstack.org/neutron/train/install/controller-install-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Prerequisites
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Setting up database for neutron."
-setup_database neutron "$NEUTRON_DB_USER" "$NEUTRON_DBPASS"
-
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-neutron_admin_user=neutron
-
-# Wait for keystone to come up
-wait_for_keystone
-
-echo "Creating neutron user and giving it admin role under service tenant."
-openstack user create \
- --domain default \
- --password "$NEUTRON_PASS" \
- "$neutron_admin_user"
-
-openstack role add \
- --project "$SERVICE_PROJECT_NAME" \
- --user "$neutron_admin_user" \
- "$ADMIN_ROLE_NAME"
-
-echo "Registering neutron with keystone so that other services can locate it."
-openstack service create \
- --name neutron \
- --description "OpenStack Networking" \
- network
-
-openstack endpoint create \
- --region "$REGION" \
- network \
- public http://controller:9696
-
-openstack endpoint create \
- --region "$REGION" \
- network \
- internal http://controller:9696
-
-openstack endpoint create \
- --region "$REGION" \
- network \
- public http://controller:9696
diff --git a/labs/osbash/scripts/ubuntu/setup_neutron_controller_part_2.sh b/labs/osbash/scripts/ubuntu/setup_neutron_controller_part_2.sh
deleted file mode 100755
index 4bd81910..00000000
--- a/labs/osbash/scripts/ubuntu/setup_neutron_controller_part_2.sh
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Set up OpenStack Networking (neutron) for controller node.
-# https://docs.openstack.org/neutron/train/install/controller-install-ubuntu.html
-#------------------------------------------------------------------------------
-
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-neutron_admin_user=neutron
-
-# Wait for keystone to come up
-wait_for_keystone
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Configure the metadata agent
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Configuring the metadata agent."
-conf=/etc/neutron/metadata_agent.ini
-iniset_sudo $conf DEFAULT nova_metadata_host controller
-iniset_sudo $conf DEFAULT metadata_proxy_shared_secret "$METADATA_SECRET"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Configure the Compute service to use the Networking service
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Configuring Compute to use Networking."
-conf=/etc/nova/nova.conf
-iniset_sudo $conf neutron auth_url http://controller:5000
-iniset_sudo $conf neutron auth_type password
-iniset_sudo $conf neutron project_domain_name default
-iniset_sudo $conf neutron user_domain_name default
-iniset_sudo $conf neutron region_name "$REGION"
-iniset_sudo $conf neutron project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf neutron username "$neutron_admin_user"
-iniset_sudo $conf neutron password "$NEUTRON_PASS"
-iniset_sudo $conf neutron service_metadata_proxy true
-iniset_sudo $conf neutron metadata_proxy_shared_secret "$METADATA_SECRET"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Finalize installation
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Populating the database."
-sudo neutron-db-manage \
- --config-file /etc/neutron/neutron.conf \
- --config-file /etc/neutron/plugins/ml2/ml2_conf.ini \
- upgrade head
-
-echo "Restarting nova services."
-sudo service nova-api restart
-
-echo "Restarting neutron-server."
-sudo service neutron-server restart
-
-echo "Restarting neutron-linuxbridge-agent."
-sudo service neutron-linuxbridge-agent restart
-
-echo "Restarting neutron-dhcp-agent."
-sudo service neutron-dhcp-agent restart
-
-echo "Restarting neutron-metadata-agent."
-sudo service neutron-metadata-agent restart
-
-if type neutron-l3-agent; then
- # Installed only for networking option 2 of the install-guide.
- echo "Restarting neutron-l3-agent."
- sudo service neutron-l3-agent restart
-fi
-
-#------------------------------------------------------------------------------
-# Set up OpenStack Networking (neutron) for controller node.
-# https://docs.openstack.org/neutron/train/install/verify-option2.html
-#------------------------------------------------------------------------------
-
-echo -n "Verifying operation."
-until openstack network agent list >/dev/null 2>&1; do
- sleep 1
- echo -n .
-done
-echo
-
-openstack network agent list
diff --git a/labs/osbash/scripts/ubuntu/setup_nova_compute.sh b/labs/osbash/scripts/ubuntu/setup_nova_compute.sh
deleted file mode 100755
index a75f4d55..00000000
--- a/labs/osbash/scripts/ubuntu/setup_nova_compute.sh
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Install and configure a compute node
-# https://docs.openstack.org/nova/train/install/compute-install-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# NOTE We deviate slightly from the install-guide here because inside our VMs,
-# we cannot use KVM inside VirtualBox.
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "Installing nova for compute node."
-sudo apt install -y nova-compute nova-compute-qemu
-
-echo "Configuring nova for compute node."
-
-placement_admin_user=placement
-
-conf=/etc/nova/nova.conf
-echo "Configuring $conf."
-
-echo "Configuring RabbitMQ message queue access."
-iniset_sudo $conf DEFAULT transport_url "rabbit://openstack:$RABBIT_PASS@controller"
-
-# Configuring [api] section.
-iniset_sudo $conf api auth_strategy keystone
-
-nova_admin_user=nova
-
-MY_MGMT_IP=$(get_node_ip_in_network "$(hostname)" "mgmt")
-
-# Configure [keystone_authtoken] section.
-iniset_sudo $conf keystone_authtoken www_authenticate_uri http://controller:5000/
-iniset_sudo $conf keystone_authtoken auth_url http://controller:5000/
-iniset_sudo $conf keystone_authtoken memcached_servers controller:11211
-iniset_sudo $conf keystone_authtoken auth_type password
-iniset_sudo $conf keystone_authtoken project_domain_name Default
-iniset_sudo $conf keystone_authtoken user_domain_name Default
-iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf keystone_authtoken username "$nova_admin_user"
-iniset_sudo $conf keystone_authtoken password "$NOVA_PASS"
-
-# Configure [DEFAULT] section.
-iniset_sudo $conf DEFAULT my_ip "$MY_MGMT_IP"
-iniset_sudo $conf DEFAULT use_neutron true
-iniset_sudo $conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
-
-# Configure [vnc] section.
-iniset_sudo $conf vnc enabled true
-iniset_sudo $conf vnc server_listen 0.0.0.0
-iniset_sudo $conf vnc server_proxyclient_address '$my_ip'
-# Using IP address because the host running the browser may not be able to
-# resolve the host name "controller"
-iniset_sudo $conf vnc novncproxy_base_url http://"$(hostname_to_ip controller)":6080/vnc_auto.html
-
-# Configure [glance] section.
-iniset_sudo $conf glance api_servers http://controller:9292
-
-# Configure [oslo_concurrency] section.
-iniset_sudo $conf oslo_concurrency lock_path /var/lib/nova/tmp
-
-# Configure [placement]
-echo "Configuring Placement services."
-iniset_sudo $conf placement region_name RegionOne
-iniset_sudo $conf placement project_domain_name Default
-iniset_sudo $conf placement project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf placement auth_type password
-iniset_sudo $conf placement user_domain_name Default
-iniset_sudo $conf placement auth_url http://controller:5000/v3
-iniset_sudo $conf placement username "$placement_admin_user"
-iniset_sudo $conf placement password "$PLACEMENT_PASS"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Finalize installation
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# Configure nova-compute.conf
-conf=/etc/nova/nova-compute.conf
-echo -n "Hardware acceleration for virtualization: "
-if sudo egrep -q '(vmx|svm)' /proc/cpuinfo; then
- echo "available."
- iniset_sudo $conf libvirt virt_type kvm
-else
- echo "not available."
- iniset_sudo $conf libvirt virt_type qemu
-fi
-echo "Config: $(sudo grep virt_type $conf)"
-
-echo "Restarting nova services."
-sudo service nova-compute restart
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Add the compute node to the cell database
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo
-echo -n "Confirming that the compute host is in the database."
-AUTH="source $CONFIG_DIR/admin-openstackrc.sh"
-node_ssh controller "$AUTH; openstack compute service list --service nova-compute"
-until node_ssh controller "$AUTH; openstack compute service list --service nova-compute | grep 'compute1.*up'" >/dev/null 2>&1; do
- sleep 2
- echo -n .
-done
-node_ssh controller "$AUTH; openstack compute service list --service nova-compute"
-
-echo
-echo "Discovering compute hosts."
-echo "Run this command on controller every time compute hosts are added to" \
- "the cluster."
-node_ssh controller "sudo nova-manage cell_v2 discover_hosts --verbose"
-
-#------------------------------------------------------------------------------
-# Verify operation
-# https://docs.openstack.org/nova/train/install/verify.html
-#------------------------------------------------------------------------------
-
-echo "Verifying operation of the Compute service."
-
-echo "openstack compute service list"
-openstack compute service list
-
-echo "List API endpoints to verify connectivity with the Identity service."
-echo "openstack catalog list"
-openstack catalog list
-
-echo "Listing images to verify connectivity with the Image service."
-echo "openstack image list"
-openstack image list
-
-echo "Checking the cells and placement API are working successfully."
-echo "on controller node: nova-status upgrade check"
-node_ssh controller "sudo nova-status upgrade check"
diff --git a/labs/osbash/scripts/ubuntu/setup_nova_controller.sh b/labs/osbash/scripts/ubuntu/setup_nova_controller.sh
deleted file mode 100755
index 91260d3e..00000000
--- a/labs/osbash/scripts/ubuntu/setup_nova_controller.sh
+++ /dev/null
@@ -1,199 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Install Compute controller services
-# https://docs.openstack.org/nova/train/install/controller-install-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Prerequisites
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Setting up database nova."
-setup_database nova "$NOVA_DB_USER" "$NOVA_DBPASS"
-
-echo "Setting up database nova_api."
-setup_database nova_api "$NOVA_DB_USER" "$NOVA_DBPASS"
-
-echo "Setting up first cell database."
-# nova_cell0 is default name for first cell database
-# https://docs.openstack.org/developer/nova/cells.html#fresh-install
-setup_database nova_cell0 "$NOVA_DB_USER" "$NOVA_DBPASS"
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-nova_admin_user=nova
-placement_admin_user=placement
-
-# Wait for keystone to come up
-wait_for_keystone
-
-echo "Creating nova user and giving it the admin role."
-openstack user create \
- --domain default \
- --password "$NOVA_PASS" \
- "$nova_admin_user"
-
-openstack role add \
- --project "$SERVICE_PROJECT_NAME" \
- --user "$nova_admin_user" \
- "$ADMIN_ROLE_NAME"
-
-echo "Creating the nova service entity."
-openstack service create \
- --name nova \
- --description "OpenStack Compute" \
- compute
-
-echo "Creating nova endpoints."
-openstack endpoint create \
- --region "$REGION" \
- compute public http://controller:8774/v2.1
-
-openstack endpoint create \
- --region "$REGION" \
- compute internal http://controller:8774/v2.1
-
-openstack endpoint create \
- --region "$REGION" \
- compute admin http://controller:8774/v2.1
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install and configure components
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Installing nova for controller node."
-sudo apt install -y nova-api nova-conductor nova-novncproxy nova-scheduler
-
-conf=/etc/nova/nova.conf
-
-# Configure [api_database] section.
-database_url="mysql+pymysql://$NOVA_DB_USER:$NOVA_DBPASS@controller/nova_api"
-echo "Setting API database connection: $database_url."
-iniset_sudo $conf api_database connection "$database_url"
-
-# Configure [database] section.
-database_url="mysql+pymysql://$NOVA_DB_USER:$NOVA_DBPASS@controller/nova"
-echo "Setting database connection: $database_url."
-iniset_sudo $conf database connection "$database_url"
-
-echo "Configuring nova services."
-
-echo "Configuring RabbitMQ message queue access."
-iniset_sudo $conf DEFAULT transport_url "rabbit://openstack:$RABBIT_PASS@controller:5672"
-
-# Configure [api] section.
-iniset_sudo $conf api auth_strategy keystone
-
-# Configure [keystone_authtoken] section.
-iniset_sudo $conf keystone_authtoken www_authenticate_uri http://controller:5000/
-iniset_sudo $conf keystone_authtoken auth_url http://controller:5000/
-iniset_sudo $conf keystone_authtoken memcached_servers controller:11211
-iniset_sudo $conf keystone_authtoken auth_type password
-iniset_sudo $conf keystone_authtoken project_domain_name Default
-iniset_sudo $conf keystone_authtoken user_domain_name Default
-iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf keystone_authtoken username "$nova_admin_user"
-iniset_sudo $conf keystone_authtoken password "$NOVA_PASS"
-
-# Configure [DEFAULT] section.
-iniset_sudo $conf DEFAULT my_ip "$(hostname_to_ip controller)"
-iniset_sudo $conf DEFAULT use_neutron true
-iniset_sudo $conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
-
-# Configure [VNC] section.
-iniset_sudo $conf vnc enabled true
-iniset_sudo $conf vnc server_listen '$my_ip'
-iniset_sudo $conf vnc server_proxyclient_address '$my_ip'
-
-# Configure [glance] section.
-iniset_sudo $conf glance api_servers http://controller:9292
-
-# Configure [oslo_concurrency] section.
-iniset_sudo $conf oslo_concurrency lock_path /var/lib/nova/tmp
-
-# Delete log_dir line
-# According to the install-guide, "Due to a packaging bug, remove the log_dir
-# option from the [DEFAULT] section."
-sudo grep "^log_dir" $conf
-sudo sed -i "/^log_dir/ d" $conf
-
-echo "Configuring access to the Placement service."
-iniset_sudo $conf placement region_name RegionOne
-iniset_sudo $conf placement project_domain_name Default
-iniset_sudo $conf placement project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf placement auth_type password
-iniset_sudo $conf placement user_domain_name Default
-iniset_sudo $conf placement auth_url http://controller:5000/v3
-iniset_sudo $conf placement username "$placement_admin_user"
-iniset_sudo $conf placement password "$PLACEMENT_PASS"
-
-echo "Populating the nova-api databases."
-sudo nova-manage api_db sync
-
-echo "Registering the cell0 database."
-sudo nova-manage cell_v2 map_cell0
-
-echo "Creating the cell1 cell."
-sudo nova-manage cell_v2 create_cell --name=cell1 --verbose
-
-echo "Populating the nova database."
-sudo nova-manage db sync
-
-echo "Verifying nova cell0 and cell1 are registered correctly."
-sudo nova-manage cell_v2 list_cells
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-# Wait for keystone to come up
-wait_for_keystone
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Finalize installation
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Restarting nova services."
-declare -a nova_services=(nova-api nova-scheduler nova-conductor \
- nova-novncproxy)
-
-for nova_service in "${nova_services[@]}"; do
- echo "Restarting $nova_service."
- sudo service "$nova_service" restart
-done
-
-# Not in install-guide:
-echo "Removing default SQLite database."
-sudo rm -v /var/lib/nova/nova.sqlite
-
-#------------------------------------------------------------------------------
-# Verify the Compute controller installation (not in install-guide)
-#------------------------------------------------------------------------------
-
-echo -n "Verifying operation of the Compute service."
-until openstack service list 2>/dev/null; do
- sleep 1
- echo -n .
-done
-echo
-
-echo "Checking nova endpoints."
-openstack catalog list
-
-echo "Checking nova images."
-openstack image list
diff --git a/labs/osbash/scripts/ubuntu/setup_placement_controller.sh b/labs/osbash/scripts/ubuntu/setup_placement_controller.sh
deleted file mode 100755
index 808488ec..00000000
--- a/labs/osbash/scripts/ubuntu/setup_placement_controller.sh
+++ /dev/null
@@ -1,134 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Install Placement services
-# https://docs.openstack.org/placement/train/install/install-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Prerequisites
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Setting up placement database."
-setup_database placement "$PLACEMENT_DB_USER" "$PLACEMENT_DBPASS"
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-placement_admin_user=placement
-
-# Wait for keystone to come up
-wait_for_keystone
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "Creating placement user and giving it the admin role."
-openstack user create \
- --domain default \
- --password "$PLACEMENT_PASS" \
- "$placement_admin_user"
-
-openstack role add \
- --project "$SERVICE_PROJECT_NAME" \
- --user "$placement_admin_user" \
- "$ADMIN_ROLE_NAME"
-
-echo "Creating the Placement API entry in the service catalog."
-openstack service create \
- --name placement \
- --description "Placement API" \
- placement
-
-echo "Creating placement endpoints."
-openstack endpoint create \
- --region "$REGION" \
- placement public http://controller:8778
-
-openstack endpoint create \
- --region "$REGION" \
- placement internal http://controller:8778
-
-openstack endpoint create \
- --region "$REGION" \
- placement admin http://controller:8778
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install and configure components
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Installing placement-api for controller node."
-sudo apt install -y placement-api
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Reduce memory usage (not in install-guide)
-conf=/etc/apache2/sites-enabled/placement-api.conf
-sudo sed -i --follow-symlinks '/WSGIDaemonProcess/ s/processes=[0-9]*/processes=1/' $conf
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-conf=/etc/placement/placement.conf
-
-# Configure [placement_database] section.
-database_url="mysql+pymysql://$PLACEMENT_DB_USER:$PLACEMENT_DBPASS@controller/placement"
-echo "Setting placement database connection: $database_url."
-iniset_sudo $conf placement_database connection "$database_url"
-
-iniset_sudo $conf api auth_strategy keystone
-
-echo "Configuring Placement services."
-iniset_sudo $conf keystone_authtoken auth_url http://controller:5000/v3
-iniset_sudo $conf keystone_authtoken memcached_servers controller:11211
-iniset_sudo $conf keystone_authtoken auth_type password
-iniset_sudo $conf keystone_authtoken project_domain_name Default
-iniset_sudo $conf keystone_authtoken user_domain_name Default
-iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf keystone_authtoken username "$placement_admin_user"
-iniset_sudo $conf keystone_authtoken password "$PLACEMENT_PASS"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "Populating the placement database."
-sudo placement-manage db sync
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Finalize installation
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Restarting apache2."
-sudo service apache2 restart
-
-#------------------------------------------------------------------------------
-# Verify the Placement controller installation
-# https://docs.openstack.org/placement/train/install/verify.html
-#------------------------------------------------------------------------------
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-# Wait for keystone to come up
-wait_for_keystone
-
-# XXX difference to install-guide: root privileges seem to be needed for the
-# placement-status upgrade check
-echo "Performing status check."
-sudo placement-status upgrade check
-
-# XXX not in the install-guide: install and use python3-pip (not python2)
-echo "Installing python3-pip."
-sudo apt install -y python3-pip
-
-echo "Installing the placement client."
-sudo pip3 install osc-placement
-
-echo "Listing available resource classes and traits."
-openstack --os-placement-api-version 1.2 resource class list --sort-column name
-openstack --os-placement-api-version 1.6 trait list --sort-column name
diff --git a/labs/osbash/scripts/ubuntu/setup_self-service_compute.sh b/labs/osbash/scripts/ubuntu/setup_self-service_compute.sh
deleted file mode 100755
index 9f903c60..00000000
--- a/labs/osbash/scripts/ubuntu/setup_self-service_compute.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Networking Option 2: Self-service networks
-# https://docs.openstack.org/neutron/train/install/compute-install-option2-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Configure the Linux bridge agent
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Configuring the Linux bridge agent."
-conf=/etc/neutron/plugins/ml2/linuxbridge_agent.ini
-
-# Edit the [linux_bridge] section.
-set_iface_list
-PUBLIC_INTERFACE_NAME=$(ifnum_to_ifname 2)
-echo "PUBLIC_INTERFACE_NAME=$PUBLIC_INTERFACE_NAME"
-iniset_sudo $conf linux_bridge physical_interface_mappings provider:$PUBLIC_INTERFACE_NAME
-
-# Edit the [vxlan] section.
-OVERLAY_INTERFACE_IP_ADDRESS=$(get_node_ip_in_network "$(hostname)" "mgmt")
-iniset_sudo $conf vxlan enable_vxlan true
-iniset_sudo $conf vxlan local_ip $OVERLAY_INTERFACE_IP_ADDRESS
-iniset_sudo $conf vxlan l2_population true
-
-# Edit the [securitygroup] section.
-iniset_sudo $conf securitygroup enable_security_group true
-iniset_sudo $conf securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
-
-echo "Ensuring that the kernel supports network bridge filters."
-if ! sudo sysctl net.bridge.bridge-nf-call-iptables; then
- sudo modprobe br_netfilter
- echo "# bridge support module added by training-labs" >> /etc/modules
- echo br_netfilter >> /etc/modules
-fi
diff --git a/labs/osbash/scripts/ubuntu/setup_self-service_controller.sh b/labs/osbash/scripts/ubuntu/setup_self-service_controller.sh
deleted file mode 100755
index da0d673f..00000000
--- a/labs/osbash/scripts/ubuntu/setup_self-service_controller.sh
+++ /dev/null
@@ -1,170 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/credentials"
-source "$LIB_DIR/functions.guest.sh"
-source "$CONFIG_DIR/openstack"
-
-exec_logfile
-
-indicate_current_auto
-
-#------------------------------------------------------------------------------
-# Networking Option 2: Self-service networks
-# https://docs.openstack.org/neutron/train/install/controller-install-option2-ubuntu.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install the components
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Installing additional packages for self-service networks."
-sudo apt install -y \
- neutron-server neutron-plugin-ml2 \
- neutron-linuxbridge-agent neutron-l3-agent neutron-dhcp-agent \
- neutron-metadata-agent
-
-echo "Configuring neutron for controller node."
-function get_database_url {
- local db_user=$NEUTRON_DB_USER
- local database_host=controller
-
- echo "mysql+pymysql://$db_user:$NEUTRON_DBPASS@$database_host/neutron"
-}
-
-database_url=$(get_database_url)
-
-neutron_admin_user=neutron
-
-nova_admin_user=nova
-
-echo "Setting database connection: $database_url."
-conf=/etc/neutron/neutron.conf
-
-# Configure [database] section.
-iniset_sudo $conf database connection "$database_url"
-
-# Configure [DEFAULT] section.
-iniset_sudo $conf DEFAULT core_plugin ml2
-iniset_sudo $conf DEFAULT service_plugins router
-iniset_sudo $conf DEFAULT allow_overlapping_ips true
-
-echo "Configuring RabbitMQ message queue access."
-iniset_sudo $conf DEFAULT transport_url "rabbit://openstack:$RABBIT_PASS@controller"
-
-iniset_sudo $conf DEFAULT auth_strategy keystone
-
-# Configuring [keystone_authtoken] section.
-iniset_sudo $conf keystone_authtoken www_authenticate_uri http://controller:5000
-iniset_sudo $conf keystone_authtoken auth_url http://controller:5000
-iniset_sudo $conf keystone_authtoken memcached_servers controller:11211
-iniset_sudo $conf keystone_authtoken auth_type password
-iniset_sudo $conf keystone_authtoken project_domain_name default
-iniset_sudo $conf keystone_authtoken user_domain_name default
-iniset_sudo $conf keystone_authtoken project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf keystone_authtoken username "$neutron_admin_user"
-iniset_sudo $conf keystone_authtoken password "$NEUTRON_PASS"
-
-# Configure nova related parameters
-iniset_sudo $conf DEFAULT notify_nova_on_port_status_changes true
-iniset_sudo $conf DEFAULT notify_nova_on_port_data_changes true
-
-# Configure [nova] section.
-iniset_sudo $conf nova auth_url http://controller:5000
-iniset_sudo $conf nova auth_type password
-iniset_sudo $conf nova project_domain_name default
-iniset_sudo $conf nova user_domain_name default
-iniset_sudo $conf nova region_name "$REGION"
-iniset_sudo $conf nova project_name "$SERVICE_PROJECT_NAME"
-iniset_sudo $conf nova username "$nova_admin_user"
-iniset_sudo $conf nova password "$NOVA_PASS"
-
-# lock_path, not in install-guide:
-iniset_sudo $conf oslo_concurrency lock_path /var/lib/neutron/tmp
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Configure the Modular Layer 2 (ML2) plug-in
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Configuring the Modular Layer 2 (ML2) plug-in."
-conf=/etc/neutron/plugins/ml2/ml2_conf.ini
-
-# Edit the [ml2] section.
-iniset_sudo $conf ml2 type_drivers flat,vlan,vxlan
-iniset_sudo $conf ml2 tenant_network_types vxlan
-iniset_sudo $conf ml2 mechanism_drivers linuxbridge,l2population
-iniset_sudo $conf ml2 extension_drivers port_security
-
-# Edit the [ml2_type_flat] section.
-iniset_sudo $conf ml2_type_flat flat_networks provider
-
-iniset_sudo $conf ml2_type_vxlan vni_ranges 1:1000
-
-# Edit the [securitygroup] section.
-iniset_sudo $conf securitygroup enable_ipset true
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Configure the Linux bridge agent
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Configuring Linux Bridge agent."
-conf=/etc/neutron/plugins/ml2/linuxbridge_agent.ini
-
-# Edit the [linux_bridge] section.
-set_iface_list
-PUBLIC_INTERFACE_NAME=$(ifnum_to_ifname 2)
-echo "PUBLIC_INTERFACE_NAME=$PUBLIC_INTERFACE_NAME"
-iniset_sudo $conf linux_bridge physical_interface_mappings provider:$PUBLIC_INTERFACE_NAME
-
-# Edit the [vxlan] section.
-OVERLAY_INTERFACE_IP_ADDRESS=$(get_node_ip_in_network "$(hostname)" "mgmt")
-iniset_sudo $conf vxlan enable_vxlan true
-iniset_sudo $conf vxlan local_ip $OVERLAY_INTERFACE_IP_ADDRESS
-iniset_sudo $conf vxlan l2_population true
-
-# Edit the [securitygroup] section.
-iniset_sudo $conf securitygroup enable_security_group true
-iniset_sudo $conf securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
-
-echo "Ensuring that the kernel supports network bridge filters."
-if ! sudo sysctl net.bridge.bridge-nf-call-iptables; then
- sudo modprobe br_netfilter
- echo "# bridge support module added by training-labs" >> /etc/modules
- echo br_netfilter >> /etc/modules
-fi
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Configure the layer-3 agent
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Configuring the layer-3 agent."
-conf=/etc/neutron/l3_agent.ini
-iniset_sudo $conf DEFAULT interface_driver linuxbridge
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Configure the DHCP agent
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo "Configuring the DHCP agent."
-conf=/etc/neutron/dhcp_agent.ini
-iniset_sudo $conf DEFAULT interface_driver linuxbridge
-iniset_sudo $conf DEFAULT dhcp_driver neutron.agent.linux.dhcp.Dnsmasq
-iniset_sudo $conf DEFAULT enable_isolated_metadata true
-
-# Not in install-guide:
-iniset_sudo $conf DEFAULT dnsmasq_config_file /etc/neutron/dnsmasq-neutron.conf
-
-cat << DNSMASQ | sudo tee /etc/neutron/dnsmasq-neutron.conf
-# Override --no-hosts dnsmasq option supplied by neutron
-addn-hosts=/etc/hosts
-
-# Log dnsmasq queries to syslog
-log-queries
-
-# Verbose logging for DHCP
-log-dhcp
-DNSMASQ
diff --git a/labs/osbash/scripts/ubuntu/tacker/create_vim.sh b/labs/osbash/scripts/ubuntu/tacker/create_vim.sh
deleted file mode 100755
index 53714f05..00000000
--- a/labs/osbash/scripts/ubuntu/tacker/create_vim.sh
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-# This script creates an NFV demo user and a NFV project with a VIM.
-# The tacker server is assumed to be up and running.
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-TACKER_DIR="$TOP_DIR/scripts/ubuntu/tacker"
-
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-source "$CONFIG_DIR/credentials"
-
-#------------------------------------------------------------------------------
-
-DEFAULT_VIM_PROJECT_NAME="nfv"
-DEFAULT_VIM_USER="nfv_user"
-DEFAULT_VIM_PASSWORD="nfv_user_secret"
-
-(
-source "$HOME/admin-openrc.sh"
-
-echo "Creating nfv demo project."
-openstack project create --domain default \
- --description "NFV demo Project" \
- "$DEFAULT_VIM_PROJECT_NAME"
-
-echo "Creating nfv demo user ($DEFAULT_VIM_USER)."
-openstack user create --domain default \
- --password "$DEFAULT_VIM_PASSWORD" \
- "$DEFAULT_VIM_USER"
-
-echo "Granting admin role to nfv user in nfv project."
-openstack role add \
- --project "$DEFAULT_VIM_PROJECT_NAME" \
- --user "$DEFAULT_VIM_USER" \
- "admin"
-
-# XXX advsvc role does not seem to be necessary for nfv_user
-# echo "Granting advsvc role to nfv_user in nfv project."
-# openstack role add \
-# --project "$DEFAULT_VIM_PROJECT_NAME" \
-# --user "$DEFAULT_VIM_USER" \
-# "advsvc"
-)
-
-CONTROLLER_MGMT_IP=$(get_node_ip_in_network "controller" "mgmt")
-
-cat "$CONFIG_DIR/demo-openstackrc.sh" | sed -ne "
- s/\$DEMO_PROJECT_NAME/$DEFAULT_VIM_PROJECT_NAME/
- s/\$DEMO_USER_NAME/$DEFAULT_VIM_USER/
- s/\$DEMO_PASS/$DEFAULT_VIM_PASSWORD/
- s/controller/$CONTROLLER_MGMT_IP/
- /^export/p
- " > "$HOME/nfv-openrc.sh"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Register default VIM
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo -e "\n>>> Registering the controller node as the VIM that will be\n" \
- " used as a default VIM for VNF deployments."
-echo -e " This is required when the optional argument 'cim-id' is not\n" \
- " provided by the user during 'vnf-create'.\n"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Generate the config.yaml file
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-conf="$TACKER_DIR/nvf-demo-vim-config.yaml"
-
-echo -e "\n>>> Creating $conf."
-
-cat << EOM > "$conf"
-auth_url: http://$CONTROLLER_MGMT_IP:5000/v3/
-username: $DEFAULT_VIM_USER
-password: $DEFAULT_VIM_PASSWORD
-project_name: $DEFAULT_VIM_PROJECT_NAME
-project_domain_name: Default
-user_domain_name: Default
-EOM
-
-source "$HOME/nfv-openrc.sh"
-
-echo -e "\n>>> Registering VIM."
-
-tacker vim-register --is-default \
- --config-file "$conf" \
- --description "Controller node is VIM" demo-vim
-
-echo -n "Waiting for VIM to become reachable."
-cnt=0
-while ! tacker vim-show demo-vim | grep "^| status.*REACHABLE"; do
- sleep 1
- echo -n .
- cnt=$((cnt + 1))
- if [ $cnt -eq 20 ]; then
- tacker vim-show demo-vim
- echo "VIM not reachable. Aborting."
- exit 1
- fi
-done
-echo "VIM is reachable."
-
-tacker vim-show demo-vim
-
-echo "Calling vim-events-list."
-tacker vim-events-list
diff --git a/labs/osbash/scripts/ubuntu/tacker/create_vnf.sh b/labs/osbash/scripts/ubuntu/tacker/create_vnf.sh
deleted file mode 100755
index 29036fb5..00000000
--- a/labs/osbash/scripts/ubuntu/tacker/create_vnf.sh
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-# This script creates a simple test VNF (a CirrOS instance).
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-VNF_NAME=vnf-sample
-VNFD_NAME=vnfd-sample
-
-# FIXME When starting from a snapshot after setup_tacker, we need to wait
-# for about 30 seconds before vnf-create or it will fail (time out).
-# Log files don't show anything interesting happening during that time.
-# Good: 30 30
-# Bad: 10 20 25
-echo "Sleeping for 30 seconds."
-sleep 30
-
-echo "Sourcing the nfv user credentials."
-source "$HOME/nfv-openrc.sh"
-
-echo "Verifying that default vim is configured and reachable."
-tacker vim-list -fvalue -cid -cis_default -cstatus | grep "True REACHABLE"
-
-echo "openstack image list"
-openstack image list
-
-echo "tacker vim-list --column id --column name --column type"
-tacker vim-list --column id --column name --column type
-
-#------------------------------------------------------------------------------
-# Create vnfd
-#------------------------------------------------------------------------------
-
-cfg_file=~/tacker/tacker/config/tosca-cirros-vnfd.yaml
-mkdir -p "$(dirname $cfg_file)"
-
-# From https://docs.openstack.org/tacker/latest/install/getting_started.html
-cat << VNFD > "$cfg_file"
-tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
-
-description: Demo example
-
-metadata:
- template_name: sample-tosca-vnfd
-
-topology_template:
- node_templates:
- VDU1:
- type: tosca.nodes.nfv.VDU.Tacker
- capabilities:
- nfv_compute:
- properties:
- num_cpus: 1
- mem_size: 64 MB
- disk_size: 1 GB
- properties:
- image: cirros
- availability_zone: nova
- mgmt_driver: noop
- monitoring_policy:
- name: ping
- parameters:
- count: 3
- interval: 10
- actions:
- failure: respawn
- config: |
- param0: key1
- param1: key2
- user_data_format: RAW
- user_data: |
- #!/bin/sh
- cat << EOF > /user-data-test
- # File created by create_vnf.sh to demonstrate the use of user data.
- EOF
- date >> /user-data-test
-
- CP1:
- type: tosca.nodes.nfv.CP.Tacker
- properties:
- management: true
- order: 0
- anti_spoofing_protection: false
- requirements:
- - virtualLink:
- node: VL1
- - virtualBinding:
- node: VDU1
-
- VL1:
- type: tosca.nodes.nfv.VL
- properties:
- network_name: net_mgmt
- vendor: Tacker
-VNFD
-
-# Replace devstack network name with training-labs network name
-sed -i 's/net_mgmt/provider/' "$cfg_file"
-
-echo "Creating vnfd with $cfg_file."
-tacker vnfd-create --vnfd-file "$cfg_file" "$VNFD_NAME"
-
-tacker vnfd-list
-
-VNFD_ID=$(tacker vnfd-show "$VNFD_NAME" -cid -fvalue)
-echo "Got vnfdid $VNFD_ID."
-
-echo "Calling tacker vnfd-events-list."
-tacker vnfd-events-list
-
-echo "Calling tacker vnfd-show $VNFD_ID."
-tacker vnfd-show "$VNFD_ID"
-
-#------------------------------------------------------------------------------
-# Create vnf
-#------------------------------------------------------------------------------
-echo "Creating vnf: tacker vnf-create --vnfd-id $VNFD_ID $VNF_NAME"
-tacker vnf-create --vnfd-id "$VNFD_ID" "$VNF_NAME"
-
-echo -n "Waiting for vnf to become active (this can take a while)."
-cnt=0
-while true; do
- status=$(tacker vnf-show -cstatus "$VNF_NAME" -fvalue)
- if [ "$status" = "ACTIVE" ]; then
- break
- elif [ "$status" = "ERROR" ]; then
- echo "ERROR vnf is in error state. Aborting."
- exit 1
- fi
- sleep 1
- echo -n .
- cnt=$((cnt + 1))
- if [ $cnt -eq 60 ]; then
- tacker vnf-show "$VNF_NAME"
- echo "vnf not active. Aborting."
- exit 1
- fi
-done
-echo "vnf is active."
-
-tacker vnf-show "$VNF_NAME"
-
-echo "Showing vnf events."
-tacker vnf-events-list
-
-echo "Showing all events."
-tacker events-list
-
-#------------------------------------------------------------------------------
-IP=$(tacker vnf-show "$VNF_NAME" -cmgmt_url -fvalue | \
- grep -Po "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")
-echo "IP address of vnf: $IP"
-ROUTER_NAMESPACE=$(ip netns | grep qrouter | awk '{print $1}')
-echo "Router namespace ID: $ROUTER_NAMESPACE"
-
-echo "sudo ip netns exec $ROUTER_NAMESPACE ping -c1 $IP"
-sudo ip netns exec "$ROUTER_NAMESPACE" ping -c1 "$IP"
-
-echo "Script $(basename "$0") completed successfully."
diff --git a/labs/osbash/scripts/ubuntu/tacker/setup_tacker_server.sh b/labs/osbash/scripts/ubuntu/tacker/setup_tacker_server.sh
deleted file mode 100755
index f6c88b43..00000000
--- a/labs/osbash/scripts/ubuntu/tacker/setup_tacker_server.sh
+++ /dev/null
@@ -1,336 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit -o nounset
-
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-TACKER_DIR="$TOP_DIR/scripts/ubuntu/tacker"
-
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-OPENSTACK_RELEASE=pike
-
-#------------------------------------------------------------------------------
-# Install Tacker
-# https://docs.openstack.org/tacker/pike/install/manual_installation.html
-#------------------------------------------------------------------------------
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Prerequisites
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-TACKER_DB_USER=tacker
-TACKER_DBPASS=tacker_db_secret
-TACKER_PASS=tacker_user_secret
-
-# Tacker is not part of the standard install, cache may be stale by now
-sudo apt update
-
-echo "Installing git, pip, and virtualenv."
-sudo apt install -y git python-pip virtualenv
-
-echo -e "\n>>> Confirming Port Security configuration in ml2_conf.ini\n"
-
-conf=/etc/neutron/plugins/ml2/ml2_conf.ini
-# Get everything from [ml2] to an empty line
-ML2=$(awk '/\[ml2\]/,/^$/' "$conf")
-echo
-if echo "$ML2" | grep "extension_drivers = port_security"; then
- echo ">>> Found extension driver \"port_security\" in file $conf."
- echo
-else
- echo "ERROR Extension driver \"port_security\" not found in $conf."
- echo
- exit 1
-fi
-
-# Allow users in non-admin projects with 'admin' roles to create flavors.
-
-echo -e "\n>>> Modifying the Heat service /etc/heat/policy.json file.\n"
-
-# XXX heat removes policy.json in Queens (review.openstack.org/#/c/505360/);
-# to change defaults, create policy.yaml and have heat.conf point to it:
-# conf="/etc/heat/policy.yaml"
-# touch "$conf"
-# echo '"resource_types:OS::Nova::Flavor": "role:admin"' >> "$conf"
-#sudo sed -i.bak 's/"resource_types:OS::Nova::Flavor.*/"resource_types:OS::Nova::Flavor": "role:admin",/' /etc/heat/policy.json
-
-# Set up the tacker database
-
-echo -e "\n>>> Setting up database tacker.\n"
-
-setup_database tacker "$TACKER_DB_USER" "$TACKER_DBPASS"
-
-echo "Sourcing the admin credentials."
-source "$CONFIG_DIR/admin-openstackrc.sh"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "Verifying that mistral is available."
-openstack endpoint list | grep workflowv2
-mistral workbook-list
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-tacker_admin_user=tacker
-
-echo -e "\n>>> Creating a tacker user with admin privileges.\n"
-
-openstack user create \
- --domain Default \
- --password "$TACKER_PASS" \
- "$tacker_admin_user"
-
-echo -e "\n>>> Adding admin role to service project for tacker user.\n"
-
-openstack role add \
- --project service \
- --user "$tacker_admin_user" \
- admin
-
-echo "Creating the advsvc role."
-openstack role create "advsvc"
-
-echo -e "\n>>> Adding advsvc role to service project for tacker user.\n"
-# The advanced services (advsvc) role was introduced in neutron by
-# Change-Id: I94cb3383eb1fed793934719603f888dbbdbbd85a. It allows viewing
-# networks of other projects and creating/updating/deleting ports there.
-
-openstack role add \
- --project service \
- --user "$tacker_admin_user" \
- "advsvc"
-
-echo -e "\n>>> Creating the tacker service.\n"
-
-openstack service create \
- --name tacker \
- --description "Tacker Service" \
- "nfv-orchestration"
-
-echo -e "\n>>> Add endpoints for tacker.\n"
-
-openstack endpoint create \
- --region RegionOne "nfv-orchestration" \
- public http://controller:9890/
-
-openstack endpoint create \
- --region RegionOne "nfv-orchestration" \
- internal http://controller:9890/
-
-openstack endpoint create \
- --region RegionOne "nfv-orchestration" \
- admin http://controller:9890/
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install the tacker server
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# tosca-parser has been removed from upstream instructions
-#echo -e "\n>>> Installing tosca-parser.\n"
-#sudo pip install tosca-parser
-
-mkdir ~/tacker
-
-VENV_PATH=~/tacker/venv
-
-# heat-translator pulls in a novaclient which breaks horizon; therefore,
-# keep tacker and its dependencies in a virtualenv
-virtualenv $VENV_PATH
-
-# virtualenv activate breaks with nounset
-set +o nounset
-source $VENV_PATH/bin/activate
-set -o nounset
-
-# translator.hot needed by openstack infra_driver
-echo -e "\n>>> Installing heat-translator.\n"
-pip install heat-translator
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install the tacker server
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo -e "\n>>> Downloading tacker from git repository.\n"
-
-cd ~/tacker
-git clone https://github.com/openstack/tacker -b "stable/$OPENSTACK_RELEASE"
-
-cd tacker
-echo -e "\n>>> Changed to $(pwd) directory.\n"
-
-echo -e "\n>>> Installing tacker.\n"
-# Don't call sudo or virtualenv will be ignored
-python setup.py install
-
-# Create a log directory
-
-echo -e "\n>>> Creating log directory.\n"
-
-sudo mkdir /var/log/tacker
-
-#tacker_conf=/usr/local/etc/tacker/tacker.conf
-tacker_conf=$VENV_PATH/etc/tacker/tacker.conf
-echo -e "\n>>> Copy the tacker.conf file to $tacker_conf.\n"
-
-sudo cp -vf "$TACKER_DIR/tacker.conf" \
- "$tacker_conf"
-
-echo -e "\n>>> Populating the tacker database\n"
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo "Installing packages needed by tacker."
-# Needed by tacker-db-manage
-pip install -r ~/tacker/tacker/requirements.txt
-# needed by mysqldb
-sudo apt install -y libmysqlclient-dev
-# module mysqldb, needed by tacker-db-manage
-pip install mysql-python
-# module memcache needed by tacker
-pip install python-memcached
-# networking-sfc (OpenStack Service Function Chaining) needed for
-# tacker's VNF Forwarding Graph (VNFFG)
-echo "Installing python-networking-sfc."
-sudo apt install -y python-networking-sfc
-# The first neutron in PATH is $VENV_PATH/bin/neutron which cannot find
-# the networking-sfc extensions. Call /usr/bin/neutron instead.
-echo "New commands added by python-networking-sfc:"
-echo "Checking neutron client."
-/usr/bin/neutron --help | grep flow-classifier-
-echo "Checking openstack client."
-openstack help sfc
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-#/usr/local/bin/tacker-db-manage \
-/home/osbash/tacker/venv/bin/tacker-db-manage \
- --config-file $tacker_conf \
- upgrade head
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install the tacker client
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-# Alternative: sudo apt install python-tackerclient
-
-echo -e "\n>>> Cloning tacker-client repository.\n"
-
-cd ~/tacker
-git clone https://github.com/openstack/python-tackerclient \
- -b "stable/$OPENSTACK_RELEASE"
-
-echo -e "\n>>> Installing tacker-client.\n"
-
-cd python-tackerclient
-
-python setup.py install
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Install tacker horizon
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo -e "\n>>> Cloning tacker-horizon repository.\n"
-
-cd ~/tacker
-git clone https://github.com/openstack/tacker-horizon \
- -b "stable/$OPENSTACK_RELEASE"
-
-echo -e "\n>>> Install horizon module.\n"
-
-cd tacker-horizon
-
-python setup.py install
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo -e "\n>>> Creating symlinks to virtual env for apache (tacker_horizon).\n"
-
-sudo ln -sv $VENV_PATH/lib/python2.7/site-packages/tacker_horizon \
- /usr/local/lib/python2.7/dist-packages/
-
-sudo ln -sv $VENV_PATH/lib/python2.7/site-packages/tacker_horizon-*.egg-info \
- /usr/local/lib/python2.7/dist-packages/
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo -e "\n>>> Enabling tacker horizon in dashboard.\n"
-
-sudo cp -v tacker_horizon/enabled/* \
- /usr/share/openstack-dashboard/openstack_dashboard/enabled/
-
-echo -e "\n>>> Restarting Apache server.\n"
-
-sudo systemctl restart apache2
-
-echo -e "\n>>> Verifying that horizon is still working."
-if ! wget -O - localhost/horizon | grep "Login - OpenStack Dashboard"; then
- echo "ERROR We seem to have broken horizon. Aborting."
- exit 1
-fi
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Start Tacker server
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-echo -e "\n>>> Creating tacker user.\n"
-
-sudo useradd --system --user-group --shell /bin/false \
- --home-dir /var/lib/tacker tacker
-
-echo -e "\n>>> Creating /etc/tacker.\n"
-
-sudo mkdir -p /etc/tacker
-sudo chown tacker:tacker /etc/tacker
-
-echo -e "\n>>> Copying systemd unit file into place.\n"
-
-sudo cp -vf "$TACKER_DIR/systemd-tacker.service" \
- /etc/systemd/system/tacker-server.service
-
-sudo sed -i -e "
- s,%VENV_PATH%,$VENV_PATH,g;
-" /etc/systemd/system/tacker-server.service
-
-sudo cp -vf "$TACKER_DIR/systemd-tacker.service" \
- /etc/systemd/system/tacker-conductor.service
-
-sudo sed -i -e "
- s,%VENV_PATH%,$VENV_PATH,g;
- s/tacker-server/tacker-conductor/g;
-" /etc/systemd/system/tacker-conductor.service
-
-#------------------------------------------------------------------------------
-# Add vim_ping_action to mistral
-#------------------------------------------------------------------------------
-
-echo -e "\n>>> Creating symlinks to virtual env for mistral.\n"
-
-sudo ln -sv $VENV_PATH/lib/python2.7/site-packages/tacker \
- /usr/local/lib/python2.7/dist-packages/
-
-# Help mistral find the entry point for vim_ping_action
-sudo ln -sv $VENV_PATH/lib/python2.7/site-packages/tacker-*.egg-info \
- /usr/local/lib/python2.7/dist-packages/
-
-echo -e "\n>>> Populating mistral DB.\n"
-# Taken from commit message "vim monitor using rpc"
-# tacker repo, commit it 60187643b586568e9c6f51c45d8b91ab697ed3fc
-sudo /usr/bin/mistral-db-manage \
- --config-file /etc/mistral/mistral.conf \
- populate
-
-echo -e "\n>>> Restarting mistral.\n"
-sudo systemctl restart mistral-api
-sudo systemctl restart mistral-engine
-sudo systemctl restart mistral-executor
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-echo -e "\n>>> Starting tacker server.\n"
-sudo systemctl enable tacker-server
-sudo systemctl start tacker-server
-
-echo -e "\n>>> Starting tacker conductor.\n"
-sudo systemctl enable tacker-conductor
-sudo systemctl start tacker-conductor
-
-echo -e "\n>>> Waiting for tacker to come up.\n"
-
-until tacker ext-list; do
- sleep 1
-done
-
-echo -e "\n>>> Connection established, tacker is up.\n"
diff --git a/labs/osbash/scripts/ubuntu/tacker/systemd-tacker.service b/labs/osbash/scripts/ubuntu/tacker/systemd-tacker.service
deleted file mode 100644
index 877926a3..00000000
--- a/labs/osbash/scripts/ubuntu/tacker/systemd-tacker.service
+++ /dev/null
@@ -1,23 +0,0 @@
-# tacker-server
-#
-# OpenStack Tacker provides NFV orchestration
-#
-# Purpose: systemd service file (Ubuntu 16.04)
-# Location: /etc/systemd/system/tacker-server.service
-# Logs: journalctl -u tacker-server
-
-[Unit]
-Description=OpenStack Tacker
-After=syslog.target network.target auditd.service
-
-[Service]
-Type=simple
-User=tacker
-Group=tacker
-ExecStart=%VENV_PATH%/bin/tacker-server --config-file %VENV_PATH%/etc/tacker/tacker.conf --debug
-ExecReload=/bin/kill -HUP $MAINPID
-Restart=always
-TimeoutSec=10
-
-[Install]
-WantedBy=multi-user.target
diff --git a/labs/osbash/scripts/ubuntu/tacker/tacker.conf b/labs/osbash/scripts/ubuntu/tacker/tacker.conf
deleted file mode 100644
index 06d76dc8..00000000
--- a/labs/osbash/scripts/ubuntu/tacker/tacker.conf
+++ /dev/null
@@ -1,42 +0,0 @@
-[DEFAULT]
-auth_strategy = keystone
-policy_file = /home/osbash/tacker/venv/etc/tacker/policy.json
-debug = True
-use_syslog = False
-bind_host = 10.0.0.11
-bind_port = 9890
-service_plugins = nfvo,vnfm
-state_path = /var/lib/tacker
-
-# https://docs.openstack.org/tacker/pike/install/manual_installation.html
-[nfvo]
-vim_drivers = openstack
-
-# sample config file uses nfvo_vim, not nfvo
-[nfvo_vim]
-vim_drivers = openstack
-
-[keystone_authtoken]
-memcached_servers = 11211
-region_name = RegionOne
-auth_type = password
-project_domain_name = Default
-user_domain_name = Default
-username = tacker
-project_name = service
-password = tacker_user_secret
-auth_url = http://10.0.0.11:5000
-www_authenticate_uri = http://10.0.0.11:5000
-
-[agent]
-root_helper = sudo /home/osbash/tacker/venv/bin/tacker-rootwrap /home/osbash/tacker/venv/etc/tacker/rootwrap.conf
-
-[database]
-connection = mysql://tacker:tacker_db_secret@10.0.0.11:3306/tacker?charset=utf8
-
-# DEFAULT location seems to be deprecated
-#[oslo_policy]
-#policy_file = /home/osbash/tacker/venv/etc/tacker/policy.json
-
-[tacker]
-monitor_driver = ping,http_ping
diff --git a/labs/osbash/scripts/zero_empty.sh b/labs/osbash/scripts/zero_empty.sh
deleted file mode 100755
index 2691db46..00000000
--- a/labs/osbash/scripts/zero_empty.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-set -o errexit -o nounset
-TOP_DIR=$(cd $(cat "../TOP_DIR" 2>/dev/null||echo $(dirname "$0"))/.. && pwd)
-source "$TOP_DIR/config/paths"
-source "$LIB_DIR/functions.guest.sh"
-
-indicate_current_auto
-
-exec_logfile
-
-# Fill unused disk space with zeroes (the disk image is easier to compress when
-# it doesn't contain leftovers from deleted files)
-zero_empty_space
diff --git a/labs/osbash/tools/README.rst b/labs/osbash/tools/README.rst
deleted file mode 100644
index 64a1a02f..00000000
--- a/labs/osbash/tools/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-The tools in this directory are for advanced users and developers. They
-can be used to test changes in the training-cluster.
diff --git a/labs/osbash/tools/downloader.js b/labs/osbash/tools/downloader.js
deleted file mode 100644
index 597c6c16..00000000
--- a/labs/osbash/tools/downloader.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Taken from http://superuser.com/a/536400 */
-/* Use: cscript /nologo downloader.js */
-/* Used by Windows batch scripts to download distro ISO image */
-
-var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
-WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);
-WinHttpReq.Send();
-
-BinStream = new ActiveXObject("ADODB.Stream");
-BinStream.Type = 1;
-BinStream.Open();
-BinStream.Write(WinHttpReq.ResponseBody);
-BinStream.SaveToFile("downloaded.bin");
diff --git a/labs/osbash/tools/get_node_logs.sh b/labs/osbash/tools/get_node_logs.sh
deleted file mode 100755
index 4d6a2bf5..00000000
--- a/labs/osbash/tools/get_node_logs.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-set -o errexit -o nounset
-TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/localrc"
-source "$CONFIG_DIR/deploy.osbash"
-source "$CONFIG_DIR/openstack"
-source "$OSBASH_LIB_DIR/functions-host.sh"
-source "$OSBASH_LIB_DIR/$PROVIDER-functions.sh"
-
-function usage {
- echo "Purpose: Get logs from cluster node VMs."
- echo "Usage: $0 []"
- exit 1
-}
-
-if [ $# = 0 ]; then
- usage
-else
- RESULTS_DIR=$1
- if [ ! -d "$RESULTS_DIR" ]; then
- echo >&2 "Error: no such directory: $RESULTS_DIR"
- exit 1
- fi
-fi
-
-for node in $(script_cfg_get_nodenames); do
- (
- source "$CONFIG_DIR/config.$node"
- node_dir=$RESULTS_DIR/$node
-
- ssh_env_for_node $node
- if vm_ssh "$VM_SSH_PORT" exit; then
- echo "Getting server log files from $node node."
- mkdir "$node_dir"
- vm_ssh "$VM_SSH_PORT" "sudo tar cf - -C /var log --exclude=installer" | tar xf - -C "$node_dir"
- vm_ssh "$VM_SSH_PORT" "dmesg" > "$node_dir"/dmesg
- else
- echo "VM $node does not reply."
- continue
- fi
-
- echo -e "Splitting log files into:\n\t$node_dir/split_logs"
- "$TOP_DIR/tools/log_snapshot_split.py" \
- --logdir "$node_dir/log" \
- --resultdir "$node_dir/split_logs" \
- "$node_dir/log"
- )
-done
-
-echo "Getting test log files from controller node."
-ssh_env_for_node controller
-if vm_ssh "$VM_SSH_PORT" 'ls log/test-*.*' >/dev/null 2>&1; then
- vm_ssh "$VM_SSH_PORT" 'cd log; tar cf - test-*.*' | tar xf - -C "$RESULTS_DIR/controller"
- vm_ssh "$VM_SSH_PORT" 'rm log/test-*.*'
-else
- echo "VM controller does not reply or no test log files found."
-fi
diff --git a/labs/osbash/tools/git_info.sh b/labs/osbash/tools/git_info.sh
deleted file mode 100755
index ce46aab0..00000000
--- a/labs/osbash/tools/git_info.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-
-# Purpose: print current state of git tree (for logging purposes)
-# Usage: git_info.sh
-
-set -o errexit -o nounset
-
-if ! GITEXE=$(which git); then
- echo "No git executable in path. Exiting."
- exit 1
-fi
-
-echo " $(git describe --all --long --dirty)"
-
-# All active changes (un-/staged) to tracked files
-git --no-pager diff HEAD -p --stat
diff --git a/labs/osbash/tools/log_snapshot_split.py b/labs/osbash/tools/log_snapshot_split.py
deleted file mode 100755
index aa825c70..00000000
--- a/labs/osbash/tools/log_snapshot_split.py
+++ /dev/null
@@ -1,229 +0,0 @@
-#!/usr/bin/env python
-
-"""
-
-This script splits out log file portions based on full log files and
-"ls -l" snapshots that document their size at various points in time.
-
-"""
-
-# Force Python 2 to use float division even for ints
-from __future__ import division
-from __future__ import print_function
-
-import argparse
-import errno
-import mmap
-import os
-import sys
-
-from glob import glob
-
-# Extension of directory snapshot files
-SNAP_EXT = "lsl"
-
-
-def get_destdir(destdir, name):
- """Return destination directory for results of current snapshot."""
-
- # Remove extension from name
- basename = os.path.splitext(name)[0]
-
- dir_path = os.path.join(destdir, basename)
-
- # Sanity check: we don't want to overwrite exisiting results.
- if os.path.exists(dir_path):
- print("ERROR: destination directory already exists:", dir_path)
- sys.exit(1)
-
- return dir_path
-
-
-def get_file_slice(path, old_size, size):
- """Get the content from first to second byte counter of given file."""
- with open(path, "r+b") as fin:
- try:
- mmp = mmap.mmap(fin.fileno(), 0)
- except ValueError as err:
- if os.path.getsize(path) == 0:
- # Log file is empty, nothing to mmap or read
- return None
- else:
- # Some other error, pass it on
- raise err
- else:
- mmp.seek(old_size)
- return mmp.read(size - old_size)
-
-
-def create_parent_dirs_for(file_path):
- """Create parent directories for given file or directory."""
- dir_path = os.path.dirname(file_path)
- try:
- os.makedirs(dir_path)
- except OSError as err:
- if err.errno == errno.EEXIST and os.path.isdir(dir_path):
- pass
- else:
- raise
-
-
-def get_size_and_path(line):
- """From a 'ls -l' line, return columns 4 (size) and 8 (path)."""
- cols = line.split()
- size, path = (int(cols[4]), cols[8])
- return size, path
-
-
-def get_ls_snap_files_from_dir(snapdir):
- """Get paths of all 'ls -l' snapshot files in given directory."""
- # Return them sorted so they get processed in order
- return sorted(glob(os.path.join(snapdir, "*." + SNAP_EXT)))
-
-
-def get_ls_snap_files_from_path(snap_paths, verbose):
- """Get paths of all 'ls -l' snapshot files."""
- ls_snap_files = []
-
- for path in snap_paths:
- if os.path.isdir(path):
- if len(snap_paths) > 1:
- print("ERROR LS_SNAP_PATH contains a directory and additional "
- "paths. Aborting.")
- sys.exit(1)
- ls_snap_files = get_ls_snap_files_from_dir(path)
- break
- elif os.path.isfile(path):
- ls_snap_files.append(path)
- else:
- print("Bad argument: ", path)
- sys.exit(1)
-
- if verbose:
- print("LS_SNAP_PATH ", snap_paths)
- print("'ls -l' snapshot files ", ls_snap_files)
-
- return ls_snap_files
-
-
-def get_log_and_result_dirs(args):
- """Return paths to log and result directories."""
- if os.path.isdir(args.ls_snap_path[0]):
- snapdir = args.ls_snap_path[0]
- else:
- snapdir = os.path.dirname(args.ls_snap_path[0])
-
- if args.logdir is None:
- logdir = snapdir
- else:
- logdir = args.logdir
-
- if args.resultdir is None:
- # If no destination directory is given, use a subdir in the snapdir
- resultdir = os.path.join(snapdir, "split_logs")
- else:
- resultdir = args.resultdir
-
- if args.verbose:
- print("LOG_DIR ", logdir)
- print("RESULTS_DIR", resultdir)
-
- return logdir, resultdir
-
-
-def write_results(result_path, new_lines):
- """Create one split out log file (and any parent directories)."""
- # Create parent directories (if any) for current log file
- create_parent_dirs_for(result_path)
-
- with open(result_path, "w") as fout:
- # If the log file was empty at this point, skip writing
- # new_lines (Empty) to the split out file.
- if new_lines:
- fout.write(new_lines)
-
-
-def indicate_new_snapshot(snap_name, verbose):
- """Indicate progress by printing name (verbose) or a dot."""
- if verbose:
- print(snap_name)
- else:
- # Print dots to indicate progress
- print('.', end='')
- sys.stdout.flush()
-
-
-def process_snap_files(ls_snap_files, args):
- """Read snapshot files and create split out log files."""
-
- logdir, resultdir = get_log_and_result_dirs(args)
-
- # For each log file, number of bytes handled so far
- log_size = dict()
-
- for ls_snap_file in ls_snap_files:
-
- snap_name = os.path.basename(ls_snap_file)
-
- indicate_new_snapshot(snap_name, args.verbose)
-
- with open(ls_snap_file, "r") as ls_snap_content:
-
- # Create directory for results of this log snapshot
- dest_subdir = get_destdir(resultdir, snap_name)
-
- for ls_line in ls_snap_content:
- new_size, log_path = get_size_and_path(ls_line)
- # If the path in the "ls -l" files is absolute, make it
- # relative; os.path.join would ignore the target directory path
- # otherwise
- log_rpath = log_path.strip("/")
-
-
- if args.verbose:
- print("\t", log_rpath)
-
- if log_rpath not in log_size:
- # New log file
- log_size[log_rpath] = 0
- elif log_size[log_rpath] == new_size:
- # Log file did not change, skip
- continue
-
- src_log = os.path.join(logdir, log_rpath)
- new_lines = get_file_slice(src_log, log_size[log_rpath],
- new_size)
-
- log_size[log_rpath] = new_size
-
- result_path = os.path.join(dest_subdir, log_rpath)
- write_results(result_path, new_lines)
-
- if not args.verbose:
- # New line after last period of progress indicator
- print('')
-
-
-def main():
- parser = argparse.ArgumentParser(description="Split log files according to"
- " 'ls -l' snapshots.")
- parser.add_argument('ls_snap_path', metavar='LS_SNAP_PATH', nargs='+',
- help="'ls -l' snapshot files or directory containing"
- " them")
- parser.add_argument('--logdir', metavar='LOG_DIR', nargs='?',
- help="Root directory for log files (default: "
- "LS_SNAP_PATH)")
- parser.add_argument('--resultdir', metavar='RESULT_DIR', nargs='?',
- help="Target directory for results (default: "
- "LS_SNAP_PATH/split_logs)")
- parser.add_argument('--verbose', action='store_true')
- args = parser.parse_args()
-
- ls_snap_files = get_ls_snap_files_from_path(args.ls_snap_path,
- args.verbose)
-
- process_snap_files(ls_snap_files, args)
-
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/labs/osbash/tools/repeat-test.sh b/labs/osbash/tools/repeat-test.sh
deleted file mode 100755
index 8646ff84..00000000
--- a/labs/osbash/tools/repeat-test.sh
+++ /dev/null
@@ -1,190 +0,0 @@
-#!/bin/bash
-set -o errexit -o nounset
-TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
-source "$TOP_DIR/config/localrc"
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/deploy.osbash"
-source "$OSBASH_LIB_DIR/functions-host.sh"
-source "$OSBASH_LIB_DIR/$PROVIDER-functions.sh"
-
-if [ -f "$TOP_DIR/osbash.sh" ]; then
- BUILD_EXE=$TOP_DIR/osbash.sh
- OSBASH=exec_cmd
-elif [ -f "$TOP_DIR/st.py" ]; then
- BUILD_EXE=$TOP_DIR/st.py
- # Stacktrain options
- ST_OPT=""
-else
- echo "No build exe found."
- exit 1
-fi
-
-echo "Using $BUILD_EXE"
-
-RESULTS_ROOT=$LOG_DIR/test-results
-
-CONTROLLER_SNAPSHOT="controller_node_installed"
-
-VERBOSE=${VERBOSE:=1}
-
-function usage {
- echo "Usage: $0 {-b|-c|-t } [-s '']"
- echo ""
- echo "-h Help"
- echo "-c Restore node VMs to current snapshot for each test"
- echo "-e Enable snapshot cycles during build"
- echo "-t SNAP Restore cluster to target snapshot for each test"
- echo "-r REP Number of repetitions (default: endless loop)"
- echo "-s NODES Start each named node VM after restoring the cluster"
- echo "-b Rebuild cluster for each test, from scratch or snapshot"
- echo " ($(basename $BUILD_EXE) -b cluster [...])"
-}
-
-while getopts :bcehqr:s:t: opt; do
- case $opt in
- b)
- REBUILD=yes
- ;;
- c)
- CURRENT=yes
- ;;
- h)
- usage
- exit 0
- ;;
- q)
- echo "Ignoring -q, it is the default now."
- ;;
- e)
- if [ -f "$TOP_DIR/osbash.sh" ]; then
- export SNAP_CYCLE=yes
- else
- ST_OPT="$ST_OPT -e"
- fi
- ;;
- r)
- REP=$OPTARG
- ;;
- s)
- START_VMS=$OPTARG
- ;;
- t)
- arg=$OPTARG
- for node in $(script_cfg_get_nodenames); do
- if vm_exists "$node"; then
- if vm_snapshot_exists "$node" "$arg"; then
- TARGET_SNAPSHOT=$arg
- break
- fi
- fi
- done
- if [ -z "${TARGET_SNAPSHOT:-""}" ]; then
- echo >&2 "No snapshot named $arg found."
- exit 1
- fi
- ;;
- :)
- echo "Error: -$OPTARG needs argument"
- ;;
- ?)
- echo "Error: invalid option -$OPTARG"
- echo
- usage
- exit 1
- ;;
- esac
-done
-
-if [ -z "${REBUILD:-}" -a -z "${CURRENT:-}" -a -z "${TARGET_SNAPSHOT:-}" ]; then
- usage
- exit 1
-fi
-
-# Remove processed options from arguments
-shift $(( OPTIND - 1 ));
-
-mkdir -p "$RESULTS_ROOT"
-
-# Default to repeating forever
-: ${REP:=-1}
-
-function run_test {
- local script_name=$1
- local script_path=$TOP_DIR/scripts/test/$script_name
- local log_path=$LOG_DIR/test-$(basename "$script_name" .sh).log
- echo "Running test. Log file: $log_path"
- TEST_ONCE=$TOP_DIR/tools/test-once.sh
- if [ "${VERBOSE:-}" -eq 1 ]; then
- "$TEST_ONCE" "$script_path" 2>&1 | tee "$log_path" || rc=$?
- else
- "$TEST_ONCE" "$script_path" > "$log_path" 2>&1 || rc=$?
- fi
-
- echo "################################################################"
- if grep -q "$script_name returned status: 0" "$log_path"; then
- echo "# Test passed: $script_name"
- else
- echo "# ERROR: Test failed: $script_name"
- fi
- echo "################################################################"
-}
-
-cnt=0
-until [ $cnt -eq $REP ]; do
- cnt=$((cnt + 1))
-
- dir_name=$(get_next_prefix "$RESULTS_ROOT" "")
- echo "####################################################################"
- echo "Starting test $dir_name."
- dir=$RESULTS_ROOT/$dir_name
- mkdir -p "$dir"
-
- (
- cd "$TOP_DIR"
-
- if [ -n "${TARGET_SNAPSHOT:-}" ]; then
- "$TOP_DIR/tools/restore-cluster.sh" -t "$TARGET_SNAPSHOT"
- if [ -n "${START_VMS:-}" ]; then
- # Start VMs as requested by user
- for vm_name in $START_VMS; do
- echo >&2 "$0: booting node $vm_name."
- vm_boot "$vm_name"
- # Sleeping for 10 s fixes some problems, but it might be
- # better to fix client scripts to wait for the services they
- # need instead of just failing.
- done
- fi
- fi
-
- # Log information about current state of source tree (ignore failure)
- "$TOP_DIR/tools/git_info.sh" > "$LOG_DIR/git_info.log" || rc=$?
-
- rc=0
- if [ -n "${REBUILD:-}" ]; then
- if [ -n "${TARGET_SNAPSHOT:-}" ]; then
- LEAVE_VMS_RUNNING=yes "$BUILD_EXE" ${ST_OPT:-} -t "$TARGET_SNAPSHOT" -b cluster || rc=$?
- else
- "$BUILD_EXE" ${ST_OPT:-} -b cluster || rc=$?
- fi
- fi
- echo "####################################################################"
-
- if [ $rc -ne 0 ]; then
- echo "ERROR: Cluster build failed. Skipping test."
- else
- for script_name in launch_instance_private_net.sh heat_stack.sh \
- test_horizon.sh; do
- run_test "$script_name"
- done
- fi
- )
-
- echo "Copying osbash and test log files into $dir."
- (
- cd "$LOG_DIR"
- cp -a *.auto *.log *.xml *.db *.cfg "$dir" || rc=$?
- )
-
- echo "Copying upstart log files into $dir."
- "$TOP_DIR/tools/get_node_logs.sh" "$dir"
-done
diff --git a/labs/osbash/tools/restore-cluster.sh b/labs/osbash/tools/restore-cluster.sh
deleted file mode 100755
index 3dfcadc1..00000000
--- a/labs/osbash/tools/restore-cluster.sh
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/bin/bash
-set -o errexit -o nounset
-TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
-
-source "$TOP_DIR/config/localrc"
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/deploy.osbash"
-source "$OSBASH_LIB_DIR/functions-host.sh"
-source "$OSBASH_LIB_DIR/$PROVIDER-functions.sh"
-
-OSBASH=exec_cmd
-
-function usage {
- # Setting to empty string selects latest (current snapshot)
- echo "Usage: $0 {-l|-c|-t } [-s]"
- echo ""
- echo "-h Help"
- echo "-l List snapshots for node VMs"
- echo "-c Restore cluster node VMs to current snapshot"
- echo "-t SNAP Restore cluster to target snapshot"
- echo "-s Start each node VMs after restoring it"
- exit
-}
-
-function list_snapshots {
- for vm_name in $(script_cfg_get_nodenames); do
- if ! vm_exists "$vm_name"; then
- echo "VM $vm_name does not exist. Skipping..."
- continue
- fi
-
- echo -e "Snapshot list for $vm_name node:"
- vm_snapshot_list_tree "$vm_name"
- echo
- done
- exit 0
-}
-
-while getopts :chlst: opt; do
- case $opt in
- c)
- CURRENT=yes
- ;;
- h)
- usage
- ;;
- l)
- list_snapshots
- ;;
- s)
- START=yes
- ;;
- t)
- TARGET_SNAPSHOT=$OPTARG
- ;;
- :)
- echo "Error: -$OPTARG needs argument"
- ;;
- ?)
- echo "Error: invalid option -$OPTARG"
- echo
- usage
- ;;
- esac
-done
-
-# Remove processed options from arguments
-shift $(( OPTIND - 1 ));
-
-if [ $# -ne 0 ]; then
- usage
-elif [ -z "${TARGET_SNAPSHOT:-}" -a -z "${CURRENT:-""}" ]; then
- echo
- echo "Error: no target snapshot given."
- echo
- usage
-elif [ -n "${TARGET_SNAPSHOT:-}" -a -n "${CURRENT:-""}" ]; then
- echo
- echo "Error: conflicting options: target snapshot name and -c."
- echo
- usage
-fi
-
-# Find target_snapshot in scripts_cfg and set global *_SNAPSHOT variables
-# to the correct snapshot name for each node (to allow building from there)
-function set_snapshot_vars {
- local target_snapshot=$1
-
- local found=0
- local config_name=$(get_distro_name "$DISTRO")_cluster
- local scripts_cfg="$CONFIG_DIR/scripts.$config_name"
-
- while read -r line; do
- if [[ $line =~ ^cmd\ snapshot.*-n\ ([^ ]*)\ (.*) ]]; then
- # Node name (e.g. controller)
- node=${BASH_REMATCH[1]}
-
- # Snapshot name (e.g. keystone_installed)
- snapshot=${BASH_REMATCH[2]}
-
- # Global variable name (e.g. CONTROLLER_SNAPSHOT)
- # Can't use ${node,,} (OS X bash version is only 3.2)
- var_name=$(echo "$node"|tr "a-z" "A-Z")_SNAPSHOT
-
- if [ "$snapshot" = "$target_snapshot" ]; then
- # Can't use associative arrays (OS X bash version is only 3.2)
- eval "${var_name}=$snapshot"
-
- found=1
- elif [ $found -eq 0 ]; then
- eval "${var_name}=$snapshot"
- fi
- fi
- done < "$scripts_cfg"
-
- if [ $found -eq 0 ]; then
- echo "ERROR: snapshot '$target_snapshot' not found"
- exit 1
- fi
-}
-
-if [ -n "${TARGET_SNAPSHOT:-}" ]; then
- set_snapshot_vars "$TARGET_SNAPSHOT"
-fi
-
-for vm_name in $(script_cfg_get_nodenames); do
- if ! vm_exists "$vm_name"; then
- echo "VM $vm_name does not exist. Skipping..."
- continue
- fi
-
- vm_power_off "$vm_name"
- vm_wait_for_shutdown "$vm_name"
-
- if [ "${CURRENT:-""}" = "yes" ]; then
- vm_snapshot_restore_current "$vm_name"
- if [ "${START:-""}" = "yes" ]; then
- vm_boot "$vm_name"
- fi
- else
- # Global variable name (e.g. CONTROLLER_SNAPSHOT)
- # (use tr due to OS X bash limitation)
- var_name=$(echo "$vm_name"|tr "a-z" "A-Z")_SNAPSHOT
- if [ -z "${!var_name:=""}" ]; then
- vm_delete "$vm_name"
- else
- vm_snapshot_restore "$vm_name" "${!var_name}"
- if [ "${START:-""}" = "yes" ]; then
- vm_boot "$vm_name"
- fi
- fi
- fi
-done
-
diff --git a/labs/osbash/tools/test-once.sh b/labs/osbash/tools/test-once.sh
deleted file mode 100755
index b1cd0611..00000000
--- a/labs/osbash/tools/test-once.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/bash
-set -o errexit -o nounset
-TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
-source "$TOP_DIR/config/localrc"
-source "$TOP_DIR/config/paths"
-source "$CONFIG_DIR/localrc"
-source "$CONFIG_DIR/deploy.osbash"
-source "$CONFIG_DIR/openstack"
-source "$OSBASH_LIB_DIR/functions-host.sh"
-source "$OSBASH_LIB_DIR/$PROVIDER-functions.sh"
-
-if [ $# -eq 0 ]; then
- echo "Purpose: Copy one script to target node and execute it via ssh."
- echo "Usage: $0