Merge "Enable debug logging in q-agt output"
diff --git a/HACKING.rst b/HACKING.rst
index 6ad8c7e..77194a3 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -7,8 +7,8 @@
DevStack is written in POSIX shell script. This choice was made because
it best illustrates the configuration steps that this implementation takes
-on setting up and interacting with OpenStack components. DevStack specifies
-BASH and is compatible with Bash 3.
+on setting up and interacting with OpenStack components. DevStack specifically
+uses Bash and is compatible with Bash 3.
DevStack's official repository is located on GitHub at
https://github.com/openstack-dev/devstack.git. Besides the master branch that
@@ -30,9 +30,17 @@
generally useful shell functions and is used by a number of the scripts in
DevStack.
+The ``lib`` directory contains sub-scripts for projects or packages that ``stack.sh``
+sources to perform much of the work related to those projects. These sub-scripts
+contain configuration defaults and functions to configure, start and stop the project
+or package. These variables and functions are also used by related projects,
+such as Grenade, to manage a DevStack installation.
+
A number of additional scripts can be found in the ``tools`` directory that may
-be useful in setting up special-case uses of DevStack. These include: bare metal
-deployment, ramdisk deployment and Jenkins integration.
+be useful in supporting DevStack installations. Of particular note are ``info.sh``
+to collect and report information about the installed system, and ``instal_prereqs.sh``
+that handles installation of the prerequisite packages for DevStack. It is
+suitable, for example, to pre-load a system for making a snapshot.
Scripts
@@ -63,8 +71,8 @@
source $TOP_DIR/openrc
``stack.sh`` is a rather large monolithic script that flows through from beginning
-to end. The process of breaking it down into project-level sub-scripts is nearly
-complete and should make ``stack.sh`` easier to read and manage.
+to end. It has been broken down into project-specific subscripts (as noted above)
+located in ``lib`` to make ``stack.sh`` more manageable and to promote code reuse.
These library sub-scripts have a number of fixed entry points, some of which may
just be stubs. These entry points will be called by ``stack.sh`` in the
@@ -112,6 +120,7 @@
``FOO=${FOO:-baz}``); if they did then they can already be changed in ``localrc``
and can stay in the project file.
+
Documentation
-------------
diff --git a/README.md b/README.md
index d8538c2..6570a14 100644
--- a/README.md
+++ b/README.md
@@ -120,14 +120,16 @@
# Optional, to enable tempest configuration as part of devstack
enable_service tempest
-Then run stack.sh as normal.
+Then run `stack.sh` as normal.
+
+# Tempest
If tempest has been successfully configured, a basic set of smoke tests can be run as follows:
$ cd /opt/stack/tempest
$ nosetests tempest/tests/network/test_network_basic_ops.py
-Multi-Node Setup
+# Multi-Node Setup
A more interesting setup involves running multiple compute nodes, with Quantum networks connecting VMs on different compute nodes.
You should run at least one "controller node", which should have a `stackrc` that includes at least:
diff --git a/exercise.sh b/exercise.sh
index 3516738..ce694fb 100755
--- a/exercise.sh
+++ b/exercise.sh
@@ -23,7 +23,7 @@
EXERCISE_DIR=$TOP_DIR/exercises
-if [ -z "${basenames}" ] ; then
+if [[ -z "${basenames}" ]]; then
# Locate the scripts we should run
basenames=$(for b in `ls $EXERCISE_DIR/*.sh`; do basename $b .sh; done)
else
@@ -38,7 +38,7 @@
# Loop over each possible script (by basename)
for script in $basenames; do
- if [[ ,$SKIP_EXERCISES, =~ ,$script, ]] ; then
+ if [[ ,$SKIP_EXERCISES, =~ ,$script, ]]; then
skips="$skips $script"
else
echo "====================================================================="
@@ -48,7 +48,7 @@
exitcode=$?
if [[ $exitcode == 55 ]]; then
skips="$skips $script"
- elif [[ $exitcode -ne 0 ]] ; then
+ elif [[ $exitcode -ne 0 ]]; then
failures="$failures $script"
else
passes="$passes $script"
@@ -69,6 +69,6 @@
done
echo "====================================================================="
-if [ -n "$failures" ] ; then
+if [[ -n "$failures" ]]; then
exit 1
fi
diff --git a/exercises/client-args.sh b/exercises/client-args.sh
index 1e92500..28f4123 100755
--- a/exercises/client-args.sh
+++ b/exercises/client-args.sh
@@ -67,7 +67,7 @@
# Keystone client
# ---------------
if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
- if [[ "$SKIP_EXERCISES" =~ "key" ]] ; then
+ if [[ "$SKIP_EXERCISES" =~ "key" ]]; then
STATUS_KEYSTONE="Skipped"
else
echo -e "\nTest Keystone"
@@ -84,7 +84,7 @@
# -----------
if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
- if [[ "$SKIP_EXERCISES" =~ "n-api" ]] ; then
+ if [[ "$SKIP_EXERCISES" =~ "n-api" ]]; then
STATUS_NOVA="Skipped"
STATUS_EC2="Skipped"
else
@@ -103,7 +103,7 @@
# -------------
if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then
- if [[ "$SKIP_EXERCISES" =~ "c-api" ]] ; then
+ if [[ "$SKIP_EXERCISES" =~ "c-api" ]]; then
STATUS_CINDER="Skipped"
else
echo -e "\nTest Cinder"
@@ -120,7 +120,7 @@
# -------------
if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
- if [[ "$SKIP_EXERCISES" =~ "g-api" ]] ; then
+ if [[ "$SKIP_EXERCISES" =~ "g-api" ]]; then
STATUS_GLANCE="Skipped"
else
echo -e "\nTest Glance"
@@ -137,7 +137,7 @@
# ------------
if [[ "$ENABLED_SERVICES" =~ "swift" || "$ENABLED_SERVICES" =~ "s-proxy" ]]; then
- if [[ "$SKIP_EXERCISES" =~ "swift" ]] ; then
+ if [[ "$SKIP_EXERCISES" =~ "swift" ]]; then
STATUS_SWIFT="Skipped"
else
echo -e "\nTest Swift"
@@ -152,8 +152,9 @@
set +o xtrace
+
# Results
-# -------
+# =======
function report() {
if [[ -n "$2" ]]; then
diff --git a/exercises/client-env.sh b/exercises/client-env.sh
index dd8e56e..147fdfc 100755
--- a/exercises/client-env.sh
+++ b/exercises/client-env.sh
@@ -60,7 +60,7 @@
# Keystone client
# ---------------
if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
- if [[ "$SKIP_EXERCISES" =~ "key" ]] ; then
+ if [[ "$SKIP_EXERCISES" =~ "key" ]]; then
STATUS_KEYSTONE="Skipped"
else
echo -e "\nTest Keystone"
@@ -77,7 +77,7 @@
# -----------
if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
- if [[ "$SKIP_EXERCISES" =~ "n-api" ]] ; then
+ if [[ "$SKIP_EXERCISES" =~ "n-api" ]]; then
STATUS_NOVA="Skipped"
STATUS_EC2="Skipped"
else
@@ -111,7 +111,7 @@
# -------------
if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then
- if [[ "$SKIP_EXERCISES" =~ "c-api" ]] ; then
+ if [[ "$SKIP_EXERCISES" =~ "c-api" ]]; then
STATUS_CINDER="Skipped"
else
echo -e "\nTest Cinder"
@@ -128,7 +128,7 @@
# -------------
if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
- if [[ "$SKIP_EXERCISES" =~ "g-api" ]] ; then
+ if [[ "$SKIP_EXERCISES" =~ "g-api" ]]; then
STATUS_GLANCE="Skipped"
else
echo -e "\nTest Glance"
@@ -146,7 +146,7 @@
if [[ "$ENABLED_SERVICES" =~ "swift" || "$ENABLED_SERVICES" =~ "s-proxy" ]]; then
- if [[ "$SKIP_EXERCISES" =~ "swift" ]] ; then
+ if [[ "$SKIP_EXERCISES" =~ "swift" ]]; then
STATUS_SWIFT="Skipped"
else
echo -e "\nTest Swift"
@@ -161,8 +161,9 @@
set +o xtrace
+
# Results
-# -------
+# =======
function report() {
if [[ -n "$2" ]]; then
diff --git a/exercises/quantum-adv-test.sh b/exercises/quantum-adv-test.sh
index a1fb2ad..fbb1b77 100755
--- a/exercises/quantum-adv-test.sh
+++ b/exercises/quantum-adv-test.sh
@@ -330,7 +330,7 @@
}
function delete_networks {
- foreach_tenant_net 'delete_network ${%TENANT%_NAME} ${%NUM%}'
+ foreach_tenant_net 'delete_network ${%TENANT%_NAME} %NUM%'
#TODO(nati) add secuirty group check after it is implemented
# source $TOP_DIR/openrc demo1 demo1
# nova secgroup-delete-rule default icmp -1 -1 0.0.0.0/0
diff --git a/files/apache-horizon.template b/files/apache-horizon.template
index fb98471..af880c4 100644
--- a/files/apache-horizon.template
+++ b/files/apache-horizon.template
@@ -17,6 +17,7 @@
<Directory %HORIZON_DIR%/>
Options Indexes FollowSymLinks MultiViews
+ %HORIZON_REQUIRE%
AllowOverride None
Order allow,deny
allow from all
diff --git a/functions b/functions
index 445af5f..88e4a62 100644
--- a/functions
+++ b/functions
@@ -57,15 +57,12 @@
# die $LINENO "message"
function die() {
local exitcode=$?
+ set +o xtrace
+ local line=$1; shift
if [ $exitcode == 0 ]; then
exitcode=1
fi
- set +o xtrace
- local msg="[ERROR] $0:$1 $2"
- echo $msg 1>&2;
- if [[ -n ${SCREEN_LOGDIR} ]]; then
- echo $msg >> "${SCREEN_LOGDIR}/error.log"
- fi
+ err $line "$*"
exit $exitcode
}
@@ -75,14 +72,49 @@
# NOTE: env-var is the variable name without a '$'
# die_if_not_set $LINENO env-var "message"
function die_if_not_set() {
- (
- local exitcode=$?
- set +o xtrace
- local evar=$2; shift
- if ! is_set $evar || [ $exitcode != 0 ]; then
- die $@
- fi
- )
+ 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] $0:$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
}
@@ -299,7 +331,7 @@
os_RELEASE=$(lsb_release -r -s)
os_UPDATE=""
os_PACKAGE="rpm"
- if [[ "Debian,Ubuntu" =~ $os_VENDOR ]]; then
+ if [[ "Debian,Ubuntu,LinuxMint" =~ $os_VENDOR ]]; then
os_PACKAGE="deb"
elif [[ "SUSE LINUX" =~ $os_VENDOR ]]; then
lsb_release -d -s | grep -q openSUSE
@@ -538,6 +570,7 @@
sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=.*$\)|#\1|" "$file"
}
+
# Uncomment an option in an INI file
# iniuncomment config-file section option
function iniuncomment() {
@@ -559,6 +592,7 @@
echo ${line#*=}
}
+
# Determinate is the given option present in the INI file
# ini_has_option config-file section option
function ini_has_option() {
@@ -570,6 +604,7 @@
[ -n "$line" ]
}
+
# Set an option in an INI file
# iniset config-file section option value
function iniset() {
@@ -592,6 +627,7 @@
fi
}
+
# Get a multiple line option from an INI file
# iniget_multiline config-file section option
function iniget_multiline() {
@@ -603,6 +639,7 @@
echo ${values}
}
+
# Set a multiple line option in an INI file
# iniset_multiline config-file section option value1 value2 valu3 ...
function iniset_multiline() {
@@ -632,6 +669,7 @@
done
}
+
# Append a new option in an ini file without replacing the old value
# iniadd config-file section option value1 value2 value3 ...
function iniadd() {
@@ -643,6 +681,17 @@
iniset_multiline $file $section $option $values
}
+# 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
+}
+
+
# is_service_enabled() checks if the service(s) specified as arguments are
# enabled by the user in ``ENABLED_SERVICES``.
#
@@ -830,7 +879,7 @@
if [[ -z "$os_PACKAGE" ]]; then
GetOSVersion
fi
- if [[ $TRACK_DEPENDS = True ]] ; then
+ if [[ $TRACK_DEPENDS = True ]]; then
source $DEST/.venv/bin/activate
CMD_PIP=$DEST/.venv/bin/pip
SUDO_PIP="env"
@@ -1005,7 +1054,7 @@
# Uses globals ``TRACK_DEPENDES``, ``*_proxy`
# setup_develop directory
function setup_develop() {
- if [[ $TRACK_DEPENDS = True ]] ; then
+ if [[ $TRACK_DEPENDS = True ]]; then
SUDO_CMD="env"
else
SUDO_CMD="sudo"
@@ -1288,7 +1337,7 @@
local DEFAULT_INSTANCE_USER=$4
local ACTIVE_TIMEOUT=$5
local probe_cmd=""
- if ! timeout $ACTIVE_TIMEOUT sh -c "while ! ssh -o StrictHostKeyChecking=no -i $KEY_FILE ${DEFAULT_INSTANCE_USER}@$FLOATING_IP echo success ; do sleep 1; done"; then
+ if ! timeout $ACTIVE_TIMEOUT sh -c "while ! ssh -o StrictHostKeyChecking=no -i $KEY_FILE ${DEFAULT_INSTANCE_USER}@$FLOATING_IP echo success; do sleep 1; done"; then
die $LINENO "server didn't become ssh-able!"
fi
}
diff --git a/lib/baremetal b/lib/baremetal
index 17a967f..8658c3a 100644
--- a/lib/baremetal
+++ b/lib/baremetal
@@ -53,6 +53,7 @@
XTRACE=$(set +o | grep xtrace)
set +o xtrace
+
# Sub-driver settings
# -------------------
diff --git a/lib/ceilometer b/lib/ceilometer
index f7d14d5..6b110cb 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -37,12 +37,16 @@
CEILOMETER_AUTH_CACHE_DIR=${CEILOMETER_AUTH_CACHE_DIR:-/var/cache/ceilometer}
# Support potential entry-points console scripts
-if [ -d $CEILOMETER_DIR/bin ] ; then
+if [[ -d $CEILOMETER_DIR/bin ]]; then
CEILOMETER_BIN_DIR=$CEILOMETER_DIR/bin
else
CEILOMETER_BIN_DIR=$(get_python_exec_prefix)
fi
+
+# Functions
+# ---------
+
# cleanup_ceilometer() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_ceilometer() {
@@ -93,7 +97,7 @@
}
function configure_mongodb() {
- if is_fedora ; then
+ if is_fedora; then
# ensure smallfiles selected to minimize freespace requirements
sudo sed -i '/--smallfiles/!s/OPTIONS=\"/OPTIONS=\"--smallfiles /' /etc/sysconfig/mongod
@@ -135,6 +139,7 @@
done
}
+
# Restore xtrace
$XTRACE
diff --git a/lib/cinder b/lib/cinder
index deace68..221108e 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -64,6 +64,10 @@
VOLUME_GROUP2=${VOLUME_GROUP2:-stack-volumes2}
VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
+
+# Functions
+# ---------
+
# _clean_volume_group removes all cinder volumes from the specified volume group
# _clean_volume_group $VOLUME_GROUP $VOLUME_NAME_PREFIX
function _clean_volume_group() {
@@ -373,21 +377,20 @@
setup_develop $CINDERCLIENT_DIR
}
-# apply config.d approach (e.g. Oneiric does not have this)
+# apply config.d approach for cinder volumes directory
function _configure_tgt_for_config_d() {
- if [[ ! -d /etc/tgt/conf.d/ ]]; then
- sudo mkdir -p /etc/tgt/conf.d
- echo "include /etc/tgt/conf.d/*.conf" | sudo tee -a /etc/tgt/targets.conf
+ if [[ ! -d /etc/tgt/stack.d/ ]]; then
+ sudo ln -sf $CINDER_STATE_PATH/volumes /etc/tgt/stack.d
+ echo "include /etc/tgt/stack.d/*" | sudo tee -a /etc/tgt/targets.conf
fi
}
# start_cinder() - Start running processes, including screen
function start_cinder() {
if is_service_enabled c-vol; then
+ # Delete any old stack.conf
+ sudo rm -f /etc/tgt/conf.d/stack.conf
_configure_tgt_for_config_d
- if [[ ! -f /etc/tgt/conf.d/stack.conf ]]; then
- echo "include $CINDER_STATE_PATH/volumes/*" | sudo tee /etc/tgt/conf.d/stack.conf
- fi
if is_ubuntu; then
# tgt in oneiric doesn't restart properly if tgtd isn't running
# do it in two steps
@@ -432,6 +435,7 @@
fi
}
+
# Restore xtrace
$XTRACE
diff --git a/lib/database b/lib/database
index cbe886f..e63d5e2 100644
--- a/lib/database
+++ b/lib/database
@@ -20,14 +20,18 @@
XTRACE=$(set +o | grep xtrace)
set +o xtrace
+
# Register a database backend
# $1 The name of the database backend
+# This is required to be defined before the specific database scripts are sourced
function register_database {
[ -z "$DATABASE_BACKENDS" ] && DATABASE_BACKENDS=$1 || DATABASE_BACKENDS+=" $1"
}
# Sourcing the database libs sets DATABASE_BACKENDS with the available list
-for f in $TOP_DIR/lib/databases/*; do source $f; done
+for f in $TOP_DIR/lib/databases/*; do
+ source $f;
+done
# ``DATABASE_BACKENDS`` now contains a list of the supported databases
# Look in ``ENABLED_SERVICES`` to see if one has been selected
@@ -42,6 +46,9 @@
# This is not an error as multi-node installs will do this on the compute nodes
+# Functions
+# ---------
+
# Get rid of everything enough to cleanly change database backends
function cleanup_database {
cleanup_database_$DATABASE_TYPE
@@ -112,6 +119,7 @@
database_connection_url_$DATABASE_TYPE $var $db
}
+
# Restore xtrace
$XTRACE
diff --git a/lib/databases/mysql b/lib/databases/mysql
index 30450b1..056aec4 100644
--- a/lib/databases/mysql
+++ b/lib/databases/mysql
@@ -8,8 +8,13 @@
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
+
register_database mysql
+
+# Functions
+# ---------
+
# Get rid of everything enough to cleanly change database backends
function cleanup_database_mysql {
if is_ubuntu; then
@@ -137,6 +142,7 @@
echo "$BASE_SQL_CONN/$db?charset=utf8"
}
+
# Restore xtrace
$MY_XTRACE
diff --git a/lib/databases/postgresql b/lib/databases/postgresql
index b64de2c..b173772 100644
--- a/lib/databases/postgresql
+++ b/lib/databases/postgresql
@@ -8,8 +8,13 @@
PG_XTRACE=$(set +o | grep xtrace)
set +o xtrace
+
register_database postgresql
+
+# Functions
+# ---------
+
# Get rid of everything enough to cleanly change database backends
function cleanup_database_postgresql {
stop_service postgresql
@@ -88,6 +93,7 @@
echo "$BASE_SQL_CONN/$db?client_encoding=utf8"
}
+
# Restore xtrace
$PG_XTRACE
diff --git a/lib/glance b/lib/glance
index 3376400..583f879 100644
--- a/lib/glance
+++ b/lib/glance
@@ -51,8 +51,8 @@
GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$SERVICE_HOST:9292}
-# Entry Points
-# ------------
+# Functions
+# ---------
# cleanup_glance() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
@@ -199,6 +199,7 @@
screen -S $SCREEN_NAME -p g-reg -X kill
}
+
# Restore xtrace
$XTRACE
diff --git a/lib/heat b/lib/heat
index 88535c3..32c0182 100644
--- a/lib/heat
+++ b/lib/heat
@@ -25,9 +25,14 @@
# Defaults
# --------
+
+# set up default directories
HEAT_DIR=$DEST/heat
HEATCLIENT_DIR=$DEST/python-heatclient
-# set up default directories
+
+
+# Functions
+# ---------
# cleanup_heat() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
@@ -182,6 +187,7 @@
done
}
+
# Restore xtrace
$XTRACE
diff --git a/lib/horizon b/lib/horizon
index b63e1f8..05bf6d3 100644
--- a/lib/horizon
+++ b/lib/horizon
@@ -38,6 +38,10 @@
APACHE_USER=${APACHE_USER:-$USER}
APACHE_GROUP=${APACHE_GROUP:-$(id -gn $APACHE_USER)}
+
+# Functions
+# ---------
+
# utility method of setting python option
function _horizon_config_set() {
local file=$1
@@ -98,6 +102,7 @@
sudo mkdir -p $HORIZON_DIR/.blackhole
+ HORIZON_REQUIRE=''
if is_ubuntu; then
APACHE_NAME=apache2
APACHE_CONF=sites-available/horizon
@@ -111,6 +116,12 @@
elif is_fedora; then
APACHE_NAME=httpd
APACHE_CONF=conf.d/horizon.conf
+
+ if [[ "$os_RELEASE" -ge "18" ]]; then
+ # fedora 18 has Require all denied in its httpd.conf
+ # and requires explicit Require all granted
+ HORIZON_REQUIRE='Require all granted'
+ fi
sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
elif is_suse; then
APACHE_NAME=apache2
@@ -128,6 +139,7 @@
s,%HORIZON_DIR%,$HORIZON_DIR,g;
s,%APACHE_NAME%,$APACHE_NAME,g;
s,%DEST%,$DEST,g;
+ s,%HORIZON_REQUIRE%,$HORIZON_REQUIRE,g;
\" $FILES/apache-horizon.template >/etc/$APACHE_NAME/$APACHE_CONF"
}
@@ -152,6 +164,9 @@
if [[ ! -e "/usr/bin/node" ]]; then
install_package nodejs-legacy
fi
+ elif is_fedora && [[ "$os_RELEASE" -ge "18" ]]; then
+ # fedora 18 and higher gets nodejs
+ install_package nodejs
fi
git_clone $HORIZON_REPO $HORIZON_DIR $HORIZON_BRANCH $HORIZON_TAG
diff --git a/lib/keystone b/lib/keystone
index 0fbc7d7..6bf4d9f 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -63,8 +63,8 @@
SERVICE_TENANT_NAME=${SERVICE_TENANT_NAME:-service}
-# Entry Points
-# ------------
+# Functions
+# ---------
# cleanup_keystone() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
diff --git a/lib/ldap b/lib/ldap
index 53f6837..89b31b2 100644
--- a/lib/ldap
+++ b/lib/ldap
@@ -1,13 +1,17 @@
# lib/ldap
# Functions to control the installation and configuration of **ldap**
-# ``stack.sh`` calls the entry points in this order:
-#
+# ``lib/keystone`` calls the entry points in this order:
+# install_ldap()
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
+
+# Functions
+# ---------
+
# install_ldap
# install_ldap() - Collect source and prepare
function install_ldap() {
@@ -44,7 +48,7 @@
fi
# add our top level ldap nodes
- if ldapsearch -x -w $LDAP_PASSWORD -H ldap://localhost -D dc=Manager,dc=openstack,dc=org -x -b dc=openstack,dc=org | grep -q "Success" ; then
+ if ldapsearch -x -w $LDAP_PASSWORD -H ldap://localhost -D dc=Manager,dc=openstack,dc=org -x -b dc=openstack,dc=org | grep -q "Success"; then
printf "LDAP already configured for OpenStack\n"
if [[ "$KEYSTONE_CLEAR_LDAP" == "yes" ]]; then
# clear LDAP state
diff --git a/lib/nova b/lib/nova
index 8d045b5..ea73bad 100644
--- a/lib/nova
+++ b/lib/nova
@@ -122,8 +122,8 @@
TEST_FLOATING_RANGE=${TEST_FLOATING_RANGE:-192.168.253.0/29}
-# Entry Points
-# ------------
+# Functions
+# ---------
function add_nova_opt {
echo "$1" >>$NOVA_CONF
@@ -276,7 +276,7 @@
configure_baremetal_nova_dirs
fi
- if is_service_enabled quantum && is_quantum_ovs_base_plugin && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF ; then
+ if is_service_enabled quantum && is_quantum_ovs_base_plugin && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF; then
# Add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces
cat <<EOF | sudo tee -a $QEMU_CONF
cgroup_device_acl = [
@@ -509,7 +509,7 @@
VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=127.0.0.1}
fi
- if is_service_enabled n-novnc || is_service_enabled n-xvnc ; then
+ if is_service_enabled n-novnc || is_service_enabled n-xvnc; then
# Address on which instance vncservers will listen on compute hosts.
# For multi-host, this should be the management ip of the compute host.
VNCSERVER_LISTEN=${VNCSERVER_LISTEN=127.0.0.1}
@@ -673,6 +673,7 @@
done
}
+
# Restore xtrace
$XTRACE
diff --git a/lib/quantum b/lib/quantum
index b995a91..96ccf20 100644
--- a/lib/quantum
+++ b/lib/quantum
@@ -53,7 +53,6 @@
#
# With Quantum networking the NETWORK_MANAGER variable is ignored.
-
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
@@ -172,6 +171,7 @@
OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS}
fi
+
# Quantum plugin specific functions
# ---------------------------------
# Please refer to lib/quantum_plugins/README.md for details.
@@ -189,8 +189,9 @@
Q_USE_SECGROUP=False
fi
-# Entry Points
-# ------------
+
+# Functions
+# ---------
# configure_quantum()
# Set common config for all quantum server and agents.
@@ -732,7 +733,7 @@
local timeout_sec=$5
local probe_cmd = ""
probe_cmd=`_get_probe_cmd_prefix $from_net`
- if ! timeout $timeout_sec sh -c "while ! $probe_cmd ssh -o StrictHostKeyChecking=no -i $key_file ${user}@$ip echo success ; do sleep 1; done"; then
+ if ! timeout $timeout_sec sh -c "while ! $probe_cmd ssh -o StrictHostKeyChecking=no -i $key_file ${user}@$ip echo success; do sleep 1; done"; then
die $LINENO "server didn't become ssh-able!"
fi
}
diff --git a/lib/rpc_backend b/lib/rpc_backend
index d08cb01..7d165a4 100644
--- a/lib/rpc_backend
+++ b/lib/rpc_backend
@@ -17,8 +17,9 @@
XTRACE=$(set +o | grep xtrace)
set +o xtrace
-# Entry Points
-# ------------
+
+# Functions
+# ---------
# Make sure we only have one rpc backend enabled.
# Also check the specified rpc backend is available on your platform.
@@ -157,6 +158,7 @@
( ! ([[ "$DISTRO" = "oneiric" ]] || is_suse) )
}
+
# Restore xtrace
$XTRACE
diff --git a/lib/swift b/lib/swift
index eb57477..36bca4c 100644
--- a/lib/swift
+++ b/lib/swift
@@ -84,8 +84,8 @@
ACCOUNT_PORT_BASE=${ACCOUNT_PORT_BASE:-6012}
-# Entry Points
-# ------------
+# Functions
+# ---------
# cleanup_swift() - Remove residual data files
function cleanup_swift() {
@@ -169,7 +169,7 @@
# configured keystone it will configure swift with it.
if is_service_enabled key;then
if is_service_enabled swift3;then
- swift_pipeline=" s3token swift3 "
+ swift_pipeline=" swift3 s3token "
fi
swift_pipeline+=" authtoken keystoneauth "
else
diff --git a/lib/tempest b/lib/tempest
index c1dc3a3..e59737b 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -50,8 +50,9 @@
BOTO_MATERIALS_PATH="$FILES/images/s3-materials/cirros-0.3.1"
-# Entry Points
-# ------------
+
+# Functions
+# ---------
# configure_tempest() - Set config files, create data dirs, etc
function configure_tempest() {
diff --git a/lib/tls b/lib/tls
index fb8f4b9..f7dcffa 100644
--- a/lib/tls
+++ b/lib/tls
@@ -21,6 +21,9 @@
# start_tls_proxy HOST_IP 5000 localhost 5000
+# Defaults
+# --------
+
if is_service_enabled tls-proxy; then
# TODO(dtroyer): revisit this below after the search for HOST_IP has been done
TLS_IP=${TLS_IP:-$SERVICE_IP}
@@ -317,6 +320,7 @@
stud $STUD_PROTO -f $f_host,$f_port -b $b_host,$b_port $DEVSTACK_CERT 2>/dev/null
}
+
# Local variables:
# mode: shell-script
# End:
diff --git a/stack.sh b/stack.sh
index 62309dc..497e8a1 100755
--- a/stack.sh
+++ b/stack.sh
@@ -12,12 +12,15 @@
# developer install.
# To keep this script simple we assume you are running on a recent **Ubuntu**
-# (11.10 Oneiric or newer) or **Fedora** (F16 or newer) machine. It
+# (12.04 Precise or newer) or **Fedora** (F16 or newer) machine. It
# should work in a VM or physical server. Additionally we put the list of
# ``apt`` and ``rpm`` dependencies and other configuration files in this repo.
# Learn more and get the most recent version at http://devstack.org
+# Make sure custom grep options don't get in the way
+unset GREP_OPTIONS
+
# Keep track of the devstack directory
TOP_DIR=$(cd $(dirname "$0") && pwd)
@@ -51,8 +54,8 @@
# be overwritten by a DevStack update.
#
# DevStack distributes ``stackrc`` which contains locations for the OpenStack
-# repositories and branches to configure. ``stackrc`` sources ``localrc`` to
-# allow you to safely override those settings.
+# repositories, branches to configure, and other configuration defaults.
+# ``stackrc`` sources ``localrc`` to allow you to safely override those settings.
if [[ ! -r $TOP_DIR/stackrc ]]; then
log_error $LINENO "missing $TOP_DIR/stackrc - did you grab more than just stack.sh?"
@@ -78,6 +81,19 @@
rm $TOP_DIR/.stackenv
fi
+# ``stack.sh`` keeps the list of ``apt`` and ``rpm`` dependencies and config
+# templates and other useful files in the ``files`` subdirectory
+FILES=$TOP_DIR/files
+if [ ! -d $FILES ]; then
+ log_error $LINENO "missing devstack/files"
+fi
+
+# ``stack.sh`` keeps function libraries here
+# Make sure ``$TOP_DIR/lib`` directory is present
+if [ ! -d $TOP_DIR/lib ]; then
+ log_error $LINENO "missing devstack/lib"
+fi
+
# Import common services (database, message queue) configuration
source $TOP_DIR/lib/database
source $TOP_DIR/lib/rpc_backend
@@ -100,21 +116,9 @@
# and the specified rpc backend is available on your platform.
check_rpc_backend
-# ``stack.sh`` keeps function libraries here
-# Make sure ``$TOP_DIR/lib`` directory is present
-if [ ! -d $TOP_DIR/lib ]; then
- log_error $LINENO "missing devstack/lib"
-fi
-
-# ``stack.sh`` keeps the list of ``apt`` and ``rpm`` dependencies and config
-# templates and other useful files in the ``files`` subdirectory
-FILES=$TOP_DIR/files
-if [ ! -d $FILES ]; then
- log_error $LINENO "missing devstack/files"
-fi
-
SCREEN_NAME=${SCREEN_NAME:-stack}
# Check to see if we are already running DevStack
+# Note that this may fail if USE_SCREEN=False
if type -p screen >/dev/null && screen -ls | egrep -q "[0-9].$SCREEN_NAME"; then
echo "You are already running a stack.sh session."
echo "To rejoin this session type 'screen -x stack'."
@@ -230,6 +234,8 @@
# Allow the use of an alternate hostname (such as localhost/127.0.0.1) for service endpoints.
SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
+
+# Allow the use of an alternate protocol (such as https) for service endpoints
SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http}
# Configure services to use syslog instead of writing to individual log files
@@ -241,7 +247,6 @@
SYSSTAT_FILE=${SYSSTAT_FILE:-"sysstat.dat"}
SYSSTAT_INTERVAL=${SYSSTAT_INTERVAL:-"1"}
-
# Use color for logging output (only available if syslog is not used)
LOG_COLOR=`trueorfalse True $LOG_COLOR`
@@ -267,7 +272,6 @@
source $TOP_DIR/lib/ldap
# Set the destination directories for OpenStack projects
-HORIZON_DIR=$DEST/horizon
OPENSTACKCLIENT_DIR=$DEST/python-openstackclient
@@ -545,7 +549,7 @@
TRACK_DEPENDS=${TRACK_DEPENDS:-False}
# Install python packages into a virtualenv so that we can track them
-if [[ $TRACK_DEPENDS = True ]] ; then
+if [[ $TRACK_DEPENDS = True ]]; then
echo_summary "Installing Python packages into a virtualenv $DEST/.venv"
install_package python-virtualenv
@@ -651,9 +655,9 @@
# don't be naive and add to existing line!
fi
-if [[ $TRACK_DEPENDS = True ]] ; then
+if [[ $TRACK_DEPENDS = True ]]; then
$DEST/.venv/bin/pip freeze > $DEST/requires-post-pip
- if ! diff -Nru $DEST/requires-pre-pip $DEST/requires-post-pip > $DEST/requires.diff ; then
+ if ! diff -Nru $DEST/requires-pre-pip $DEST/requires-post-pip > $DEST/requires.diff; then
cat $DEST/requires.diff
fi
echo "Ran stack.sh in depend tracking mode, bailing out now"
@@ -719,10 +723,10 @@
echo -n > $SCREENRC
fi
-
# Initialize the directory for service status check
init_service_check
+
# Kick off Sysstat
# ------------------------
# run sysstat if it is enabled, this has to be early as daemon
@@ -735,6 +739,7 @@
fi
fi
+
# Keystone
# --------
diff --git a/stackrc b/stackrc
index 7c4fa68..c55e8dc 100644
--- a/stackrc
+++ b/stackrc
@@ -44,113 +44,118 @@
# be disabled for automated testing by setting this value to False.
USE_SCREEN=True
+# allow local overrides of env variables, including repo config
+if [ -f $RC_DIR/localrc ]; then
+ source $RC_DIR/localrc
+fi
+
+
# Repositories
# ------------
# Base GIT Repo URL
# Another option is http://review.openstack.org/p
-GIT_BASE=https://github.com
+GIT_BASE=${GIT_BASE:-https://github.com}
# metering service
-CEILOMETER_REPO=${GIT_BASE}/openstack/ceilometer.git
-CEILOMETER_BRANCH=master
+CEILOMETER_REPO=${CEILOMETER_REPO:-${GIT_BASE}/openstack/ceilometer.git}
+CEILOMETER_BRANCH=${CEILOMETER_BRANCH:-master}
# ceilometer client library
-CEILOMETERCLIENT_REPO=${GIT_BASE}/openstack/python-ceilometerclient.git
-CEILOMETERCLIENT_BRANCH=master
+CEILOMETERCLIENT_REPO=${CEILOMETERCLIENT_REPO:-${GIT_BASE}/openstack/python-ceilometerclient.git}
+CEILOMETERCLIENT_BRANCH=${CEILOMETERCLIENT_BRANCH:-master}
# volume service
-CINDER_REPO=${GIT_BASE}/openstack/cinder.git
-CINDER_BRANCH=master
+CINDER_REPO=${CINDER_REPO:-${GIT_BASE}/openstack/cinder.git}
+CINDER_BRANCH=${CINDER_BRANCH:-master}
# volume client
-CINDERCLIENT_REPO=${GIT_BASE}/openstack/python-cinderclient.git
-CINDERCLIENT_BRANCH=master
+CINDERCLIENT_REPO=${CINDERCLIENT_REPO:-${GIT_BASE}/openstack/python-cinderclient.git}
+CINDERCLIENT_BRANCH=${CINDERCLIENT_BRANCH:-master}
# compute service
-NOVA_REPO=${GIT_BASE}/openstack/nova.git
-NOVA_BRANCH=master
+NOVA_REPO=${NOVA_REPO:-${GIT_BASE}/openstack/nova.git}
+NOVA_BRANCH=${NOVA_BRANCH:-master}
# storage service
-SWIFT_REPO=${GIT_BASE}/openstack/swift.git
-SWIFT_BRANCH=master
-SWIFT3_REPO=${GIT_BASE}/fujita/swift3.git
-SWIFT3_BRANCH=master
+SWIFT_REPO=${SWIFT_REPO:-${GIT_BASE}/openstack/swift.git}
+SWIFT_BRANCH=${SWIFT_BRANCH:-master}
+SWIFT3_REPO=${SWIFT3_REPO:-${GIT_BASE}/fujita/swift3.git}
+SWIFT3_BRANCH=${SWIFT3_BRANCH:-master}
# python swift client library
-SWIFTCLIENT_REPO=${GIT_BASE}/openstack/python-swiftclient.git
-SWIFTCLIENT_BRANCH=master
+SWIFTCLIENT_REPO=${SWIFTCLIENT_REPO:-${GIT_BASE}/openstack/python-swiftclient.git}
+SWIFTCLIENT_BRANCH=${SWIFTCLIENT_BRANCH:-master}
# image catalog service
-GLANCE_REPO=${GIT_BASE}/openstack/glance.git
-GLANCE_BRANCH=master
+GLANCE_REPO=${GLANCE_REPO:-${GIT_BASE}/openstack/glance.git}
+GLANCE_BRANCH=${GLANCE_BRANCH:-master}
# python glance client library
-GLANCECLIENT_REPO=${GIT_BASE}/openstack/python-glanceclient.git
-GLANCECLIENT_BRANCH=master
+GLANCECLIENT_REPO=${GLANCECLIENT_REPO:-${GIT_BASE}/openstack/python-glanceclient.git}
+GLANCECLIENT_BRANCH=${GLANCECLIENT_BRANCH:-master}
# unified auth system (manages accounts/tokens)
-KEYSTONE_REPO=${GIT_BASE}/openstack/keystone.git
-KEYSTONE_BRANCH=master
+KEYSTONE_REPO=${KEYSTONE_REPO:-${GIT_BASE}/openstack/keystone.git}
+KEYSTONE_BRANCH=${KEYSTONE_BRANCH:-master}
# a websockets/html5 or flash powered VNC console for vm instances
-NOVNC_REPO=${GIT_BASE}/kanaka/noVNC.git
-NOVNC_BRANCH=master
+NOVNC_REPO=${NOVNC_REPO:-${GIT_BASE}/kanaka/noVNC.git}
+NOVNC_BRANCH=${NOVNC_BRANCH:-master}
# a websockets/html5 or flash powered SPICE console for vm instances
-SPICE_REPO=http://anongit.freedesktop.org/git/spice/spice-html5.git
-SPICE_BRANCH=master
+SPICE_REPO=${SPICE_REPO:-http://anongit.freedesktop.org/git/spice/spice-html5.git}
+SPICE_BRANCH=${SPICE_BRANCH:-master}
# django powered web control panel for openstack
-HORIZON_REPO=${GIT_BASE}/openstack/horizon.git
-HORIZON_BRANCH=master
+HORIZON_REPO=${HORIZON_REPO:-${GIT_BASE}/openstack/horizon.git}
+HORIZON_BRANCH=${HORIZON_BRANCH:-master}
# python client library to nova that horizon (and others) use
-NOVACLIENT_REPO=${GIT_BASE}/openstack/python-novaclient.git
-NOVACLIENT_BRANCH=master
+NOVACLIENT_REPO=${NOVACLIENT_REPO:-${GIT_BASE}/openstack/python-novaclient.git}
+NOVACLIENT_BRANCH=${NOVACLIENT_BRANCH:-master}
# consolidated openstack python client
-OPENSTACKCLIENT_REPO=${GIT_BASE}/openstack/python-openstackclient.git
-OPENSTACKCLIENT_BRANCH=master
+OPENSTACKCLIENT_REPO=${OPENSTACKCLIENT_REPO:-${GIT_BASE}/openstack/python-openstackclient.git}
+OPENSTACKCLIENT_BRANCH=${OPENSTACKCLIENT_BRANCH:-master}
# python keystone client library to nova that horizon uses
-KEYSTONECLIENT_REPO=${GIT_BASE}/openstack/python-keystoneclient.git
-KEYSTONECLIENT_BRANCH=master
+KEYSTONECLIENT_REPO=${KEYSTONECLIENT_REPO:-${GIT_BASE}/openstack/python-keystoneclient.git}
+KEYSTONECLIENT_BRANCH=${KEYSTONECLIENT_BRANCH:-master}
# quantum service
-QUANTUM_REPO=${GIT_BASE}/openstack/quantum.git
-QUANTUM_BRANCH=master
+QUANTUM_REPO=${QUANTUM_REPO:-${GIT_BASE}/openstack/quantum.git}
+QUANTUM_BRANCH=${QUANTUM_BRANCH:-master}
# quantum client
-QUANTUMCLIENT_REPO=${GIT_BASE}/openstack/python-quantumclient.git
-QUANTUMCLIENT_BRANCH=master
+QUANTUMCLIENT_REPO=${QUANTUMCLIENT_REPO:-${GIT_BASE}/openstack/python-quantumclient.git}
+QUANTUMCLIENT_BRANCH=${QUANTUMCLIENT_BRANCH:-master}
# Tempest test suite
-TEMPEST_REPO=${GIT_BASE}/openstack/tempest.git
-TEMPEST_BRANCH=master
+TEMPEST_REPO=${TEMPEST_REPO:-${GIT_BASE}/openstack/tempest.git}
+TEMPEST_BRANCH=${TEMPEST_BRANCH:-master}
# heat service
-HEAT_REPO=${GIT_BASE}/openstack/heat.git
-HEAT_BRANCH=master
+HEAT_REPO=${HEAT_REPO:-${GIT_BASE}/openstack/heat.git}
+HEAT_BRANCH=${HEAT_BRANCH:-master}
# python heat client library
-HEATCLIENT_REPO=${GIT_BASE}/openstack/python-heatclient.git
-HEATCLIENT_BRANCH=master
+HEATCLIENT_REPO=${HEATCLIENT_REPO:-${GIT_BASE}/openstack/python-heatclient.git}
+HEATCLIENT_BRANCH=${HEATCLIENT_BRANCH:-master}
# ryu service
-RYU_REPO=${GIT_BASE}/osrg/ryu.git
-RYU_BRANCH=master
+RYU_REPO=${RYU_REPO:-${GIT_BASE}/osrg/ryu.git}
+RYU_BRANCH=${RYU_BRANCH:-master}
# diskimage-builder
-BM_IMAGE_BUILD_REPO=${GIT_BASE}/stackforge/diskimage-builder.git
-BM_IMAGE_BUILD_BRANCH=master
+BM_IMAGE_BUILD_REPO=${BM_IMAGE_BUILD_REPO:-${GIT_BASE}/stackforge/diskimage-builder.git}
+BM_IMAGE_BUILD_BRANCH=${BM_IMAGE_BUILD_BRANCH:-master}
# bm_poseur
# Used to simulate a hardware environment for baremetal
# Only used if BM_USE_FAKE_ENV is set
-BM_POSEUR_REPO=${GIT_BASE}/tripleo/bm_poseur.git
-BM_POSEUR_BRANCH=master
-
+BM_POSEUR_REPO=${BM_POSEUR_REPO:-${GIT_BASE}/tripleo/bm_poseur.git}
+BM_POSEUR_BRANCH=${BM_POSEUR_BRANCH:-master}
# Nova hypervisor configuration. We default to libvirt with **kvm** but will
# drop back to **qemu** if we are unable to load the kvm module. ``stack.sh`` can
@@ -158,11 +163,6 @@
VIRT_DRIVER=${VIRT_DRIVER:-libvirt}
LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
-# allow local overrides of env variables
-if [ -f $RC_DIR/localrc ]; then
- source $RC_DIR/localrc
-fi
-
# Specify a comma-separated list of UEC images to download and install into glance.
# supported urls here are:
# * "uec-style" images: