Merge "Create initial network when using Cisco N1k plugin"
diff --git a/HACKING.rst b/HACKING.rst
index 3ffe1e2..b7d9a49 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -110,8 +110,8 @@
* Global configuration that may be referenced in ``local.conf``, i.e. ``DEST``, ``DATA_DIR``
* Global service configuration like ``ENABLED_SERVICES``
* Variables used by multiple services that do not have a clear owner, i.e.
- ``VOLUME_BACKING_FILE_SIZE`` (nova-volumes and cinder) or ``PUBLIC_NETWORK_NAME``
- (nova-network and neutron)
+ ``VOLUME_BACKING_FILE_SIZE`` (nova-compute, nova-volumes and cinder) or
+ ``PUBLIC_NETWORK_NAME`` (nova-network and neutron)
* Variables that can not be cleanly declared in a project file due to
dependency ordering, i.e. the order of sourcing the project files can
not be changed for other reasons but the earlier file needs to dereference a
diff --git a/clean.sh b/clean.sh
index f2f1338..edbd04a 100755
--- a/clean.sh
+++ b/clean.sh
@@ -18,7 +18,7 @@
FILES=$TOP_DIR/files
# Load local configuration
-source $TOP_DIR/stackrc
+source $TOP_DIR/openrc
# Get the variables that are set in stack.sh
if [[ -r $TOP_DIR/.stackenv ]]; then
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index baebe97..b9a4802 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -352,19 +352,6 @@
GLANCE_HOSTPORT=w.x.y.z:9292
ENABLED_SERVICES=n-vol,n-cpu,n-net,n-api
-API rate limits
----------------
-
- | Default: ``API_RATE_LIMIT=True``
- | Integration tests such as Tempest will likely run afoul of the
- default rate limits configured for Nova. Turn off rate limiting
- during testing by setting ``API_RATE_LIMIT=False``.*
- |
-
- ::
-
- API_RATE_LIMIT=False
-
IP Version
| Default: ``IP_VERSION=4``
| This setting can be used to configure DevStack to create either an IPv4,
diff --git a/doc/source/guides/neutron.rst b/doc/source/guides/neutron.rst
index 90d4ca3..95cde96 100644
--- a/doc/source/guides/neutron.rst
+++ b/doc/source/guides/neutron.rst
@@ -196,7 +196,7 @@
SEGMENTATION_ID=2010
In this configuration we are defining FIXED_RANGE to be a
-subnet that exists in the private RFC1918 address space - however in
+subnet that exists in the private RFC1918 address space - however
in a real setup FIXED_RANGE would be a public IP address range, so
that you could access your instances from the public internet.
diff --git a/extras.d/70-sahara.sh b/extras.d/70-sahara.sh
index 2a34999..f177766 100644
--- a/extras.d/70-sahara.sh
+++ b/extras.d/70-sahara.sh
@@ -15,6 +15,7 @@
create_sahara_accounts
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
echo_summary "Initializing sahara"
+ sahara_register_images
start_sahara
fi
diff --git a/extras.d/70-tuskar.sh b/extras.d/70-tuskar.sh
index e77c504..6e26db2 100644
--- a/extras.d/70-tuskar.sh
+++ b/extras.d/70-tuskar.sh
@@ -65,7 +65,7 @@
TUSKAR_DIR=$DEST/tuskar
TUSKARCLIENT_DIR=$DEST/python-tuskarclient
TUSKAR_AUTH_CACHE_DIR=${TUSKAR_AUTH_CACHE_DIR:-/var/cache/tuskar}
-TUSKAR_STANDALONE=`trueorfalse False $TUSKAR_STANDALONE`
+TUSKAR_STANDALONE=$(trueorfalse False TUSKAR_STANDALONE)
TUSKAR_CONF_DIR=/etc/tuskar
TUSKAR_CONF=$TUSKAR_CONF_DIR/tuskar.conf
TUSKAR_API_HOST=${TUSKAR_API_HOST:-$HOST_IP}
@@ -131,7 +131,7 @@
function init_tuskar {
# (re)create tuskar database
- recreate_database tuskar utf8
+ recreate_database tuskar
tuskar-dbsync --config-file $TUSKAR_CONF
create_tuskar_cache_dir
diff --git a/functions b/functions
index 12be160..5b3a8ea 100644
--- a/functions
+++ b/functions
@@ -353,7 +353,7 @@
local boot_timeout=$3
local expected=${4:-"True"}
local check_command=""
- MULTI_HOST=`trueorfalse False $MULTI_HOST`
+ MULTI_HOST=$(trueorfalse False MULTI_HOST)
if [[ "$MULTI_HOST" = "True" && "$from_net" = "$PRIVATE_NETWORK_NAME" ]]; then
return
fi
diff --git a/functions-common b/functions-common
index b0b2622..f8b8eaf 100644
--- a/functions-common
+++ b/functions-common
@@ -21,7 +21,6 @@
#
# The following variables are assumed to be defined by certain functions:
#
-# - ``GIT_DEPTH``
# - ``ENABLED_SERVICES``
# - ``ERROR_ON_CLONE``
# - ``FILES``
@@ -43,6 +42,8 @@
declare -A GITBRANCH
declare -A GITDIR
+TRACK_DEPENDS=${TRACK_DEPENDS:-False}
+
# Config Functions
# ================
@@ -243,7 +244,8 @@
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local default=$1
- local testval=$2
+ local literal=$2
+ local testval=${!literal}
[[ -z "$testval" ]] && { echo "$default"; return; }
[[ "0 no No NO false False FALSE" =~ "$testval" ]] && { echo "False"; return; }
@@ -252,6 +254,14 @@
$xtrace
}
+function isset {
+ nounset=$(set +o | grep nounset)
+ set +o nounset
+ [[ -n "${!1+x}" ]]
+ result=$?
+ $nounset
+ return $result
+}
# Control Functions
# =================
@@ -381,7 +391,11 @@
# ``os_UPDATE`` - update: ex. the ``5`` in ``RHEL6.5``
# ``os_PACKAGE`` - package type: ``deb`` or ``rpm``
# ``os_CODENAME`` - vendor's codename for release: ``snow leopard``, ``trusty``
-declare os_VENDOR os_RELEASE os_UPDATE os_PACKAGE os_CODENAME
+os_VENDOR=""
+os_RELEASE=""
+os_UPDATE=""
+os_PACKAGE=""
+os_CODENAME=""
# GetOSVersion
function GetOSVersion {
@@ -577,8 +591,7 @@
# 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).
-# Set global ``GIT_DEPTH=<number>`` to limit the history depth of the git clone
-# Uses globals ``ERROR_ON_CLONE``, ``OFFLINE``, ``RECLONE``, ``GIT_DEPTH``
+# Uses globals ``ERROR_ON_CLONE``, ``OFFLINE``, ``RECLONE``
# git_clone remote dest-dir branch
function git_clone {
local git_remote=$1
@@ -587,9 +600,8 @@
local orig_dir=$(pwd)
local git_clone_flags=""
- RECLONE=$(trueorfalse False $RECLONE)
-
- if [[ -n "${GIT_DEPTH}" ]]; then
+ RECLONE=$(trueorfalse False RECLONE)
+ if [[ "${GIT_DEPTH}" -gt 0 ]]; then
git_clone_flags="$git_clone_flags --depth $GIT_DEPTH"
fi
@@ -814,7 +826,7 @@
# Gets or creates a domain
# Usage: get_or_create_domain <name> <description>
function get_or_create_domain {
- local os_url="$KEYSTONE_SERVICE_URI/v3"
+ local os_url="$KEYSTONE_SERVICE_URI_V3"
# Gets domain id
local domain_id=$(
# Gets domain id
@@ -830,6 +842,23 @@
echo $domain_id
}
+# Gets or creates group
+# Usage: get_or_create_group <groupname> [<domain> <description>]
+function get_or_create_group {
+ local domain=${2:+--domain ${2}}
+ local desc="${3:-}"
+ local os_url="$KEYSTONE_SERVICE_URI_V3"
+ # Gets group id
+ local group_id=$(
+ # Creates new group with --or-show
+ openstack --os-token=$OS_TOKEN --os-url=$os_url \
+ --os-identity-api-version=3 group create $1 \
+ $domain --description "$desc" --or-show \
+ -f value -c id
+ )
+ echo $group_id
+}
+
# Gets or creates user
# Usage: get_or_create_user <username> <password> <project> [<email> [<domain>]]
function get_or_create_user {
@@ -842,7 +871,7 @@
local domain=""
if [[ ! -z "$5" ]]; then
domain="--domain=$5"
- os_cmd="$os_cmd --os-url=$KEYSTONE_SERVICE_URI/v3 --os-identity-api-version=3"
+ os_cmd="$os_cmd --os-url=$KEYSTONE_SERVICE_URI_V3 --os-identity-api-version=3"
fi
# Gets user id
local user_id=$(
@@ -867,7 +896,7 @@
local domain=""
if [[ ! -z "$2" ]]; then
domain="--domain=$2"
- os_cmd="$os_cmd --os-url=$KEYSTONE_SERVICE_URI/v3 --os-identity-api-version=3"
+ os_cmd="$os_cmd --os-url=$KEYSTONE_SERVICE_URI_V3 --os-identity-api-version=3"
fi
local project_id=$(
# Creates new project with --or-show
@@ -890,8 +919,8 @@
# Usage: get_or_add_user_role <role> <user> <project>
function get_or_add_user_role {
# Gets user role id
- local user_role_id=$(openstack user role list \
- $2 \
+ local user_role_id=$(openstack role list \
+ --user $2 \
--project $3 \
--column "ID" \
--column "Name" \
@@ -916,8 +945,8 @@
openstack service show $1 -f value -c id 2>/dev/null ||
# Creates new service if not exists
openstack service create \
- $1 \
- --type=$2 \
+ $2 \
+ --name $1 \
--description="$3" \
-f value -c id
)
@@ -978,9 +1007,10 @@
[[ "$(id -u)" = "0" ]] && sudo="env"
$xtrace
+
$sudo DEBIAN_FRONTEND=noninteractive \
- http_proxy=$http_proxy https_proxy=$https_proxy \
- no_proxy=$no_proxy \
+ http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \
+ no_proxy=${no_proxy:-} \
apt-get --option "Dpkg::Options::=--force-confold" --assume-yes "$@"
}
@@ -999,10 +1029,10 @@
set +o xtrace
local services=$@
local package_dir=$(_get_package_dir)
- local file_to_parse
- local service
+ local file_to_parse=""
+ local service=""
- INSTALL_TESTONLY_PACKAGES=$(trueorfalse False $INSTALL_TESTONLY_PACKAGES)
+ INSTALL_TESTONLY_PACKAGES=$(trueorfalse False INSTALL_TESTONLY_PACKAGES)
if [[ -z "$package_dir" ]]; then
echo "No package directory supplied"
@@ -1112,6 +1142,10 @@
# Uses globals ``NO_UPDATE_REPOS``, ``REPOS_UPDATED``, ``RETRY_UPDATE``
# install_package package [package ...]
function update_package_repo {
+ NO_UPDATE_REPOS=${NO_UPDATE_REPOS:-False}
+ REPOS_UPDATED=${REPOS_UPDATED:-False}
+ RETRY_UPDATE=${RETRY_UPDATE:-False}
+
if [[ "$NO_UPDATE_REPOS" = "True" ]]; then
return 0
fi
@@ -1244,8 +1278,8 @@
exec 6>&-
if [[ -n ${SCREEN_LOGDIR} ]]; then
- exec 1>&${SCREEN_LOGDIR}/screen-${service}.${CURRENT_LOG_TIME}.log 2>&1
- ln -sf ${SCREEN_LOGDIR}/screen-${service}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${service}.log
+ exec 1>&${SCREEN_LOGDIR}/screen-${service}.log.${CURRENT_LOG_TIME} 2>&1
+ ln -sf ${SCREEN_LOGDIR}/screen-${service}.log.${CURRENT_LOG_TIME} ${SCREEN_LOGDIR}/screen-${service}.log
# TODO(dtroyer): Hack to get stdout from the Python interpreter for the logs.
export PYTHONUNBUFFERED=1
@@ -1321,7 +1355,7 @@
SCREEN_NAME=${SCREEN_NAME:-stack}
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
- USE_SCREEN=$(trueorfalse True $USE_SCREEN)
+ USE_SCREEN=$(trueorfalse True USE_SCREEN)
# Append the process to the screen rc file
screen_rc "$name" "$command"
@@ -1329,9 +1363,9 @@
screen -S $SCREEN_NAME -X screen -t $name
if [[ -n ${SCREEN_LOGDIR} ]]; then
- screen -S $SCREEN_NAME -p $name -X logfile ${SCREEN_LOGDIR}/screen-${name}.${CURRENT_LOG_TIME}.log
+ screen -S $SCREEN_NAME -p $name -X logfile ${SCREEN_LOGDIR}/screen-${name}.log.${CURRENT_LOG_TIME}
screen -S $SCREEN_NAME -p $name -X log on
- ln -sf ${SCREEN_LOGDIR}/screen-${name}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${name}.log
+ ln -sf ${SCREEN_LOGDIR}/screen-${name}.log.${CURRENT_LOG_TIME} ${SCREEN_LOGDIR}/screen-${name}.log
fi
# sleep to allow bash to be ready to be send the command - we are
@@ -1377,7 +1411,7 @@
echo "stuff \"$2$NL\"" >> $SCREENRC
if [[ -n ${SCREEN_LOGDIR} ]]; then
- echo "logfile ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log" >>$SCREENRC
+ echo "logfile ${SCREEN_LOGDIR}/screen-${1}.log.${CURRENT_LOG_TIME}" >>$SCREENRC
echo "log on" >>$SCREENRC
fi
fi
@@ -1394,7 +1428,7 @@
SCREEN_NAME=${SCREEN_NAME:-stack}
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
- USE_SCREEN=$(trueorfalse True $USE_SCREEN)
+ USE_SCREEN=$(trueorfalse True USE_SCREEN)
if is_service_enabled $service; then
# Clean up the screen window
@@ -1412,7 +1446,7 @@
local service=$1
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
- USE_SCREEN=$(trueorfalse True $USE_SCREEN)
+ USE_SCREEN=$(trueorfalse True USE_SCREEN)
if is_service_enabled $service; then
# Kill via pid if we have one available
@@ -1462,7 +1496,7 @@
local name=$1
local logfile=$2
- USE_SCREEN=$(trueorfalse True $USE_SCREEN)
+ USE_SCREEN=$(trueorfalse True USE_SCREEN)
if [[ "$USE_SCREEN" = "True" ]]; then
screen_process "$name" "sudo tail -f $logfile"
fi
@@ -1489,8 +1523,8 @@
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
+ exec 1>&${SCREEN_LOGDIR}/screen-${1}.log.${CURRENT_LOG_TIME} 2>&1
+ ln -sf ${SCREEN_LOGDIR}/screen-${1}.log.${CURRENT_LOG_TIME} ${SCREEN_LOGDIR}/screen-${1}.log
# TODO(dtroyer): Hack to get stdout from the Python interpreter for the logs.
export PYTHONUNBUFFERED=1
@@ -1572,7 +1606,8 @@
function pip_install {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
- if [[ "$OFFLINE" = "True" || -z "$@" ]]; then
+ local offline=${OFFLINE:-False}
+ if [[ "$offline" == "True" || -z "$@" ]]; then
$xtrace
return
fi
@@ -1601,20 +1636,20 @@
$xtrace
$sudo_pip \
- http_proxy=$http_proxy \
- https_proxy=$https_proxy \
- no_proxy=$no_proxy \
+ http_proxy=${http_proxy:-} \
+ https_proxy=${https_proxy:-} \
+ no_proxy=${no_proxy:-} \
$cmd_pip install \
$@
- INSTALL_TESTONLY_PACKAGES=$(trueorfalse False $INSTALL_TESTONLY_PACKAGES)
+ INSTALL_TESTONLY_PACKAGES=$(trueorfalse False INSTALL_TESTONLY_PACKAGES)
if [[ "$INSTALL_TESTONLY_PACKAGES" == "True" ]]; then
local test_req="$@/test-requirements.txt"
if [[ -e "$test_req" ]]; then
$sudo_pip \
- http_proxy=$http_proxy \
- https_proxy=$https_proxy \
- no_proxy=$no_proxy \
+ http_proxy=${http_proxy:-} \
+ https_proxy=${https_proxy:-} \
+ no_proxy=${no_proxy:-} \
$cmd_pip install \
-r $test_req
fi
@@ -2084,13 +2119,13 @@
# http_proxy=http://proxy.example.com:3128/ no_proxy=repo.example.net ./stack.sh
function export_proxy_variables {
- if [[ -n "$http_proxy" ]]; then
+ if isset http_proxy ; then
export http_proxy=$http_proxy
fi
- if [[ -n "$https_proxy" ]]; then
+ if isset https_proxy ; then
export https_proxy=$https_proxy
fi
- if [[ -n "$no_proxy" ]]; then
+ if isset no_proxy ; then
export no_proxy=$no_proxy
fi
}
diff --git a/lib/ceilometer b/lib/ceilometer
index f6280d9..d48751e 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -75,11 +75,14 @@
CEILOMETER_SERVICE_PROTOCOL=http
CEILOMETER_SERVICE_HOST=$SERVICE_HOST
CEILOMETER_SERVICE_PORT=${CEILOMETER_SERVICE_PORT:-8777}
-CEILOMETER_USE_MOD_WSGI=$(trueorfalse False $CEILOMETER_USE_MOD_WSGI)
+CEILOMETER_USE_MOD_WSGI=$(trueorfalse False CEILOMETER_USE_MOD_WSGI)
# To enable OSprofiler change value of this variable to "notifications,profiler"
CEILOMETER_NOTIFICATION_TOPICS=${CEILOMETER_NOTIFICATION_TOPICS:-notifications}
+CEILOMETER_COORDINATION_URL=${CEILOMETER_COORDINATION_URL:-}
+CEILOMETER_PIPELINE_INTERVAL=${CEILOMETER_PIPELINE_INTERVAL:-}
+
# Tell Tempest this project is present
TEMPEST_SERVICES+=,ceilometer
@@ -262,7 +265,7 @@
if is_service_enabled mysql postgresql; then
if [ "$CEILOMETER_BACKEND" = 'mysql' ] || [ "$CEILOMETER_BACKEND" = 'postgresql' ] ; then
- recreate_database ceilometer utf8
+ recreate_database ceilometer
$CEILOMETER_BIN_DIR/ceilometer-dbsync
fi
fi
diff --git a/lib/cinder b/lib/cinder
index 177ddf0..6eee880 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -68,7 +68,7 @@
# Maintain this here for backward-compatibility with the old configuration
# DEPRECATED: Use CINDER_ENABLED_BACKENDS instead
# Support for multi lvm backend configuration (default is no support)
-CINDER_MULTI_LVM_BACKEND=$(trueorfalse False $CINDER_MULTI_LVM_BACKEND)
+CINDER_MULTI_LVM_BACKEND=$(trueorfalse False CINDER_MULTI_LVM_BACKEND)
# Default backends
# The backend format is type:name where type is one of the supported backend
@@ -76,16 +76,16 @@
# configuration and for the volume type name. Multiple backends are
# comma-separated.
if [[ $CINDER_MULTI_LVM_BACKEND == "False" ]]; then
- CINDER_ENABLED_BACKENDS=${CINDER_ENABLED_BACKENDS:-lvm:lvmdriver-1}
+ CINDER_ENABLED_BACKENDS=${CINDER_ENABLED_BACKENDS:-lvm:${DEFAULT_VOLUME_GROUP_NAME##*-}}
else
- CINDER_ENABLED_BACKENDS=${CINDER_ENABLED_BACKENDS:-lvm:lvmdriver-1,lvm:lvmdriver-2}
+ CINDER_ENABLED_BACKENDS=${CINDER_ENABLED_BACKENDS:-lvm:${DEFAULT_VOLUME_GROUP_NAME##*-},lvm:cinder}
fi
# Should cinder perform secure deletion of volumes?
# Defaults to true, can be set to False to avoid this bug when testing:
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1023755
-CINDER_SECURE_DELETE=`trueorfalse True $CINDER_SECURE_DELETE`
+CINDER_SECURE_DELETE=$(trueorfalse True CINDER_SECURE_DELETE)
# Cinder reports allocations back to the scheduler on periodic intervals
# it turns out we can get an "out of space" issue when we run tests too
@@ -387,7 +387,7 @@
if is_service_enabled $DATABASE_BACKENDS; then
# (Re)create cinder database
- recreate_database cinder utf8
+ recreate_database cinder
# Migrate cinder database
$CINDER_BIN_DIR/cinder-manage db sync
diff --git a/lib/cinder_backends/lvm b/lib/cinder_backends/lvm
index a3ab5bf..43e13e4 100644
--- a/lib/cinder_backends/lvm
+++ b/lib/cinder_backends/lvm
@@ -14,6 +14,7 @@
# CINDER_CONF
# DATA_DIR
+# VOLUME_GROUP_NAME
# clean_cinder_backend_lvm - called from clean_cinder()
# configure_cinder_backend_lvm - called from configure_cinder()
@@ -25,156 +26,44 @@
set +o xtrace
-# Defaults
-# --------
-
-# Name of the lvm volume groups to use/create for iscsi volumes
-# This monkey-motion is for compatibility with icehouse-generation Grenade
-# If ``VOLUME_GROUP`` is set, use it, otherwise we'll build a VG name based
-# on ``VOLUME_GROUP_NAME`` that includes the backend name
-# Grenade doesn't use ``VOLUME_GROUP2`` so it is left out
-VOLUME_GROUP_NAME=${VOLUME_GROUP:-${VOLUME_GROUP_NAME:-stack-volumes}}
-
# TODO: resurrect backing device...need to know how to set values
#VOLUME_BACKING_DEVICE=${VOLUME_BACKING_DEVICE:-}
-VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
-
-
# Entry Points
# ------------
-# Compatibility for getting a volume group name from either ``VOLUME_GROUP``
-# or from ``VOLUME_GROUP_NAME`` plus the backend name
-function get_volume_group_name {
- local be_name=$1
-
- # Again with the icehouse-generation compatibility
- local volume_group_name=$VOLUME_GROUP_NAME
- if [[ -z $VOLUME_GROUP ]]; then
- volume_group_name+="-$be_name"
- fi
- echo $volume_group_name
-}
-
+# cleanup_cinder_backend_lvm - Delete volume group and remove backing file
+# cleanup_cinder_backend_lvm $be_name
function cleanup_cinder_backend_lvm {
local be_name=$1
- # Again with the icehouse-generation compatibility
- local volume_group_name=$(get_volume_group_name $be_name)
-
# Campsite rule: leave behind a volume group at least as clean as we found it
- _clean_lvm_lv ${volume_group_name} $VOLUME_NAME_PREFIX
- _clean_lvm_backing_file ${volume_group_name} $DATA_DIR/${volume_group_name}-backing-file
+ clean_lvm_volume_group $VOLUME_GROUP_NAME-$be_name
}
# configure_cinder_backend_lvm - Set config files, create data dirs, etc
-# configure_cinder_backend_lvm $name
+# configure_cinder_backend_lvm $be_name
function configure_cinder_backend_lvm {
local be_name=$1
- # Again with the icehouse-generation compatibility
- local volume_group_name=$(get_volume_group_name $be_name)
-
iniset $CINDER_CONF $be_name volume_backend_name $be_name
iniset $CINDER_CONF $be_name volume_driver "cinder.volume.drivers.lvm.LVMISCSIDriver"
- iniset $CINDER_CONF $be_name volume_group $volume_group_name
+ iniset $CINDER_CONF $be_name volume_group $VOLUME_GROUP_NAME-$be_name
if [[ "$CINDER_SECURE_DELETE" == "False" ]]; then
iniset $CINDER_CONF $be_name volume_clear none
fi
}
-
+# init_cinder_backend_lvm - Initialize volume group
+# init_cinder_backend_lvm $be_name
function init_cinder_backend_lvm {
local be_name=$1
- # Again with the icehouse-generation compatibility
- local volume_group_name=$(get_volume_group_name $be_name)
-
# Start with a clean volume group
- _create_cinder_volume_group ${volume_group_name} $DATA_DIR/${volume_group_name}-backing-file
-
- if is_fedora || is_suse; then
- # service is not started by default
- start_service tgtd
- fi
-
- # Remove iscsi targets
- sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
- _clean_lvm_lv ${volume_group_name} $VOLUME_NAME_PREFIX
+ init_lvm_volume_group $VOLUME_GROUP_NAME-$be_name $VOLUME_BACKING_FILE_SIZE
}
-
-# _clean_lvm_lv removes all cinder LVM volumes
-#
-# Usage: _clean_lvm_lv volume-group-name $VOLUME_NAME_PREFIX
-function _clean_lvm_lv {
- local vg=$1
- local lv_prefix=$2
-
- # Clean out existing volumes
- local lv
- for lv in $(sudo lvs --noheadings -o lv_name $vg 2>/dev/null); do
- # lv_prefix prefixes the LVs we want
- if [[ "${lv#$lv_prefix}" != "$lv" ]]; then
- sudo lvremove -f $vg/$lv
- fi
- done
-}
-
-# _clean_lvm_backing_file() removes the backing file of the
-# volume group used by cinder
-#
-# Usage: _clean_lvm_backing_file() volume-group-name backing-file-name
-function _clean_lvm_backing_file {
- local vg=$1
- local backing_file=$2
-
- # if there is no logical volume left, it's safe to attempt a cleanup
- # of the backing file
- if [[ -z "$(sudo lvs --noheadings -o lv_name $vg 2>/dev/null)" ]]; then
- # if the backing physical device is a loop device, it was probably setup by devstack
- local vg_dev=$(sudo losetup -j $backing_file | awk -F':' '/backing-file/ { print $1}')
- if [[ -n "$vg_dev" ]] && [[ -e "$vg_dev" ]]; then
- sudo losetup -d $vg_dev
- rm -f $backing_file
- fi
- fi
-}
-
-# _create_cinder_volume_group volume-group-name backing-file-name
-function _create_cinder_volume_group {
- # According to the ``CINDER_MULTI_LVM_BACKEND`` value, configure one or two default volumes
- # group called ``stack-volumes`` (and ``stack-volumes2``) for the volume
- # service if it (they) does (do) not yet exist. If you don't wish to use a
- # file backed volume group, create your own volume group called ``stack-volumes``
- # and ``stack-volumes2`` before invoking ``stack.sh``.
- #
- # The two backing files are ``VOLUME_BACKING_FILE_SIZE`` in size, and they are stored in
- # the ``DATA_DIR``.
-
- local vg_name=$1
- local backing_file=$2
-
- if ! sudo vgs $vg_name; then
- # TODO: fix device handling
- if [ -z "$VOLUME_BACKING_DEVICE" ]; then
- # Only create if the file doesn't already exists
- [[ -f $backing_file ]] || truncate -s $VOLUME_BACKING_FILE_SIZE $backing_file
- local vg_dev=`sudo losetup -f --show $backing_file`
-
- # Only create if the loopback device doesn't contain $VOLUME_GROUP
- if ! sudo vgs $vg_name; then
- sudo vgcreate $vg_name $vg_dev
- fi
- else
- sudo vgcreate $vg_name $VOLUME_BACKING_DEVICE
- fi
- fi
-}
-
-
# Restore xtrace
$MY_XTRACE
diff --git a/lib/database b/lib/database
index 366d2b3..b114e9e 100644
--- a/lib/database
+++ b/lib/database
@@ -23,6 +23,7 @@
XTRACE=$(set +o | grep xtrace)
set +o xtrace
+DATABASE_BACKENDS=""
# Register a database backend
#
@@ -30,7 +31,7 @@
#
# 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"
+ DATABASE_BACKENDS+=" $1"
}
# Sourcing the database libs sets DATABASE_BACKENDS with the available list
@@ -98,11 +99,9 @@
# Recreate a given database
# $1 The name of the database
-# $2 The character set/encoding of the database
function recreate_database {
local db=$1
- local charset=$2
- recreate_database_$DATABASE_TYPE $db $charset
+ recreate_database_$DATABASE_TYPE $db
}
# Install the database
diff --git a/lib/databases/mysql b/lib/databases/mysql
index 62c3d4c..2f3b6d4 100644
--- a/lib/databases/mysql
+++ b/lib/databases/mysql
@@ -14,16 +14,26 @@
register_database mysql
+# Linux distros, thank you for being incredibly consistent
+MYSQL=mysql
+if is_fedora; then
+ if [[ $DISTRO =~ (rhel6) ]]; then
+ MYSQL=mysqld
+ else
+ MYSQL=mariadb
+ fi
+fi
# Functions
# ---------
# Get rid of everything enough to cleanly change database backends
function cleanup_database_mysql {
+ stop_service $MYSQL
if is_ubuntu; then
# Get ruthless with mysql
stop_service $MYSQL
- uninstall_package mysql-common mariadb-common
+ apt_get purge -y mysql* mariadb*
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
return
@@ -48,9 +58,8 @@
function recreate_database_mysql {
local db=$1
- local charset=$2
mysql -u$DATABASE_USER -p$DATABASE_PASSWORD -h$MYSQL_HOST -e "DROP DATABASE IF EXISTS $db;"
- mysql -u$DATABASE_USER -p$DATABASE_PASSWORD -h$MYSQL_HOST -e "CREATE DATABASE $db CHARACTER SET $charset;"
+ mysql -u$DATABASE_USER -p$DATABASE_PASSWORD -h$MYSQL_HOST -e "CREATE DATABASE $db CHARACTER SET utf8;"
}
function configure_database_mysql {
@@ -128,10 +137,10 @@
if is_ubuntu; then
# Seed configuration with mysql password so that apt-get install doesn't
# prompt us for a password upon install.
- cat <<MYSQL_PRESEED | sudo debconf-set-selections
-mysql-server-5.1 mysql-server/root_password password $DATABASE_PASSWORD
-mysql-server-5.1 mysql-server/root_password_again password $DATABASE_PASSWORD
-mysql-server-5.1 mysql-server/start_on_boot boolean true
+ sudo debconf-set-selections <<MYSQL_PRESEED
+mysql-server mysql-server/root_password password $DATABASE_PASSWORD
+mysql-server mysql-server/root_password_again password $DATABASE_PASSWORD
+mysql-server mysql-server/start_on_boot boolean true
MYSQL_PRESEED
fi
diff --git a/lib/databases/postgresql b/lib/databases/postgresql
index 76491c4..ad8cdc7 100644
--- a/lib/databases/postgresql
+++ b/lib/databases/postgresql
@@ -37,10 +37,9 @@
function recreate_database_postgresql {
local db=$1
- local charset=$2
# Avoid unsightly error when calling dropdb when the database doesn't exist
psql -h$DATABASE_HOST -U$DATABASE_USER -dtemplate1 -c "DROP DATABASE IF EXISTS $db"
- createdb -h $DATABASE_HOST -U$DATABASE_USER -l C -T template0 -E $charset $db
+ createdb -h $DATABASE_HOST -U$DATABASE_USER -l C -T template0 -E utf8 $db
}
function configure_database_postgresql {
diff --git a/lib/dib b/lib/dib
index 177f4c1..809217b 100644
--- a/lib/dib
+++ b/lib/dib
@@ -26,7 +26,7 @@
# NOTE: Setting DIB_APT_SOURCES assumes you will be building
# Debian/Ubuntu based images. Leave unset for other flavors.
DIB_APT_SOURCES=${DIB_APT_SOURCES:-""}
-DIB_BUILD_OFFLINE=$(trueorfalse False $DIB_BUILD_OFFLINE)
+DIB_BUILD_OFFLINE=$(trueorfalse False DIB_BUILD_OFFLINE)
DIB_IMAGE_CACHE=$DATA_DIR/diskimage-builder/image-create
DIB_PIP_REPO=$DATA_DIR/diskimage-builder/pip-repo
DIB_PIP_REPO_PORT=${DIB_PIP_REPO_PORT:-8899}
diff --git a/lib/dstat b/lib/dstat
index 73ca279..a17125f 100644
--- a/lib/dstat
+++ b/lib/dstat
@@ -20,7 +20,7 @@
# Defaults
# --------
# for DSTAT logging
-DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"}
+DSTAT_FILE=${DSTAT_FILE:-"dstat.log"}
# start_dstat() - Start running processes, including screen
diff --git a/lib/glance b/lib/glance
index 8cda6be..8768761 100644
--- a/lib/glance
+++ b/lib/glance
@@ -279,7 +279,7 @@
mkdir -p $GLANCE_CACHE_DIR
# (Re)create glance database
- recreate_database glance utf8
+ recreate_database glance
# Migrate glance database
$GLANCE_BIN_DIR/glance-manage db_sync
diff --git a/lib/heat b/lib/heat
index 544ec45..813c2fe 100644
--- a/lib/heat
+++ b/lib/heat
@@ -37,13 +37,13 @@
HEAT_CFNTOOLS_DIR=$DEST/heat-cfntools
HEAT_TEMPLATES_REPO_DIR=$DEST/heat-templates
HEAT_AUTH_CACHE_DIR=${HEAT_AUTH_CACHE_DIR:-/var/cache/heat}
-HEAT_STANDALONE=`trueorfalse False $HEAT_STANDALONE`
-HEAT_ENABLE_ADOPT_ABANDON=`trueorfalse False $HEAT_ENABLE_ADOPT_ABANDON`
+HEAT_STANDALONE=$(trueorfalse False HEAT_STANDALONE)
+HEAT_ENABLE_ADOPT_ABANDON=$(trueorfalse False HEAT_ENABLE_ADOPT_ABANDON)
HEAT_CONF_DIR=/etc/heat
HEAT_CONF=$HEAT_CONF_DIR/heat.conf
HEAT_ENV_DIR=$HEAT_CONF_DIR/environment.d
HEAT_TEMPLATES_DIR=$HEAT_CONF_DIR/templates
-HEAT_STACK_DOMAIN=`trueorfalse True $HEAT_STACK_DOMAIN`
+HEAT_STACK_DOMAIN=$(trueorfalse True HEAT_STACK_DOMAIN)
HEAT_API_HOST=${HEAT_API_HOST:-$HOST_IP}
HEAT_API_PORT=${HEAT_API_PORT:-8004}
@@ -115,7 +115,18 @@
setup_colorized_logging $HEAT_CONF DEFAULT tenant user
fi
- configure_auth_token_middleware $HEAT_CONF heat $HEAT_AUTH_CACHE_DIR
+ # NOTE(jamielennox): heat re-uses specific values from the
+ # keystone_authtoken middleware group and so currently fails when using the
+ # auth plugin setup. This should be fixed in heat. Heat is also the only
+ # service that requires the auth_uri to include a /v2.0. Remove this custom
+ # setup when bug #1300246 is resolved.
+ iniset $HEAT_CONF keystone_authtoken identity_uri $KEYSTONE_AUTH_URI
+ iniset $HEAT_CONF keystone_authtoken auth_uri $KEYSTONE_SERVICE_URI/v2.0
+ iniset $HEAT_CONF keystone_authtoken admin_user heat
+ iniset $HEAT_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
+ iniset $HEAT_CONF keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
+ iniset $HEAT_CONF keystone_authtoken cafile $SSL_BUNDLE_FILE
+ iniset $HEAT_CONF keystone_authtoken signing_dir $HEAT_AUTH_CACHE_DIR
if is_ssl_enabled_service "key"; then
iniset $HEAT_CONF clients_keystone ca_file $SSL_BUNDLE_FILE
@@ -175,7 +186,7 @@
function init_heat {
# (re)create heat database
- recreate_database heat utf8
+ recreate_database heat
$HEAT_DIR/bin/heat-manage db_sync
create_heat_cache_dir
@@ -265,23 +276,21 @@
if [[ "$HEAT_STACK_DOMAIN" == "True" ]]; then
# Note we have to pass token/endpoint here because the current endpoint and
# version negotiation in OSC means just --os-identity-api-version=3 won't work
- local ks_endpoint_v3="$KEYSTONE_SERVICE_URI/v3"
-
- D_ID=$(openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
+ D_ID=$(openstack --os-token $OS_TOKEN --os-url=$KEYSTONE_SERVICE_URI_V3 \
--os-identity-api-version=3 domain list | grep ' heat ' | get_field 1)
if [[ -z "$D_ID" ]]; then
- D_ID=$(openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
+ D_ID=$(openstack --os-token $OS_TOKEN --os-url=$KEYSTONE_SERVICE_URI_V3 \
--os-identity-api-version=3 domain create heat \
--description "Owns users and projects created by heat" \
| grep ' id ' | get_field 2)
iniset $HEAT_CONF DEFAULT stack_user_domain_id ${D_ID}
- openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
+ openstack --os-token $OS_TOKEN --os-url=$KEYSTONE_SERVICE_URI_V3 \
--os-identity-api-version=3 user create --password $SERVICE_PASSWORD \
--domain $D_ID heat_domain_admin \
--description "Manages users and projects created by heat"
- openstack --os-token $OS_TOKEN --os-url=$ks_endpoint_v3 \
+ openstack --os-token $OS_TOKEN --os-url=$KEYSTONE_SERVICE_URI_V3 \
--os-identity-api-version=3 role add \
--user heat_domain_admin --domain ${D_ID} admin
iniset $HEAT_CONF DEFAULT stack_domain_admin heat_domain_admin
diff --git a/lib/horizon b/lib/horizon
index fee2ef0..aa70bd5 100644
--- a/lib/horizon
+++ b/lib/horizon
@@ -173,7 +173,7 @@
# Apache installation, because we mark it NOPRIME
install_apache_wsgi
- git_clone $HORIZON_REPO $HORIZON_DIR $HORIZON_BRANCH $HORIZON_TAG
+ git_clone $HORIZON_REPO $HORIZON_DIR $HORIZON_BRANCH
}
# start_horizon() - Start running processes, including screen
diff --git a/lib/ironic b/lib/ironic
index c1140b5..2075a9c 100644
--- a/lib/ironic
+++ b/lib/ironic
@@ -60,7 +60,7 @@
# Set up defaults for functional / integration testing
IRONIC_SCRIPTS_DIR=${IRONIC_SCRIPTS_DIR:-$TOP_DIR/tools/ironic/scripts}
IRONIC_TEMPLATES_DIR=${IRONIC_TEMPLATES_DIR:-$TOP_DIR/tools/ironic/templates}
-IRONIC_BAREMETAL_BASIC_OPS=$(trueorfalse False $IRONIC_BAREMETAL_BASIC_OPS)
+IRONIC_BAREMETAL_BASIC_OPS=$(trueorfalse False IRONIC_BAREMETAL_BASIC_OPS)
IRONIC_ENABLED_DRIVERS=${IRONIC_ENABLED_DRIVERS:-fake,pxe_ssh,pxe_ipmitool}
IRONIC_SSH_USERNAME=${IRONIC_SSH_USERNAME:-`whoami`}
IRONIC_SSH_KEY_DIR=${IRONIC_SSH_KEY_DIR:-$IRONIC_DATA_DIR/ssh_keys}
@@ -87,7 +87,7 @@
IRONIC_VM_LOG_DIR=${IRONIC_VM_LOG_DIR:-$IRONIC_DATA_DIR/logs/}
# Use DIB to create deploy ramdisk and kernel.
-IRONIC_BUILD_DEPLOY_RAMDISK=`trueorfalse True $IRONIC_BUILD_DEPLOY_RAMDISK`
+IRONIC_BUILD_DEPLOY_RAMDISK=$(trueorfalse True IRONIC_BUILD_DEPLOY_RAMDISK)
# If not use DIB, these files are used as deploy ramdisk/kernel.
# (The value must be a absolute path)
IRONIC_DEPLOY_RAMDISK=${IRONIC_DEPLOY_RAMDISK:-}
@@ -116,7 +116,7 @@
TEMPEST_SERVICES+=,ironic
# Enable iPXE
-IRONIC_IPXE_ENABLED=$(trueorfalse False $IRONIC_IPXE_ENABLED)
+IRONIC_IPXE_ENABLED=$(trueorfalse False IRONIC_IPXE_ENABLED)
IRONIC_HTTP_DIR=${IRONIC_HTTP_DIR:-$IRONIC_DATA_DIR/httpboot}
IRONIC_HTTP_SERVER=${IRONIC_HTTP_SERVER:-$HOST_IP}
IRONIC_HTTP_PORT=${IRONIC_HTTP_PORT:-8088}
@@ -386,7 +386,7 @@
# init_ironic() - Initialize databases, etc.
function init_ironic {
# (Re)create ironic database
- recreate_database ironic utf8
+ recreate_database ironic
# Migrate ironic database
$IRONIC_BIN_DIR/ironic-dbsync --config-file=$IRONIC_CONF_FILE
@@ -461,7 +461,11 @@
# intentional sleep to make sure the tag has been set to port
sleep 10
- local tapdev=$(sudo ip netns exec qdhcp-${ironic_net_id} ip link list | grep " tap" | cut -d':' -f2 | cut -b2-)
+ if [[ "$Q_USE_NAMESPACE" = "True" ]]; then
+ local tapdev=$(sudo ip netns exec qdhcp-${ironic_net_id} ip link list | grep " tap" | cut -d':' -f2 | cut -b2-)
+ else
+ local tapdev=$(sudo ip link list | grep " tap" | cut -d':' -f2 | cut -b2-)
+ fi
local tag_id=$(sudo ovs-vsctl show |grep ${tapdev} -A1 -m1 | grep tag | cut -d':' -f2 | cut -b2-)
# make sure veth pair is not existing, otherwise delete its links
diff --git a/lib/keystone b/lib/keystone
index 1599fa5..afa7f00 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -71,6 +71,7 @@
# Select Keystone's token format
# Choose from 'UUID', 'PKI', or 'PKIZ'
+KEYSTONE_TOKEN_FORMAT=${KEYSTONE_TOKEN_FORMAT:-}
KEYSTONE_TOKEN_FORMAT=$(echo ${KEYSTONE_TOKEN_FORMAT} | tr '[:upper:]' '[:lower:]')
# Set Keystone interface configuration
@@ -106,6 +107,10 @@
KEYSTONE_AUTH_URI=${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_AUTH_HOST}:${KEYSTONE_AUTH_PORT}
KEYSTONE_SERVICE_URI=${KEYSTONE_SERVICE_PROTOCOL}://${KEYSTONE_SERVICE_HOST}:${KEYSTONE_SERVICE_PORT}
+# V3 URIs
+KEYSTONE_AUTH_URI_V3=$KEYSTONE_AUTH_URI/v3
+KEYSTONE_SERVICE_URI_V3=$KEYSTONE_SERVICE_URI/v3
+
# Functions
# ---------
# cleanup_keystone() - Remove residual data files, anything left over from previous
@@ -394,6 +399,9 @@
get_or_add_user_role $another_role $demo_user $demo_tenant
get_or_add_user_role $member_role $demo_user $invis_tenant
+ get_or_create_group "developers" "default" "openstack developers"
+ get_or_create_group "testers" "default"
+
# Keystone
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
@@ -407,15 +415,6 @@
fi
}
-# Configure the API version for the OpenStack projects.
-# configure_API_version conf_file version [section]
-function configure_API_version {
- local conf_file=$1
- local api_version=$2
- local section=${3:-keystone_authtoken}
- iniset $conf_file $section auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v$api_version
-}
-
# Configure the service to use the auth token middleware.
#
# configure_auth_token_middleware conf_file admin_user signing_dir [section]
@@ -429,15 +428,16 @@
local signing_dir=$3
local section=${4:-keystone_authtoken}
- iniset $conf_file $section auth_host $KEYSTONE_AUTH_HOST
- iniset $conf_file $section auth_port $KEYSTONE_AUTH_PORT
- iniset $conf_file $section auth_protocol $KEYSTONE_AUTH_PROTOCOL
- iniset $conf_file $section identity_uri $KEYSTONE_AUTH_URI
+ iniset $conf_file $section auth_plugin password
+ iniset $conf_file $section auth_url $KEYSTONE_AUTH_URI
+ iniset $conf_file $section username $admin_user
+ iniset $conf_file $section password $SERVICE_PASSWORD
+ iniset $conf_file $section user_domain_id default
+ iniset $conf_file $section project_name $SERVICE_TENANT_NAME
+ iniset $conf_file $section project_domain_id default
+
+ iniset $conf_file $section auth_uri $KEYSTONE_SERVICE_URI
iniset $conf_file $section cafile $SSL_BUNDLE_FILE
- configure_API_version $conf_file $IDENTITY_API_VERSION $section
- iniset $conf_file $section admin_tenant_name $SERVICE_TENANT_NAME
- iniset $conf_file $section admin_user $admin_user
- iniset $conf_file $section admin_password $SERVICE_PASSWORD
iniset $conf_file $section signing_dir $signing_dir
}
@@ -448,7 +448,7 @@
fi
# (Re)create keystone database
- recreate_database keystone utf8
+ recreate_database keystone
# Initialize keystone database
$KEYSTONE_DIR/bin/keystone-manage db_sync
diff --git a/lib/lvm b/lib/lvm
new file mode 100644
index 0000000..4ef260d
--- /dev/null
+++ b/lib/lvm
@@ -0,0 +1,124 @@
+# lib/lvm
+# Configure the default LVM volume group used by Cinder and Nova
+
+# Dependencies:
+#
+# - ``functions`` file
+# - ``cinder`` configurations
+
+# DATA_DIR
+
+# clean_default_volume_group - called from clean()
+# configure_default_volume_group - called from configure()
+# init_default_volume_group - called from init()
+
+
+# Save trace setting
+MY_XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Defaults
+# --------
+# Name of the lvm volume groups to use/create for iscsi volumes
+# This monkey-motion is for compatibility with icehouse-generation Grenade
+# If ``VOLUME_GROUP`` is set, use it, otherwise we'll build a VG name based
+# on ``VOLUME_GROUP_NAME`` that includes the backend name
+# Grenade doesn't use ``VOLUME_GROUP2`` so it is left out
+VOLUME_GROUP_NAME=${VOLUME_GROUP:-${VOLUME_GROUP_NAME:-stack-volumes}}
+DEFAULT_VOLUME_GROUP_NAME=$VOLUME_GROUP_NAME-default
+
+# Backing file name is of the form $VOLUME_GROUP$BACKING_FILE_SUFFIX
+BACKING_FILE_SUFFIX=-backing-file
+
+
+# Entry Points
+# ------------
+
+# _clean_lvm_volume_group removes all default LVM volumes
+#
+# Usage: clean_lvm_volume_group $vg
+function _clean_lvm_volume_group {
+ local vg=$1
+
+ # Clean out existing volumes
+ sudo lvremove -f $vg
+}
+
+# _clean_lvm_backing_file() removes the backing file of the
+# volume group
+#
+# Usage: _clean_lvm_backing_file() $backing_file
+function _clean_lvm_backing_file {
+ local backing_file=$1
+
+ # if the backing physical device is a loop device, it was probably setup by devstack
+ if [[ -n "$backing_file" ]] && [[ -e "$backing_file" ]]; then
+ local vg_dev=$(sudo losetup -j $backing_file | awk -F':' '/'$BACKING_FILE_SUFFIX'/ { print $1}')
+ sudo losetup -d $vg_dev
+ rm -f $backing_file
+ fi
+}
+
+# clean_lvm_volume_group() cleans up the volume group and removes the
+# backing file
+#
+# Usage: clean_lvm_volume_group $vg
+function clean_lvm_volume_group {
+ local vg=$1
+
+ _clean_lvm_volume_group $vg
+ # if there is no logical volume left, it's safe to attempt a cleanup
+ # of the backing file
+ if [[ -z "$(sudo lvs --noheadings -o lv_name $vg 2>/dev/null)" ]]; then
+ _clean_lvm_backing_file $DATA_DIR/$vg$BACKING_FILE_SUFFIX
+ fi
+}
+
+
+# _create_volume_group creates default volume group
+#
+# Usage: _create_lvm_volume_group() $vg $size
+function _create_lvm_volume_group {
+ local vg=$1
+ local size=$2
+
+ local backing_file=$DATA_DIR/$vg$BACKING_FILE_SUFFIX
+ if ! sudo vgs $vg; then
+ # Only create if the file doesn't already exists
+ [[ -f $DATA_DIR/$backing_file ]] || truncate -s $size $backing_file
+ local vg_dev=`sudo losetup -f --show $backing_file`
+
+ # Only create volume group if it doesn't already exist
+ if ! sudo vgs $vg; then
+ sudo vgcreate $vg $vg_dev
+ fi
+ fi
+}
+
+# init_lvm_volume_group() initializes the volume group creating the backing
+# file if necessary
+#
+# Usage: init_lvm_volume_group() $vg
+function init_lvm_volume_group {
+ local vg=$1
+ local size=$2
+ # Start with a clean volume group
+ _create_lvm_volume_group $vg $size
+
+ if is_fedora || is_suse; then
+ # service is not started by default
+ start_service tgtd
+ fi
+
+ # Remove iscsi targets
+ sudo tgtadm --op show --mode target | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
+
+ _clean_lvm_volume_group $vg
+}
+
+# Restore xtrace
+$MY_XTRACE
+
+# mode: shell-script
+# End:
diff --git a/lib/neutron b/lib/neutron
index bfb0fba..b22c00b 100755
--- a/lib/neutron
+++ b/lib/neutron
@@ -543,8 +543,15 @@
die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK"
die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specifiy the PROVIDER_NETWORK_TYPE"
NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type $PROVIDER_NETWORK_TYPE --provider:physical_network "$PHYSICAL_NETWORK" ${SEGMENTATION_ID:+--provider:segmentation_id $SEGMENTATION_ID} --shared | grep ' id ' | get_field 2)
- SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --name $PROVIDER_SUBNET_NAME --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
- SUBNET_V6_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 6 --ipv6-address-mode slaac --gateway $V6_NETWORK_GATEWAY --name $PROVIDER_SUBNET_NAME_V6 $NET_ID $FIXED_RANGE_V6 | grep 'id' | get_field 2)
+
+ if [[ "$IP_VERSION" =~ 4.* ]]; then
+ SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --name $PROVIDER_SUBNET_NAME --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
+ fi
+
+ if [[ "$IP_VERSION" =~ .*6 ]]; then
+ SUBNET_V6_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 6 --ipv6-address-mode slaac --gateway $V6_NETWORK_GATEWAY --name $PROVIDER_SUBNET_NAME_V6 $NET_ID $FIXED_RANGE_V6 | grep 'id' | get_field 2)
+ fi
+
sudo ip link set $OVS_PHYSICAL_BRIDGE up
sudo ip link set br-int up
sudo ip link set $PUBLIC_INTERFACE up
@@ -597,7 +604,7 @@
# init_neutron() - Initialize databases, etc.
function init_neutron {
- recreate_database $Q_DB_NAME utf8
+ recreate_database $Q_DB_NAME
# Run Neutron db migrations
$NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
for svc in fwaas lbaas vpnaas; do
@@ -704,7 +711,7 @@
run_process q-dhcp "python $AGENT_DHCP_BINARY --config-file $NEUTRON_CONF --config-file=$Q_DHCP_CONF_FILE"
if is_provider_network; then
- sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
+ sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
sudo ip link set $OVS_PHYSICAL_BRIDGE up
sudo ip link set br-int up
sudo ip link set $PUBLIC_INTERFACE up
@@ -842,6 +849,9 @@
# Format logging
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
setup_colorized_logging $NEUTRON_CONF DEFAULT project_id
+ else
+ # Show user_name and project_name by default like in nova
+ iniset $NEUTRON_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
fi
if is_service_enabled tls-proxy; then
diff --git a/lib/neutron_plugins/midonet b/lib/neutron_plugins/midonet
index eb27ed6..23ad8b2 100644
--- a/lib/neutron_plugins/midonet
+++ b/lib/neutron_plugins/midonet
@@ -29,6 +29,18 @@
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/midonet
Q_PLUGIN_CONF_FILENAME=midonet.ini
Q_PLUGIN_CLASS="neutron.plugins.midonet.plugin.MidonetPluginV2"
+
+ # MidoNet implements LBaaS API in the plugin, not as an LBaaS driver.
+ # In this model, the plugin references the 'neutron_lbaas' module but
+ # does not require starting an LBaaS service. Devstack, however, clones
+ # 'neutron_lbaas' only if 'lbaas' service is enabled. To get around this,
+ # always clone 'neutron_lbaas' so that it is made available to the plugin.
+ # Also, discontinue if the 'lbaas' service is enabled.
+ if is_service_enabled q-lbaas; then
+ die $LINENO "LBaaS service should be disabled for the MidoNet plugin"
+ fi
+ git_clone $NEUTRON_LBAAS_REPO $NEUTRON_LBAAS_DIR $NEUTRON_LBAAS_BRANCH
+ setup_develop $NEUTRON_LBAAS_DIR
}
function neutron_plugin_configure_debug_command {
diff --git a/lib/nova b/lib/nova
index 5ac9ff1..76212ed 100644
--- a/lib/nova
+++ b/lib/nova
@@ -106,7 +106,7 @@
# $NOVA_VNC_ENABLED can be used to forcibly enable vnc configuration.
# In multi-node setups allows compute hosts to not run n-novnc.
-NOVA_VNC_ENABLED=$(trueorfalse False $NOVA_VNC_ENABLED)
+NOVA_VNC_ENABLED=$(trueorfalse False NOVA_VNC_ENABLED)
# Get hypervisor configuration
# ----------------------------
@@ -145,11 +145,11 @@
# ``MULTI_HOST`` is a mode where each compute node runs its own network node. This
# allows network operations and routing for a VM to occur on the server that is
# running the VM - removing a SPOF and bandwidth bottleneck.
-MULTI_HOST=`trueorfalse False $MULTI_HOST`
+MULTI_HOST=$(trueorfalse False MULTI_HOST)
# ``NOVA_ALLOW_MOVE_TO_SAME_HOST` can be set to False in multi node devstack,
# where there are at least two nova-computes.
-NOVA_ALLOW_MOVE_TO_SAME_HOST=`trueorfalse True $NOVA_ALLOW_MOVE_TO_SAME_HOST`
+NOVA_ALLOW_MOVE_TO_SAME_HOST=$(trueorfalse True NOVA_ALLOW_MOVE_TO_SAME_HOST)
# Test floating pool and range are used for testing. They are defined
# here until the admin APIs can replace nova-manage
@@ -547,6 +547,11 @@
iniset $NOVA_CONF DEFAULT ec2_workers "$API_WORKERS"
iniset $NOVA_CONF DEFAULT metadata_workers "$API_WORKERS"
+ if [[ "$NOVA_BACKEND" == "LVM" ]]; then
+ iniset $NOVA_CONF libvirt images_type "lvm"
+ iniset $NOVA_CONF libvirt images_volume_group $DEFAULT_VOLUME_GROUP_NAME
+ fi
+
if is_ssl_enabled_service glance || is_service_enabled tls-proxy; then
iniset $NOVA_CONF DEFAULT glance_protocol https
fi
@@ -623,16 +628,13 @@
# Only do this step once on the API node for an entire cluster.
if is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-api; then
# (Re)create nova database
- # Explicitly use latin1: to avoid lp#829209, nova expects the database to
- # use latin1 by default, and then upgrades the database to utf8 (see the
- # 082_essex.py in nova)
- recreate_database nova latin1
+ recreate_database nova
# Migrate nova database
$NOVA_BIN_DIR/nova-manage db sync
if is_service_enabled n-cell; then
- recreate_database $NOVA_CELLS_DB latin1
+ recreate_database $NOVA_CELLS_DB
fi
fi
@@ -657,7 +659,7 @@
if is_service_enabled n-novnc; then
# a websockets/html5 or flash powered VNC console for vm instances
- NOVNC_FROM_PACKAGE=`trueorfalse False $NOVNC_FROM_PACKAGE`
+ NOVNC_FROM_PACKAGE=$(trueorfalse False NOVNC_FROM_PACKAGE)
if [ "$NOVNC_FROM_PACKAGE" = "True" ]; then
NOVNC_WEB_DIR=/usr/share/novnc
install_package novnc
@@ -669,7 +671,7 @@
if is_service_enabled n-spice; then
# a websockets/html5 or flash powered SPICE console for vm instances
- SPICE_FROM_PACKAGE=`trueorfalse True $SPICE_FROM_PACKAGE`
+ SPICE_FROM_PACKAGE=$(trueorfalse True SPICE_FROM_PACKAGE)
if [ "$SPICE_FROM_PACKAGE" = "True" ]; then
SPICE_WEB_DIR=/usr/share/spice-html5
install_package spice-html5
diff --git a/lib/nova_plugins/functions-libvirt b/lib/nova_plugins/functions-libvirt
index 4601eea..c136e35 100644
--- a/lib/nova_plugins/functions-libvirt
+++ b/lib/nova_plugins/functions-libvirt
@@ -15,7 +15,7 @@
# --------
# if we should turn on massive libvirt debugging
-DEBUG_LIBVIRT=$(trueorfalse False $DEBUG_LIBVIRT)
+DEBUG_LIBVIRT=$(trueorfalse False DEBUG_LIBVIRT)
# Installs required distro-specific libvirt packages.
function install_libvirt {
diff --git a/lib/nova_plugins/hypervisor-ironic b/lib/nova_plugins/hypervisor-ironic
index 4c2043b..0169d73 100644
--- a/lib/nova_plugins/hypervisor-ironic
+++ b/lib/nova_plugins/hypervisor-ironic
@@ -56,6 +56,8 @@
function install_nova_hypervisor {
if ! is_service_enabled neutron; then
die $LINENO "Neutron should be enabled for usage of the Ironic Nova driver."
+ elif is_ironic_hardware; then
+ return
fi
install_libvirt
if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] && is_ubuntu; then
diff --git a/lib/nova_plugins/hypervisor-libvirt b/lib/nova_plugins/hypervisor-libvirt
index b1b4400..4d1eb6c 100644
--- a/lib/nova_plugins/hypervisor-libvirt
+++ b/lib/nova_plugins/hypervisor-libvirt
@@ -54,7 +54,7 @@
iniset $NOVA_CONF DEFAULT vnc_enabled "false"
fi
- ENABLE_FILE_INJECTION=$(trueorfalse False $ENABLE_FILE_INJECTION)
+ ENABLE_FILE_INJECTION=$(trueorfalse False ENABLE_FILE_INJECTION)
if [[ "$ENABLE_FILE_INJECTION" = "True" ]] ; then
# When libguestfs is available for file injection, enable using
# libguestfs to inspect the image and figure out the proper
diff --git a/lib/rpc_backend b/lib/rpc_backend
index 778d466..98be184 100644
--- a/lib/rpc_backend
+++ b/lib/rpc_backend
@@ -21,6 +21,11 @@
XTRACE=$(set +o | grep xtrace)
set +o xtrace
+RPC_MESSAGING_PROTOCOL=${RPC_MESSAGING_PROTOCOL:-0.9}
+
+# TODO(sdague): RPC backend selection is super wonky because we treat
+# messaging server as a service, which it really isn't for multi host
+QPID_HOST=${QPID_HOST:-}
# Functions
# ---------
@@ -49,13 +54,15 @@
(( rpc_backend_cnt++ )) || true
done
if [ "$rpc_backend_cnt" -gt 1 ]; then
- echo "ERROR: only one rpc backend may be enabled,"
- echo " set only one of 'rabbit', 'qpid', 'zeromq'"
- echo " via ENABLED_SERVICES."
+ die $LINENO \
+ "Only one rpc backend may be enabled, " \
+ "set only one of 'rabbit', 'qpid', 'zeromq' " \
+ "via ENABLED_SERVICES."
elif [ "$rpc_backend_cnt" == 0 ] && [ "$rpc_needed" == 0 ]; then
- echo "ERROR: at least one rpc backend must be enabled,"
- echo " set one of 'rabbit', 'qpid', 'zeromq'"
- echo " via ENABLED_SERVICES."
+ die $LINENO \
+ "at least one rpc backend must be enabled, " \
+ "set one of 'rabbit', 'qpid', 'zeromq'" \
+ "via ENABLED_SERVICES."
fi
if is_service_enabled qpid && ! qpid_is_supported; then
@@ -68,9 +75,6 @@
function cleanup_rpc_backend {
if is_service_enabled rabbit; then
# Obliterate rabbitmq-server
- if [ -n "$RABBIT_USERID" ]; then
- sudo rabbitmqctl delete_user "$RABBIT_USERID"
- fi
uninstall_package rabbitmq-server
sudo killall epmd || sudo killall -9 epmd
if is_ubuntu; then
diff --git a/lib/sahara b/lib/sahara
index c902d38..995935a 100644
--- a/lib/sahara
+++ b/lib/sahara
@@ -11,6 +11,7 @@
# install_sahara
# install_python_saharaclient
# configure_sahara
+# sahara_register_images
# start_sahara
# stop_sahara
# cleanup_sahara
@@ -128,6 +129,9 @@
if is_service_enabled neutron; then
iniset $SAHARA_CONF_FILE DEFAULT use_neutron true
iniset $SAHARA_CONF_FILE DEFAULT use_floating_ips true
+ else
+ iniset $SAHARA_CONF_FILE DEFAULT use_neutron false
+ iniset $SAHARA_CONF_FILE DEFAULT use_floating_ips false
fi
if is_service_enabled heat; then
@@ -143,7 +147,7 @@
setup_colorized_logging $SAHARA_CONF_FILE DEFAULT
fi
- recreate_database sahara utf8
+ recreate_database sahara
$SAHARA_BIN_DIR/sahara-db-manage --config-file $SAHARA_CONF_FILE upgrade head
}
@@ -161,6 +165,17 @@
fi
}
+# sahara_register_images() - Registers images in sahara image registry
+function sahara_register_images {
+ if is_service_enabled heat && [[ ! -z "$HEAT_CFN_IMAGE_URL" ]]; then
+ # Register heat image for Fake plugin
+ local fake_plugin_properties="--property _sahara_tag_0.1=True"
+ fake_plugin_properties+=" --property _sahara_tag_fake=True"
+ fake_plugin_properties+=" --property _sahara_username=fedora"
+ openstack --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT image set $(basename "$HEAT_CFN_IMAGE_URL" ".qcow2") $fake_plugin_properties
+ fi
+}
+
# start_sahara() - Start running processes, including screen
function start_sahara {
run_process sahara "$SAHARA_BIN_DIR/sahara-all --config-file $SAHARA_CONF_FILE"
diff --git a/lib/swift b/lib/swift
index e9043b3..ee4543c 100644
--- a/lib/swift
+++ b/lib/swift
@@ -82,7 +82,7 @@
# Set ``SWIFT_EXTRAS_MIDDLEWARE_LAST`` to extras middlewares that need to be at
# the end of the pipeline.
-SWIFT_EXTRAS_MIDDLEWARE_LAST=${SWIFT_EXTRAS_MIDDLEWARE_LAST}
+SWIFT_EXTRAS_MIDDLEWARE_LAST=${SWIFT_EXTRAS_MIDDLEWARE_LAST:-}
# Set ``SWIFT_EXTRAS_MIDDLEWARE_NO_AUTH`` to extras middlewares that need to be at
# the beginning of the pipeline, before authentication middlewares.
@@ -127,7 +127,7 @@
# Enable tempurl feature
SWIFT_ENABLE_TEMPURLS=${SWIFT_ENABLE_TEMPURLS:-False}
-SWIFT_TEMPURL_KEY=${SWIFT_TEMPURL_KEY}
+SWIFT_TEMPURL_KEY=${SWIFT_TEMPURL_KEY:-}
# Tell Tempest this project is present
TEMPEST_SERVICES+=,swift
@@ -401,11 +401,10 @@
sed -i "/^pipeline/ { s/tempauth/${swift_pipeline} ${SWIFT_EXTRAS_MIDDLEWARE}/ ;}" ${SWIFT_CONFIG_PROXY_SERVER}
sed -i "/^pipeline/ { s/proxy-server/${SWIFT_EXTRAS_MIDDLEWARE_LAST} proxy-server/ ; }" ${SWIFT_CONFIG_PROXY_SERVER}
- iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth account_autocreate
+
iniset ${SWIFT_CONFIG_PROXY_SERVER} app:proxy-server account_autocreate true
- iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth reseller_prefix
- iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth reseller_prefix "TEMPAUTH"
+
# Configure Crossdomain
iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:crossdomain use "egg:swift#crossdomain"
@@ -422,6 +421,13 @@
iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:keystoneauth operator_roles
iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:keystoneauth operator_roles "Member, admin"
+ # Configure Tempauth. In the sample config file, Keystoneauth is commented
+ # out. Make sure we uncomment Tempauth after we uncomment Keystoneauth
+ # otherwise, this code also sets the reseller_prefix for Keystoneauth.
+ iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth account_autocreate
+ iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth reseller_prefix
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth reseller_prefix "TEMPAUTH"
+
if is_service_enabled swift3; then
cat <<EOF >>${SWIFT_CONFIG_PROXY_SERVER}
# NOTE(chmou): s3token middleware is not updated yet to use only
diff --git a/lib/tempest b/lib/tempest
index d31119b..1ae9457 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -75,8 +75,8 @@
TEMPEST_STORAGE_PROTOCOL=${TEMPEST_STORAGE_PROTOCOL:-$TEMPEST_DEFAULT_STORAGE_PROTOCOL}
# Neutron/Network variables
-IPV6_ENABLED=$(trueorfalse True $IPV6_ENABLED)
-IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True $IPV6_SUBNET_ATTRIBUTES_ENABLED)
+IPV6_ENABLED=$(trueorfalse True IPV6_ENABLED)
+IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True IPV6_SUBNET_ATTRIBUTES_ENABLED)
# Functions
# ---------
@@ -278,7 +278,7 @@
# Identity
iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v2.0/"
- iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v3/"
+ iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_URI_V3"
iniset $TEMPEST_CONFIG identity username $TEMPEST_USERNAME
iniset $TEMPEST_CONFIG identity password "$password"
iniset $TEMPEST_CONFIG identity tenant_name $TEMPEST_TENANT_NAME
diff --git a/lib/trove b/lib/trove
index abf4e87..3249ce0 100644
--- a/lib/trove
+++ b/lib/trove
@@ -199,7 +199,7 @@
# init_trove() - Initializes Trove Database as a Service
function init_trove {
# (Re)Create trove db
- recreate_database trove utf8
+ recreate_database trove
# Initialize the trove database
$TROVE_BIN_DIR/trove-manage db_sync
diff --git a/lib/zaqar b/lib/zaqar
index 0d1f6f4..dfa3452 100644
--- a/lib/zaqar
+++ b/lib/zaqar
@@ -135,6 +135,12 @@
configure_redis
fi
+ if is_service_enabled qpid || [ -n "$RABBIT_HOST" ] && [ -n "$RABBIT_PASSWORD" ]; then
+ iniset $ZAQAR_CONF DEFAULT notification_driver messaging
+ iniset $ZAQAR_CONF DEFAULT control_exchange zaqar
+ fi
+ iniset_rpc_backend zaqar $ZAQAR_CONF DEFAULT
+
cleanup_zaqar
}
diff --git a/stack.sh b/stack.sh
index 048e5d1..b03cca8 100755
--- a/stack.sh
+++ b/stack.sh
@@ -40,6 +40,12 @@
# Keep track of the devstack directory
TOP_DIR=$(cd $(dirname "$0") && pwd)
+# Check for uninitialized variables, a big cause of bugs
+NOUNSET=${NOUNSET:-}
+if [[ -n "$NOUNSET" ]]; then
+ set -o nounset
+fi
+
# Sanity Checks
# -------------
@@ -79,6 +85,9 @@
# Prepare the environment
# -----------------------
+# Initialize variables:
+LAST_SPINNER_PID=""
+
# Import common functions
source $TOP_DIR/functions
@@ -172,12 +181,12 @@
disable_negated_services
# Look for obsolete stuff
-if [[ ,${ENABLED_SERVICES}, =~ ,"swift", ]]; then
- echo "FATAL: 'swift' is not supported as a service name"
- echo "FATAL: Use the actual swift service names to enable them as required:"
- echo "FATAL: s-proxy s-object s-container s-account"
- exit 1
-fi
+# if [[ ,${ENABLED_SERVICES}, =~ ,"swift", ]]; then
+# echo "FATAL: 'swift' is not supported as a service name"
+# echo "FATAL: Use the actual swift service names to enable them as required:"
+# echo "FATAL: s-proxy s-object s-container s-account"
+# exit 1
+# fi
# Configure sudo
# --------------
@@ -311,7 +320,7 @@
# -----------------
# Set up logging level
-VERBOSE=$(trueorfalse True $VERBOSE)
+VERBOSE=$(trueorfalse True VERBOSE)
# Draw a spinner so the user knows something is happening
function spinner {
@@ -370,15 +379,14 @@
fi
if [[ -n "$LOGFILE" ]]; then
- # First clean up old log files. Use the user-specified ``LOGFILE``
- # as the template to search for, appending '.*' to match the date
- # we added on earlier runs.
- LOGDIR=$(dirname "$LOGFILE")
- LOGFILENAME=$(basename "$LOGFILE")
- mkdir -p $LOGDIR
- find $LOGDIR -maxdepth 1 -name $LOGFILENAME.\* -mtime +$LOGDAYS -exec rm {} \;
+ # Clean up old log files. Append '.*' to the user-specified
+ # ``LOGFILE`` to match the date in the search template.
+ LOGFILE_DIR="${LOGFILE%/*}" # dirname
+ LOGFILE_NAME="${LOGFILE##*/}" # basename
+ mkdir -p $LOGFILE_DIR
+ find $LOGFILE_DIR -maxdepth 1 -name $LOGFILE_NAME.\* -mtime +$LOGDAYS -exec rm {} \;
LOGFILE=$LOGFILE.${CURRENT_LOG_TIME}
- SUMFILE=$LOGFILE.${CURRENT_LOG_TIME}.summary
+ SUMFILE=$LOGFILE.summary.${CURRENT_LOG_TIME}
# Redirect output according to config
@@ -399,8 +407,8 @@
echo_summary "stack.sh log $LOGFILE"
# Specified logfile name always links to the most recent log
- ln -sf $LOGFILE $LOGDIR/$LOGFILENAME
- ln -sf $SUMFILE $LOGDIR/$LOGFILENAME.summary
+ ln -sf $LOGFILE $LOGFILE_DIR/$LOGFILE_NAME
+ ln -sf $SUMFILE $LOGFILE_DIR/$LOGFILE_NAME.summary
else
# Set up output redirection without log files
# Set fd 3 to a copy of stdout. So we can set fd 1 without losing
@@ -482,47 +490,6 @@
# an error. It is also useful for following along as the install occurs.
set -o xtrace
-
-# Common Configuration
-# --------------------
-
-# Set ``OFFLINE`` to ``True`` to configure ``stack.sh`` to run cleanly without
-# Internet access. ``stack.sh`` must have been previously run with Internet
-# access to install prerequisites and fetch repositories.
-OFFLINE=`trueorfalse False $OFFLINE`
-
-# Set ``ERROR_ON_CLONE`` to ``True`` to configure ``stack.sh`` to exit if
-# the destination git repository does not exist during the ``git_clone``
-# operation.
-ERROR_ON_CLONE=`trueorfalse False $ERROR_ON_CLONE`
-
-# Whether to enable the debug log level in OpenStack services
-ENABLE_DEBUG_LOG_LEVEL=`trueorfalse True $ENABLE_DEBUG_LOG_LEVEL`
-
-# Set fixed and floating range here so we can make sure not to use addresses
-# from either range when attempting to guess the IP to use for the host.
-# Note that setting FIXED_RANGE may be necessary when running DevStack
-# in an OpenStack cloud that uses either of these address ranges internally.
-FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.0/24}
-FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24}
-FIXED_NETWORK_SIZE=${FIXED_NETWORK_SIZE:-256}
-
-HOST_IP=$(get_default_host_ip $FIXED_RANGE $FLOATING_RANGE "$HOST_IP_IFACE" "$HOST_IP")
-if [ "$HOST_IP" == "" ]; then
- die $LINENO "Could not determine host ip address. See local.conf for suggestions on setting HOST_IP."
-fi
-
-# Allow the use of an alternate hostname (such as localhost/127.0.0.1) for service endpoints.
-SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
-
-# Configure services to use syslog instead of writing to individual log files
-SYSLOG=`trueorfalse False $SYSLOG`
-SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
-SYSLOG_PORT=${SYSLOG_PORT:-516}
-
-# Use color for logging output (only available if syslog is not used)
-LOG_COLOR=`trueorfalse True $LOG_COLOR`
-
# Reset the bundle of CA certificates
SSL_BUNDLE_FILE="$DATA_DIR/ca-bundle.pem"
rm -f $SSL_BUNDLE_FILE
@@ -535,9 +502,6 @@
# and the specified rpc backend is available on your platform.
check_rpc_backend
-# Use native SSL for servers in SSL_ENABLED_SERVICES
-USE_SSL=$(trueorfalse False $USE_SSL)
-
# Service to enable with SSL if USE_SSL is True
SSL_ENABLED_SERVICES="key,nova,cinder,glance,s-proxy,neutron"
@@ -558,6 +522,7 @@
source $TOP_DIR/lib/infra
source $TOP_DIR/lib/oslo
source $TOP_DIR/lib/stackforge
+source $TOP_DIR/lib/lvm
source $TOP_DIR/lib/horizon
source $TOP_DIR/lib/keystone
source $TOP_DIR/lib/glance
@@ -641,7 +606,7 @@
# The available database backends are listed in ``DATABASE_BACKENDS`` after
# ``lib/database`` is sourced. ``mysql`` is the default.
-initialize_database_backends && echo "Using $DATABASE_TYPE database backend" || echo "No database enabled"
+initialize_database_backends && echo "Using $DATABASE_TYPE database backend" || die $LINENO "No database enabled"
# Queue Configuration
@@ -708,7 +673,7 @@
# Configure an appropriate python environment
if [[ "$OFFLINE" != "True" ]]; then
- PYPI_ALTERNATIVE_URL=$PYPI_ALTERNATIVE_URL $TOP_DIR/tools/install_pip.sh
+ PYPI_ALTERNATIVE_URL=${PYPI_ALTERNATIVE_URL:-""} $TOP_DIR/tools/install_pip.sh
fi
TRACK_DEPENDS=${TRACK_DEPENDS:-False}
@@ -783,7 +748,7 @@
git_clone_by_name "python-openstackclient"
setup_dev_lib "python-openstackclient"
else
- pip_install 'python-openstackclient>=1.0.0'
+ pip_install 'python-openstackclient>=1.0.2'
fi
@@ -944,13 +909,14 @@
# Configure screen
# ----------------
-USE_SCREEN=$(trueorfalse True $USE_SCREEN)
+USE_SCREEN=$(trueorfalse True USE_SCREEN)
if [[ "$USE_SCREEN" == "True" ]]; then
# Create a new named screen to run processes in
screen -d -m -S $SCREEN_NAME -t shell -s /bin/bash
sleep 1
# Set a reasonable status bar
+ SCREEN_HARDSTATUS=${SCREEN_HARDSTATUS-:}
if [ -z "$SCREEN_HARDSTATUS" ]; then
SCREEN_HARDSTATUS='%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})'
fi
@@ -973,6 +939,10 @@
# A better kind of sysstat, with the top process per time slice
start_dstat
+# Initialize default LVM volume group
+# -----------------------------------
+init_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME $VOLUME_BACKING_FILE_SIZE
+
# Start Services
# ==============
diff --git a/stackrc b/stackrc
index 355c0dc..2dd56e8 100644
--- a/stackrc
+++ b/stackrc
@@ -43,9 +43,17 @@
# enable_service q-meta
# # Optional, to enable tempest configuration as part of devstack
# enable_service tempest
+function isset {
+ local nounset=$(set +o | grep nounset)
+ set +o nounset
+ [[ -n "${!1+x}" ]]
+ result=$?
+ $nounset
+ return $result
+}
# this allows us to pass ENABLED_SERVICES
-if [[ -z "$ENABLED_SERVICES" ]]; then
+if ! isset ENABLED_SERVICES ; then
# core compute (glance / keystone / nova (+ nova-network))
ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,n-sch,n-xvnc,n-cauth
# cinder
@@ -106,7 +114,7 @@
# This can be used to turn database query logging on and off
# (currently only implemented for MySQL backend)
-DATABASE_QUERY_LOGGING=$(trueorfalse True $DATABASE_QUERY_LOGGING)
+DATABASE_QUERY_LOGGING=$(trueorfalse True DATABASE_QUERY_LOGGING)
# Set a timeout for git operations. If git is still running when the
# timeout expires, the command will be retried up to 3 times. This is
@@ -593,7 +601,7 @@
# Staging Area for New Images, have them here for at least 24hrs for nodepool
# to cache them otherwise the failure rates in the gate are too high
-PRECACHE_IMAGES=$(trueorfalse False $PRECACHE_IMAGES)
+PRECACHE_IMAGES=$(trueorfalse False PRECACHE_IMAGES)
if [[ "$PRECACHE_IMAGES" == "True" ]]; then
# staging in update for nodepool
IMAGE_URL="https://download.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"
@@ -646,6 +654,55 @@
# till we get to the point we need to handle this automatically
YUM=${YUM:-yum}
+# Common Configuration
+# --------------------
+
+# Set ``OFFLINE`` to ``True`` to configure ``stack.sh`` to run cleanly without
+# Internet access. ``stack.sh`` must have been previously run with Internet
+# access to install prerequisites and fetch repositories.
+OFFLINE=$(trueorfalse False OFFLINE)
+
+# Set ``ERROR_ON_CLONE`` to ``True`` to configure ``stack.sh`` to exit if
+# the destination git repository does not exist during the ``git_clone``
+# operation.
+ERROR_ON_CLONE=$(trueorfalse False ERROR_ON_CLONE)
+
+# Whether to enable the debug log level in OpenStack services
+ENABLE_DEBUG_LOG_LEVEL=$(trueorfalse True ENABLE_DEBUG_LOG_LEVEL)
+
+# Set fixed and floating range here so we can make sure not to use addresses
+# from either range when attempting to guess the IP to use for the host.
+# Note that setting FIXED_RANGE may be necessary when running DevStack
+# in an OpenStack cloud that uses either of these address ranges internally.
+FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.0/24}
+FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24}
+FIXED_NETWORK_SIZE=${FIXED_NETWORK_SIZE:-256}
+HOST_IP_IFACE=${HOST_IP_IFACE:-}
+HOST_IP=${HOST_IP:-}
+
+HOST_IP=$(get_default_host_ip $FIXED_RANGE $FLOATING_RANGE "$HOST_IP_IFACE" "$HOST_IP")
+if [ "$HOST_IP" == "" ]; then
+ die $LINENO "Could not determine host ip address. See local.conf for suggestions on setting HOST_IP."
+fi
+
+# Allow the use of an alternate hostname (such as localhost/127.0.0.1) for service endpoints.
+SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
+
+# Configure services to use syslog instead of writing to individual log files
+SYSLOG=$(trueorfalse False SYSLOG)
+SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
+SYSLOG_PORT=${SYSLOG_PORT:-516}
+
+# Use color for logging output (only available if syslog is not used)
+LOG_COLOR=$(trueorfalse True LOG_COLOR)
+
+# Set global ``GIT_DEPTH=<number>`` to limit the history depth of the git clone
+# Set to 0 to disable shallow cloning
+GIT_DEPTH=${GIT_DEPTH:-0}
+
+# Use native SSL for servers in SSL_ENABLED_SERVICES
+USE_SSL=$(trueorfalse False USE_SSL)
+
# Following entries need to be last items in file
# Local variables:
diff --git a/tests/test_functions.sh b/tests/test_functions.sh
new file mode 100755
index 0000000..e57948a
--- /dev/null
+++ b/tests/test_functions.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+# Tests for DevStack meta-config functions
+
+TOP=$(cd $(dirname "$0")/.. && pwd)
+
+# Import common functions
+source $TOP/functions
+source $TOP/tests/unittest.sh
+
+function test_truefalse {
+ local one=1
+ local captrue=True
+ local lowtrue=true
+ local abrevtrue=t
+ local zero=0
+ local capfalse=False
+ local lowfalse=false
+ local abrevfalse=f
+ for against in True False; do
+ for name in one captrue lowtrue abrevtrue; do
+ assert_equal "True" $(trueorfalse $against $name) "\$(trueorfalse $against $name)"
+ done
+ done
+ for against in True False; do
+ for name in zero capfalse lowfalse abrevfalse; do
+ assert_equal "False" $(trueorfalse $against $name) "\$(trueorfalse $against $name)"
+ done
+ done
+}
+
+test_truefalse
+
+report_results
diff --git a/tests/unittest.sh b/tests/unittest.sh
new file mode 100644
index 0000000..435cc3a
--- /dev/null
+++ b/tests/unittest.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+
+# 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.
+
+# we always start with no errors
+ERROR=0
+FAILED_FUNCS=""
+
+function assert_equal {
+ local lineno=`caller 0 | awk '{print $1}'`
+ local function=`caller 0 | awk '{print $2}'`
+ local msg=$3
+ if [[ "$1" != "$2" ]]; then
+ FAILED_FUNCS+="$function:L$lineno\n"
+ echo "ERROR: $1 != $2 in $function:L$lineno!"
+ echo " $msg"
+ ERROR=1
+ else
+ echo "$function:L$lineno - ok"
+ fi
+}
+
+function report_results {
+ if [[ $ERROR -eq 1 ]]; then
+ echo "Tests FAILED"
+ echo $FAILED_FUNCS
+ exit 1
+ fi
+}
diff --git a/tools/install_prereqs.sh b/tools/install_prereqs.sh
index 9651083..303cc63 100755
--- a/tools/install_prereqs.sh
+++ b/tools/install_prereqs.sh
@@ -8,9 +8,15 @@
#
# -f Force an install run now
-if [[ -n "$1" && "$1" = "-f" ]]; then
- FORCE_PREREQ=1
-fi
+FORCE_PREREQ=0
+
+while getopts ":f" opt; do
+ case $opt in
+ f)
+ FORCE_PREREQ=1
+ ;;
+ esac
+done
# If TOP_DIR is set we're being sourced rather than running stand-alone
# or in a sub-shell
diff --git a/tools/xen/build_xva.sh b/tools/xen/build_xva.sh
index 7c8e620..7002e6e 100755
--- a/tools/xen/build_xva.sh
+++ b/tools/xen/build_xva.sh
@@ -119,9 +119,7 @@
chown -R $STACK_USER /opt/stack
- if su -c "/opt/stack/run.sh" $STACK_USER; then
- touch /var/run/devstack.succeeded
- fi
+ su -c "/opt/stack/run.sh" $STACK_USER
# Update /etc/issue
{
@@ -177,8 +175,19 @@
cat <<EOF >$STAGING_DIR/opt/stack/run.sh
#!/bin/bash
set -eux
-cd /opt/stack/devstack
-./unstack.sh || true
-./stack.sh
+(
+ flock -n 9 || exit 1
+
+ [ -e /opt/stack/runsh.succeeded ] && rm /opt/stack/runsh.succeeded
+ echo \$\$ >> /opt/stack/run_sh.pid
+
+ cd /opt/stack/devstack
+ ./unstack.sh || true
+ ./stack.sh
+
+ # Got to the end - success
+ touch /opt/stack/runsh.succeeded
+ rm /opt/stack/run_sh.pid
+) 9> /opt/stack/.runsh_lock
EOF
chmod 755 $STAGING_DIR/opt/stack/run.sh
diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh
index 3a63473..546ead6 100755
--- a/tools/xen/install_os_domU.sh
+++ b/tools/xen/install_os_domU.sh
@@ -365,25 +365,27 @@
if [ "$WAIT_TILL_LAUNCH" = "1" ] && [ -e ~/.ssh/id_rsa.pub ] && [ "$COPYENV" = "1" ]; then
set +x
- echo "VM Launched - Waiting for devstack to start"
- while ! ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "service devstack status | grep -q running"; do
+ echo "VM Launched - Waiting for run.sh"
+ while ! ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "test -e /opt/stack/run_sh.pid"; do
sleep 10
done
echo -n "devstack service is running, waiting for stack.sh to start logging..."
- while ! ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "test -e /tmp/devstack/log/stack.log"; do
- sleep 10
- done
+ pid=`ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "cat /opt/stack/run_sh.pid"`
+ if [ -n "$SCREEN_LOGDIR" ]; then
+ while ! ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "test -e ${SCREEN_LOGDIR}/stack.log"; do
+ sleep 10
+ done
+
+ ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "tail --pid $pid -n +1 -f ${SCREEN_LOGDIR}/stack.log"
+ else
+ echo -n "SCREEN_LOGDIR not set; just waiting for process $pid to finish"
+ ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "wait $pid"
+ fi
+
set -x
-
- # Watch devstack's output (which doesn't start until stack.sh is running,
- # but wait for run.sh (which starts stack.sh) to exit as that is what
- # hopefully writes the succeeded cookie.
- pid=`ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS pgrep run.sh`
- ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "tail --pid $pid -n +1 -f /tmp/devstack/log/stack.log"
-
# Fail if devstack did not succeed
- ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'test -e /var/run/devstack.succeeded'
+ ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'test -e /opt/stack/runsh.succeeded'
set +x
echo "################################################################################"
@@ -401,7 +403,7 @@
echo ""
echo "ssh into your domU now: 'ssh stack@$OS_VM_MANAGEMENT_ADDRESS' using your password"
echo "and then do: 'sudo service devstack status' to check if devstack is still running."
- echo "Check that /var/run/devstack.succeeded exists"
+ echo "Check that /opt/stack/runsh.succeeded exists"
echo ""
echo "When devstack completes, you can visit the OpenStack Dashboard"
echo "at http://$OS_VM_SERVICES_ADDRESS, and contact other services at the usual ports."
diff --git a/unstack.sh b/unstack.sh
index ea45da9..b8b7f4a 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -6,11 +6,22 @@
# mysql and rabbit are left running as OpenStack code refreshes
# do not require them to be restarted.
#
-# Stop all processes by setting ``UNSTACK_ALL`` or specifying ``--all``
+# Stop all processes by setting ``UNSTACK_ALL`` or specifying ``-a``
# on the command line
+UNSTACK_ALL=""
+
+while getopts ":a" opt; do
+ case $opt in
+ a)
+ UNSTACK_ALL=""
+ ;;
+ esac
+done
+
# Keep track of the current devstack directory.
TOP_DIR=$(cd $(dirname "$0") && pwd)
+FILES=$TOP_DIR/files
# Import common functions
source $TOP_DIR/functions
@@ -19,7 +30,7 @@
source $TOP_DIR/lib/database
# Load local configuration
-source $TOP_DIR/stackrc
+source $TOP_DIR/openrc
# Destination path for service data
DATA_DIR=${DATA_DIR:-${DEST}/data}
@@ -44,6 +55,7 @@
source $TOP_DIR/lib/infra
source $TOP_DIR/lib/oslo
source $TOP_DIR/lib/stackforge
+source $TOP_DIR/lib/lvm
source $TOP_DIR/lib/horizon
source $TOP_DIR/lib/keystone
source $TOP_DIR/lib/glance
@@ -72,10 +84,6 @@
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
GetOSVersion
-if [[ "$1" == "--all" ]]; then
- UNSTACK_ALL=${UNSTACK_ALL:-1}
-fi
-
# Run extras
# ==========
@@ -170,3 +178,5 @@
screen -X -S $SESSION quit
fi
fi
+
+clean_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME