Merge "Cosmetic, comment and text cleanups"

This commit is contained in:
Jenkins 2012-08-31 07:24:41 +00:00 committed by Gerrit Code Review
commit dff797b883
4 changed files with 259 additions and 187 deletions

100
functions
View File

@ -1,7 +1,16 @@
# -*- mode: Shell-script -*-
# functions - Common functions used by DevStack components # functions - Common functions used by DevStack components
# #
# ENABLED_SERVICES is used by is_service_enabled() # The following variables are assumed to be defined by certain functions:
# ``DISTRO``
# ``ENABLED_SERVICES``
# ``EROR_ON_CLONE``
# ``FILES``
# ``GLANCE_HOSTPORT``
# ``OFFLINE``
# ``PIP_DOWNLOAD_CACHE``
# ``RECLONE``
# ``TRACK_DEPENDS``
# ``http_proxy``, ``https_proxy``, ``no_proxy``
# Save trace setting # Save trace setting
@ -9,9 +18,9 @@ XTRACE=$(set +o | grep xtrace)
set +o xtrace set +o xtrace
# Exit 0 if address is in network or 1 if # Exit 0 if address is in network or 1 if address is not in
# address is not in network or netaddr library # network or netaddr library is not installed.
# is not installed. # address_in_net ip-address ip-range
function address_in_net() { function address_in_net() {
python -c " python -c "
import netaddr import netaddr
@ -21,7 +30,8 @@ sys.exit(netaddr.IPAddress('$1') not in netaddr.IPNetwork('$2'))
} }
# apt-get wrapper to set arguments correctly # Wrapper for ``apt-get`` to set cache and proxy environment variables
# Uses globals ``OFFLINE``, ``*_proxy`
# apt_get operation package [package ...] # apt_get operation package [package ...]
function apt_get() { function apt_get() {
[[ "$OFFLINE" = "True" || -z "$@" ]] && return [[ "$OFFLINE" = "True" || -z "$@" ]] && return
@ -88,15 +98,16 @@ function get_field() {
# get_packages() collects a list of package names of any type from the # get_packages() collects a list of package names of any type from the
# prerequisite files in ``files/{apts|pips}``. The list is intended # prerequisite files in ``files/{apts|rpms}``. The list is intended
# to be passed to a package installer such as apt or pip. # to be passed to a package installer such as apt or yum.
# #
# Only packages required for the services in ENABLED_SERVICES will be # Only packages required for the services in ``ENABLED_SERVICES`` will be
# included. Two bits of metadata are recognized in the prerequisite files: # included. Two bits of metadata are recognized in the prerequisite files:
# - ``# NOPRIME`` defers installation to be performed later in stack.sh # - ``# NOPRIME`` defers installation to be performed later in stack.sh
# - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection # - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection
# of the package to the distros listed. The distro names are case insensitive. # of the package to the distros listed. The distro names are case insensitive.
# #
# Uses globals ``DISTRO``, ``ENABLED_SERVICES``
# get_packages dir # get_packages dir
function get_packages() { function get_packages() {
local package_dir=$1 local package_dir=$1
@ -241,6 +252,7 @@ GetOSVersion() {
} }
# git update using reference as a branch. # git update using reference as a branch.
# git_update_branch ref
function git_update_branch() { function git_update_branch() {
GIT_BRANCH=$1 GIT_BRANCH=$1
@ -254,6 +266,7 @@ function git_update_branch() {
# git update using reference as a tag. Be careful editing source at that repo # git update using reference as a tag. Be careful editing source at that repo
# as working copy will be in a detached mode # as working copy will be in a detached mode
# git_update_tag ref
function git_update_tag() { function git_update_tag() {
GIT_TAG=$1 GIT_TAG=$1
@ -289,6 +302,7 @@ function GetDistro() {
# Set global RECLONE=yes to simulate a clone when dest-dir exists # 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 # 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). # does not exist (default is False, meaning the repo will be cloned).
# Uses global ``OFFLINE``
# git_clone remote dest-dir branch # git_clone remote dest-dir branch
function git_clone { function git_clone {
[[ "$OFFLINE" = "True" ]] && return [[ "$OFFLINE" = "True" ]] && return
@ -394,16 +408,20 @@ $option = $value
# is_service_enabled() checks if the service(s) specified as arguments are # is_service_enabled() checks if the service(s) specified as arguments are
# enabled by the user in **ENABLED_SERVICES**. # enabled by the user in ``ENABLED_SERVICES``.
# #
# If there are multiple services specified as arguments the test performs a # Multiple services specified as arguments are ``OR``'ed together; the test
# boolean OR or if any of the services specified on the command line # is a short-circuit boolean, i.e it returns on the first match.
# return true.
# #
# There is a special cases for some 'catch-all' services:: # There are special cases for some 'catch-all' services::
# **nova** returns true if any service enabled start with **n-** # **nova** returns true if any service enabled start with **n-**
# **cinder** returns true if any service enabled start with **c-**
# **ceilometer** returns true if any service enabled start with **ceilometer**
# **glance** returns true if any service enabled start with **g-** # **glance** returns true if any service enabled start with **g-**
# **quantum** returns true if any service enabled start with **q-** # **quantum** returns true if any service enabled start with **q-**
#
# Uses global ``ENABLED_SERVICES``
# is_service_enabled service [service ...]
function is_service_enabled() { function is_service_enabled() {
services=$@ services=$@
for service in ${services}; do for service in ${services}; do
@ -417,7 +435,9 @@ function is_service_enabled() {
return 1 return 1
} }
# remove extra commas from the input string (ENABLED_SERVICES)
# remove extra commas from the input string (i.e. ``ENABLED_SERVICES``)
# _cleanup_service_list service-list
function _cleanup_service_list () { function _cleanup_service_list () {
echo "$1" | sed -e ' echo "$1" | sed -e '
s/,,/,/g; s/,,/,/g;
@ -426,15 +446,17 @@ function _cleanup_service_list () {
' '
} }
# enable_service() adds the services passed as argument to the # enable_service() adds the services passed as argument to the
# **ENABLED_SERVICES** list, if they are not already present. # ``ENABLED_SERVICES`` list, if they are not already present.
# #
# For example: # For example:
#
# enable_service n-vol # enable_service n-vol
# #
# This function does not know about the special cases # This function does not know about the special cases
# for nova, glance, and quantum built into is_service_enabled(). # for nova, glance, and quantum built into is_service_enabled().
# Uses global ``ENABLED_SERVICES``
# enable_service service [service ...]
function enable_service() { function enable_service() {
local tmpsvcs="${ENABLED_SERVICES}" local tmpsvcs="${ENABLED_SERVICES}"
for service in $@; do for service in $@; do
@ -446,15 +468,17 @@ function enable_service() {
disable_negated_services disable_negated_services
} }
# disable_service() removes the services passed as argument to the # disable_service() removes the services passed as argument to the
# **ENABLED_SERVICES** list, if they are present. # ``ENABLED_SERVICES`` list, if they are present.
# #
# For example: # For example:
#
# disable_service n-vol # disable_service n-vol
# #
# This function does not know about the special cases # This function does not know about the special cases
# for nova, glance, and quantum built into is_service_enabled(). # for nova, glance, and quantum built into is_service_enabled().
# Uses global ``ENABLED_SERVICES``
# disable_service service [service ...]
function disable_service() { function disable_service() {
local tmpsvcs=",${ENABLED_SERVICES}," local tmpsvcs=",${ENABLED_SERVICES},"
local service local service
@ -466,17 +490,22 @@ function disable_service() {
ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs") ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs")
} }
# disable_all_services() removes all current services # disable_all_services() removes all current services
# from **ENABLED_SERVICES** to reset the configuration # from ``ENABLED_SERVICES`` to reset the configuration
# before a minimal installation # before a minimal installation
# Uses global ``ENABLED_SERVICES``
# disable_all_services
function disable_all_services() { function disable_all_services() {
ENABLED_SERVICES="" ENABLED_SERVICES=""
} }
# We are looking for services with a - at the beginning to force
# excluding those services. For example if you want to install all the default # Remove all services starting with '-'. For example, to install all default
# services but not nova-volume (n-vol) you can have this set in your localrc : # services except nova-volume (n-vol) set in ``localrc``:
# ENABLED_SERVICES+=",-n-vol" # ENABLED_SERVICES+=",-n-vol"
# Uses global ``ENABLED_SERVICES``
# disable_negated_services
function disable_negated_services() { function disable_negated_services() {
local tmpsvcs="${ENABLED_SERVICES}" local tmpsvcs="${ENABLED_SERVICES}"
local service local service
@ -488,6 +517,7 @@ function disable_negated_services() {
ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs") ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs")
} }
# Distro-agnostic package installer # Distro-agnostic package installer
# install_package package [package ...] # install_package package [package ...]
function install_package() { function install_package() {
@ -513,7 +543,8 @@ function is_set() {
} }
# pip install wrapper to set cache and proxy environment variables # Wrapper for ``pip install`` to set cache and proxy environment variables
# Uses globals ``OFFLINE``, ``PIP_DOWNLOAD_CACHE``, ``TRACK_DEPENDES``, ``*_proxy`
# pip_install package [package ...] # pip_install package [package ...]
function pip_install { function pip_install {
[[ "$OFFLINE" = "True" || -z "$@" ]] && return [[ "$OFFLINE" = "True" || -z "$@" ]] && return
@ -554,8 +585,9 @@ function restart_service() {
} }
# pip install the dependencies of the package before we do the setup.py # ``pip install`` the dependencies of the package before ``setup.py develop``
# develop, so that pip and not distutils process the dependency chain # so pip and not distutils processes the dependency chain
# Uses globals ``TRACK_DEPENDES``, ``*_proxy`
# setup_develop directory # setup_develop directory
function setup_develop() { function setup_develop() {
if [[ $TRACK_DEPENDS = True ]] ; then if [[ $TRACK_DEPENDS = True ]] ; then
@ -606,7 +638,9 @@ function stop_service() {
# Normalize config values to True or False # Normalize config values to True or False
# VAR=`trueorfalse default-value test-value` # Accepts as False: 0 no false False FALSE
# Accepts as True: 1 yes true True TRUE
# VAR=$(trueorfalse default-value test-value)
function trueorfalse() { function trueorfalse() {
local default=$1 local default=$1
local testval=$2 local testval=$2
@ -620,8 +654,8 @@ function trueorfalse() {
# Retrieve an image from a URL and upload into Glance # Retrieve an image from a URL and upload into Glance
# Uses the following variables: # Uses the following variables:
# **FILES** must be set to the cache dir # ``FILES`` must be set to the cache dir
# **GLANCE_HOSTPORT** # ``GLANCE_HOSTPORT``
# upload_image image-url glance-token # upload_image image-url glance-token
function upload_image() { function upload_image() {
local image_url=$1 local image_url=$1
@ -717,7 +751,8 @@ function upload_image() {
} }
# yum wrapper to set arguments correctly # Wrapper for ``yum`` to set proxy environment variables
# Uses globals ``OFFLINE``, ``*_proxy`
# yum_install package [package ...] # yum_install package [package ...]
function yum_install() { function yum_install() {
[[ "$OFFLINE" = "True" ]] && return [[ "$OFFLINE" = "True" ]] && return
@ -731,3 +766,8 @@ function yum_install() {
# Restore xtrace # Restore xtrace
$XTRACE $XTRACE
# Local variables:
# -*- mode: Shell-script -*-
# End:

306
stack.sh
View File

@ -1,8 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# ``stack.sh`` is an opinionated OpenStack developer installation. It # ``stack.sh`` is an opinionated OpenStack developer installation. It
# installs and configures various combinations of **Glance**, **Horizon**, # installs and configures various combinations of **Ceilometer**, **Cinder**,
# **Keystone**, **Nova**, **Quantum**, **Heat** and **Swift** # **Glance**, **Heat**, **Horizon**, **Keystone**, **Nova**, **Quantum**
# and **Swift**
# This script allows you to specify configuration options of what git # This script allows you to specify configuration options of what git
# repositories to use, enabled services, network configuration and various # repositories to use, enabled services, network configuration and various
@ -10,14 +11,14 @@
# shared settings for common resources (mysql, rabbitmq) and build a multi-node # shared settings for common resources (mysql, rabbitmq) and build a multi-node
# developer install. # developer install.
# To keep this script simple we assume you are running on an **Ubuntu 11.10 # To keep this script simple we assume you are running on a recent **Ubuntu**
# Oneiric** or **Ubuntu 12.04 Precise** machine. It should work in a VM or # (11.10 Oneiric or 12.04 Precise) or **Fedora** (F16 or F17) machine. It
# physical server. Additionally we put the list of ``apt`` and ``pip`` # should work in a VM or physical server. Additionally we put the list of
# dependencies and other configuration files in this repo. So start by # ``apt`` and ``rpm`` dependencies and other configuration files in this repo.
# grabbing this script and the dependencies.
# Learn more and get the most recent version at http://devstack.org # Learn more and get the most recent version at http://devstack.org
# Keep track of the devstack directory # Keep track of the devstack directory
TOP_DIR=$(cd $(dirname "$0") && pwd) TOP_DIR=$(cd $(dirname "$0") && pwd)
@ -47,25 +48,31 @@ GetDistro
# MYSQL_USER=hellaroot # MYSQL_USER=hellaroot
# #
# We try to have sensible defaults, so you should be able to run ``./stack.sh`` # We try to have sensible defaults, so you should be able to run ``./stack.sh``
# in most cases. # in most cases. ``localrc`` is not distributed with DevStack and will never
# be overwritten by a DevStack update.
# #
# DevStack distributes ``stackrc`` which contains locations for the OpenStack # DevStack distributes ``stackrc`` which contains locations for the OpenStack
# repositories and branches to configure. ``stackrc`` sources ``localrc`` to # repositories and branches to configure. ``stackrc`` sources ``localrc`` to
# allow you to safely override those settings without being overwritten # allow you to safely override those settings.
# when updating DevStack.
if [[ ! -r $TOP_DIR/stackrc ]]; then if [[ ! -r $TOP_DIR/stackrc ]]; then
echo "ERROR: missing $TOP_DIR/stackrc - did you grab more than just stack.sh?" echo "ERROR: missing $TOP_DIR/stackrc - did you grab more than just stack.sh?"
exit 1 exit 1
fi fi
source $TOP_DIR/stackrc source $TOP_DIR/stackrc
# HTTP and HTTPS proxy servers are supported via the usual environment variables
# ``http_proxy`` and ``https_proxy``. Additionally if you would like to access # Proxy Settings
# to specific server directly and not through the proxy server, you can use # --------------
# ``no_proxy`` environment variable. They can be set in ``localrc`` if necessary
# or on the command line:: # HTTP and HTTPS proxy servers are supported via the usual environment variables [1]
# ``http_proxy``, ``https_proxy`` and ``no_proxy``. They can be set in
# ``localrc`` if necessary or on the command line::
#
# [1] http://www.w3.org/Daemon/User/Proxies/ProxyClients.html
# #
# http_proxy=http://proxy.example.com:3128/ no_proxy=repo.example.net ./stack.sh # http_proxy=http://proxy.example.com:3128/ no_proxy=repo.example.net ./stack.sh
if [[ -n "$http_proxy" ]]; then if [[ -n "$http_proxy" ]]; then
export http_proxy=$http_proxy export http_proxy=$http_proxy
fi fi
@ -98,6 +105,7 @@ if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|f16|f17) ]]; then
fi fi
fi fi
# Disallow qpid on oneiric
if [ "${DISTRO}" = "oneiric" ] && is_service_enabled qpid ; then if [ "${DISTRO}" = "oneiric" ] && is_service_enabled qpid ; then
# Qpid was introduced in precise # Qpid was introduced in precise
echo "You must use Ubuntu Precise or newer for Qpid support." echo "You must use Ubuntu Precise or newer for Qpid support."
@ -114,17 +122,15 @@ fi
# ``stack.sh`` keeps function libraries here # ``stack.sh`` keeps function libraries here
# Make sure ``$TOP_DIR/lib`` directory is present # Make sure ``$TOP_DIR/lib`` directory is present
if [ ! -d $TOP_DIR/lib ]; then if [ ! -d $TOP_DIR/lib ]; then
echo "ERROR: missing devstack/lib - did you grab more than just stack.sh?" echo "ERROR: missing devstack/lib"
exit 1 exit 1
fi fi
# stack.sh keeps the list of ``apt`` and ``pip`` dependencies in external # ``stack.sh`` keeps the list of ``apt`` and ``rpm`` dependencies and config
# files, along with config templates and other useful files. You can find these # templates and other useful files in the ``files`` subdirectory
# in the ``files`` directory (next to this script). We will reference this
# directory using the ``FILES`` variable in this script.
FILES=$TOP_DIR/files FILES=$TOP_DIR/files
if [ ! -d $FILES ]; then if [ ! -d $FILES ]; then
echo "ERROR: missing devstack/files - did you grab more than just stack.sh?" echo "ERROR: missing devstack/files"
exit 1 exit 1
fi fi
@ -132,7 +138,7 @@ fi
if type -p screen >/dev/null && screen -ls | egrep -q "[0-9].stack"; then if type -p screen >/dev/null && screen -ls | egrep -q "[0-9].stack"; then
echo "You are already running a stack.sh session." echo "You are already running a stack.sh session."
echo "To rejoin this session type 'screen -x stack'." echo "To rejoin this session type 'screen -x stack'."
echo "To destroy this session, kill the running screen." echo "To destroy this session, type './unstack.sh'."
exit 1 exit 1
fi fi
@ -142,8 +148,12 @@ if is_service_enabled cinder && is_service_enabled n-vol; then
exit 1 exit 1
fi fi
# OpenStack is designed to be run as a regular user (Horizon will fail to run
# as root, since apache refused to startup serve content from root user). If # root Access
# -----------
# OpenStack is designed to be run as a non-root user; Horizon will fail to run
# as **root** since Apache will not serve content from **root** user). If
# ``stack.sh`` is run as **root**, it automatically creates a **stack** user with # ``stack.sh`` is run as **root**, it automatically creates a **stack** user with
# sudo privileges and runs as that user. # sudo privileges and runs as that user.
@ -153,8 +163,7 @@ if [[ $EUID -eq 0 ]]; then
echo "In $ROOTSLEEP seconds, we will create a user 'stack' and run as that user" echo "In $ROOTSLEEP seconds, we will create a user 'stack' and run as that user"
sleep $ROOTSLEEP sleep $ROOTSLEEP
# since this script runs as a normal user, we need to give that user # Give the non-root user the ability to run as **root** via ``sudo``
# ability to run sudo
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
dpkg -l sudo || apt_get update && install_package sudo dpkg -l sudo || apt_get update && install_package sudo
else else
@ -170,7 +179,7 @@ if [[ $EUID -eq 0 ]]; then
fi fi
echo "Giving stack user passwordless sudo priviledges" echo "Giving stack user passwordless sudo priviledges"
# some uec images sudoers does not have a '#includedir'. add one. # UEC images ``/etc/sudoers`` does not have a ``#includedir``, add one
grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers || grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers ||
echo "#includedir /etc/sudoers.d" >> /etc/sudoers echo "#includedir /etc/sudoers.d" >> /etc/sudoers
( umask 226 && echo "stack ALL=(ALL) NOPASSWD:ALL" \ ( umask 226 && echo "stack ALL=(ALL) NOPASSWD:ALL" \
@ -187,7 +196,7 @@ if [[ $EUID -eq 0 ]]; then
fi fi
exit 1 exit 1
else else
# We're not root, make sure sudo is available # We're not **root**, make sure ``sudo`` is available
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
CHECK_SUDO_CMD="dpkg -l sudo" CHECK_SUDO_CMD="dpkg -l sudo"
else else
@ -195,7 +204,7 @@ else
fi fi
$CHECK_SUDO_CMD || die "Sudo is required. Re-run stack.sh as root ONE TIME ONLY to set up sudo." $CHECK_SUDO_CMD || die "Sudo is required. Re-run stack.sh as root ONE TIME ONLY to set up sudo."
# UEC images /etc/sudoers does not have a '#includedir'. add one. # UEC images ``/etc/sudoers`` does not have a ``#includedir``, add one
sudo grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers || sudo grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers ||
echo "#includedir /etc/sudoers.d" | sudo tee -a /etc/sudoers echo "#includedir /etc/sudoers.d" | sudo tee -a /etc/sudoers
@ -219,14 +228,14 @@ if [ ! -w $DEST ]; then
sudo chown `whoami` $DEST sudo chown `whoami` $DEST
fi fi
# Set True to configure ``stack.sh`` to run cleanly without Internet access. # Set ``OFFLINE`` to ``True`` to configure ``stack.sh`` to run cleanly without
# ``stack.sh`` must have been previously run with Internet access to install # Internet access. ``stack.sh`` must have been previously run with Internet
# prerequisites and initialize ``$DEST``. # access to install prerequisites and fetch repositories.
OFFLINE=`trueorfalse False $OFFLINE` OFFLINE=`trueorfalse False $OFFLINE`
# Set True to configure ``stack.sh`` to exit with an error code if it is asked # Set ``ERROR_ON_CLONE`` to ``True`` to configure ``stack.sh`` to exit if
# to clone any git repositories. If devstack is used in a testing environment, # the destination git repository does not exist during the ``git_clone``
# this may be used to ensure that the correct code is being tested. # operation.
ERROR_ON_CLONE=`trueorfalse False $ERROR_ON_CLONE` ERROR_ON_CLONE=`trueorfalse False $ERROR_ON_CLONE`
# Destination path for service data # Destination path for service data
@ -235,15 +244,15 @@ sudo mkdir -p $DATA_DIR
sudo chown `whoami` $DATA_DIR sudo chown `whoami` $DATA_DIR
# Projects # Configure Projects
# -------- # ==================
# Get project function libraries # Get project function libraries
source $TOP_DIR/lib/cinder source $TOP_DIR/lib/cinder
source $TOP_DIR/lib/ceilometer source $TOP_DIR/lib/ceilometer
source $TOP_DIR/lib/heat source $TOP_DIR/lib/heat
# Set the destination directories for openstack projects # Set the destination directories for OpenStack projects
NOVA_DIR=$DEST/nova NOVA_DIR=$DEST/nova
HORIZON_DIR=$DEST/horizon HORIZON_DIR=$DEST/horizon
GLANCE_DIR=$DEST/glance GLANCE_DIR=$DEST/glance
@ -273,17 +282,19 @@ Q_AUTH_STRATEGY=${Q_AUTH_STRATEGY:-keystone}
# Use namespace or not # Use namespace or not
Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True} Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True}
# Name of the lvm volume group to use/create for iscsi volumes # Name of the LVM volume group to use/create for iscsi volumes
VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes} VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes}
VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-} VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
INSTANCE_NAME_PREFIX=${INSTANCE_NAME_PREFIX:-instance-} INSTANCE_NAME_PREFIX=${INSTANCE_NAME_PREFIX:-instance-}
# Nova supports pluggable schedulers. ``FilterScheduler`` should work in most # Nova supports pluggable schedulers. The default ``FilterScheduler``
# cases. # should work in most cases.
SCHEDULER=${SCHEDULER:-nova.scheduler.filter_scheduler.FilterScheduler} SCHEDULER=${SCHEDULER:-nova.scheduler.filter_scheduler.FilterScheduler}
# Set fixed and floating range here so we can make sure not to use addresses # 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 # 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 eith of these address ranges internally.
FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24} FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24}
FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.224/28} FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.224/28}
@ -294,10 +305,12 @@ if [ -z "$HOST_IP" -o "$HOST_IP" == "dhcp" ]; then
HOST_IP="" HOST_IP=""
HOST_IPS=`LC_ALL=C ip -f inet addr show ${HOST_IP_IFACE} | awk '/inet/ {split($2,parts,"/"); print parts[1]}'` HOST_IPS=`LC_ALL=C ip -f inet addr show ${HOST_IP_IFACE} | awk '/inet/ {split($2,parts,"/"); print parts[1]}'`
for IP in $HOST_IPS; do for IP in $HOST_IPS; do
# Attempt to filter out ip addresses that are part of the fixed and # Attempt to filter out IP addresses that are part of the fixed and
# floating range. Note that this method only works if the 'netaddr' # floating range. Note that this method only works if the ``netaddr``
# python library is installed. If it is not installed, an error # python library is installed. If it is not installed, an error
# will be printed and the first ip from the interface will be used. # will be printed and the first IP from the interface will be used.
# If that is not correct set ``HOST_IP`` in ``localrc`` to the correct
# address.
if ! (address_in_net $IP $FIXED_RANGE || address_in_net $IP $FLOATING_RANGE); then if ! (address_in_net $IP $FIXED_RANGE || address_in_net $IP $FLOATING_RANGE); then
HOST_IP=$IP HOST_IP=$IP
break; break;
@ -318,7 +331,7 @@ SYSLOG=`trueorfalse False $SYSLOG`
SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP} SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
SYSLOG_PORT=${SYSLOG_PORT:-516} SYSLOG_PORT=${SYSLOG_PORT:-516}
# Use color for logging output # Use color for logging output (only available if syslog is not used)
LOG_COLOR=`trueorfalse True $LOG_COLOR` LOG_COLOR=`trueorfalse True $LOG_COLOR`
# Service startup timeout # Service startup timeout
@ -374,7 +387,7 @@ function read_password {
if [ "$VIRT_DRIVER" = 'xenserver' ]; then if [ "$VIRT_DRIVER" = 'xenserver' ]; then
PUBLIC_INTERFACE_DEFAULT=eth3 PUBLIC_INTERFACE_DEFAULT=eth3
# allow build_domU.sh to specify the flat network bridge via kernel args # Allow ``build_domU.sh`` to specify the flat network bridge via kernel args
FLAT_NETWORK_BRIDGE_DEFAULT=$(grep -o 'flat_network_bridge=[[:alnum:]]*' /proc/cmdline | cut -d= -f 2 | sort -u) FLAT_NETWORK_BRIDGE_DEFAULT=$(grep -o 'flat_network_bridge=[[:alnum:]]*' /proc/cmdline | cut -d= -f 2 | sort -u)
GUEST_INTERFACE_DEFAULT=eth1 GUEST_INTERFACE_DEFAULT=eth1
else else
@ -396,19 +409,19 @@ VLAN_INTERFACE=${VLAN_INTERFACE:-$GUEST_INTERFACE_DEFAULT}
TEST_FLOATING_POOL=${TEST_FLOATING_POOL:-test} TEST_FLOATING_POOL=${TEST_FLOATING_POOL:-test}
TEST_FLOATING_RANGE=${TEST_FLOATING_RANGE:-192.168.253.0/29} TEST_FLOATING_RANGE=${TEST_FLOATING_RANGE:-192.168.253.0/29}
# **MULTI_HOST** is a mode where each compute node runs its own network node. This # ``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 # allows network operations and routing for a VM to occur on the server that is
# running the VM - removing a SPOF and bandwidth bottleneck. # running the VM - removing a SPOF and bandwidth bottleneck.
MULTI_HOST=`trueorfalse False $MULTI_HOST` MULTI_HOST=`trueorfalse False $MULTI_HOST`
# If you are using FlatDHCP on multiple hosts, set the ``FLAT_INTERFACE`` # If you are using the FlatDHCP network mode on multiple hosts, set the
# variable but make sure that the interface doesn't already have an # ``FLAT_INTERFACE`` variable but make sure that the interface doesn't already
# ip or you risk breaking things. # have an IP or you risk breaking things.
# #
# **DHCP Warning**: If your flat interface device uses DHCP, there will be a # **DHCP Warning**: If your flat interface device uses DHCP, there will be a
# hiccup while the network is moved from the flat interface to the flat network # hiccup while the network is moved from the flat interface to the flat network
# bridge. This will happen when you launch your first instance. Upon launch # bridge. This will happen when you launch your first instance. Upon launch
# you will lose all connectivity to the node, and the vm launch will probably # you will lose all connectivity to the node, and the VM launch will probably
# fail. # fail.
# #
# If you are running on a single node and don't need to access the VMs from # If you are running on a single node and don't need to access the VMs from
@ -431,6 +444,7 @@ FLAT_INTERFACE=${FLAT_INTERFACE:-$GUEST_INTERFACE_DEFAULT}
# #
# With Quantum networking the NET_MAN variable is ignored. # With Quantum networking the NET_MAN variable is ignored.
# MySQL & (RabbitMQ or Qpid) # MySQL & (RabbitMQ or Qpid)
# -------------------------- # --------------------------
@ -446,7 +460,7 @@ MYSQL_HOST=${MYSQL_HOST:-localhost}
MYSQL_USER=${MYSQL_USER:-root} MYSQL_USER=${MYSQL_USER:-root}
read_password MYSQL_PASSWORD "ENTER A PASSWORD TO USE FOR MYSQL." read_password MYSQL_PASSWORD "ENTER A PASSWORD TO USE FOR MYSQL."
# NOTE: Don't specify /db in this string so we can use it for multiple services # NOTE: Don't specify ``/db`` in this string so we can use it for multiple services
BASE_SQL_CONN=${BASE_SQL_CONN:-mysql://$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST} BASE_SQL_CONN=${BASE_SQL_CONN:-mysql://$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST}
# Rabbit connection info # Rabbit connection info
@ -455,6 +469,10 @@ if is_service_enabled rabbit; then
read_password RABBIT_PASSWORD "ENTER A PASSWORD TO USE FOR RABBIT." read_password RABBIT_PASSWORD "ENTER A PASSWORD TO USE FOR RABBIT."
fi fi
# Glance
# ------
# Glance connection info. Note the port must be specified. # Glance connection info. Note the port must be specified.
GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$SERVICE_HOST:9292} GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$SERVICE_HOST:9292}
@ -464,19 +482,17 @@ GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$SERVICE_HOST:9292}
# TODO: add logging to different location. # TODO: add logging to different location.
# By default the location of swift drives and objects is located inside # Set ``SWIFT_DATA_DIR`` to the location of swift drives and objects.
# the swift source directory. SWIFT_DATA_DIR variable allow you to redefine # Default is the common DevStack data directory.
# this.
SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DEST}/data/swift} SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DEST}/data/swift}
# We are going to have the configuration files inside the source # Set ``SWIFT_CONFIG_DIR`` to the location of the configuration files.
# directory, change SWIFT_CONFIG_DIR if you want to adjust that. # Default is ``/etc/swift``.
SWIFT_CONFIG_DIR=${SWIFT_CONFIG_DIR:-/etc/swift} SWIFT_CONFIG_DIR=${SWIFT_CONFIG_DIR:-/etc/swift}
# DevStack will create a loop-back disk formatted as XFS to store the # DevStack will create a loop-back disk formatted as XFS to store the
# swift data. By default the disk size is 1 gigabyte. The variable # swift data. Set ``SWIFT_LOOPBACK_DISK_SIZE`` to the disk size in bytes.
# SWIFT_LOOPBACK_DISK_SIZE specified in bytes allow you to change # Default is 1 gigabyte.
# that.
SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000} SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
# The ring uses a configurable number of bits from a paths MD5 hash as # The ring uses a configurable number of bits from a paths MD5 hash as
@ -489,7 +505,7 @@ SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
# By default we define 9 for the partition count (which mean 512). # By default we define 9 for the partition count (which mean 512).
SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9} SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9}
# This variable allows you to configure how many replicas you want to be # Set ``SWIFT_REPLICAS`` to configure how many replicas are to be
# configured for your Swift cluster. By default the three replicas would need a # configured for your Swift cluster. By default the three replicas would need a
# bit of IO and Memory on a VM you may want to lower that to 1 if you want to do # bit of IO and Memory on a VM you may want to lower that to 1 if you want to do
# only some quick testing. # only some quick testing.
@ -514,8 +530,8 @@ S3_SERVICE_PORT=${S3_SERVICE_PORT:-3333}
# Keystone # Keystone
# -------- # --------
# Service Token - Openstack components need to have an admin token # The ``SERVICE_TOKEN`` is used to bootstrap the Keystone database. It is
# to validate user tokens. # just a string and is not a 'real' Keystone token.
read_password SERVICE_TOKEN "ENTER A SERVICE_TOKEN TO USE FOR THE SERVICE ADMIN TOKEN." read_password SERVICE_TOKEN "ENTER A SERVICE_TOKEN TO USE FOR THE SERVICE ADMIN TOKEN."
# Services authenticate to Identity with servicename/SERVICE_PASSWORD # Services authenticate to Identity with servicename/SERVICE_PASSWORD
read_password SERVICE_PASSWORD "ENTER A SERVICE_PASSWORD TO USE FOR THE SERVICE AUTHENTICATION." read_password SERVICE_PASSWORD "ENTER A SERVICE_PASSWORD TO USE FOR THE SERVICE AUTHENTICATION."
@ -547,10 +563,10 @@ APACHE_GROUP=${APACHE_GROUP:-$APACHE_USER}
# Log files # Log files
# --------- # ---------
# Set up logging for stack.sh # Set up logging for ``stack.sh``
# Set LOGFILE to turn on logging # Set ``LOGFILE`` to turn on logging
# We append '.xxxxxxxx' to the given name to maintain history # Append '.xxxxxxxx' to the given name to maintain history
# where xxxxxxxx is a representation of the date the file was created # where 'xxxxxxxx' is a representation of the date the file was created
if [[ -n "$LOGFILE" || -n "$SCREEN_LOGDIR" ]]; then if [[ -n "$LOGFILE" || -n "$SCREEN_LOGDIR" ]]; then
LOGDAYS=${LOGDAYS:-7} LOGDAYS=${LOGDAYS:-7}
TIMESTAMP_FORMAT=${TIMESTAMP_FORMAT:-"%F-%H%M%S"} TIMESTAMP_FORMAT=${TIMESTAMP_FORMAT:-"%F-%H%M%S"}
@ -558,7 +574,7 @@ if [[ -n "$LOGFILE" || -n "$SCREEN_LOGDIR" ]]; then
fi fi
if [[ -n "$LOGFILE" ]]; then if [[ -n "$LOGFILE" ]]; then
# First clean up old log files. Use the user-specified LOGFILE # First clean up old log files. Use the user-specified ``LOGFILE``
# as the template to search for, appending '.*' to match the date # as the template to search for, appending '.*' to match the date
# we added on earlier runs. # we added on earlier runs.
LOGDIR=$(dirname "$LOGFILE") LOGDIR=$(dirname "$LOGFILE")
@ -575,11 +591,11 @@ if [[ -n "$LOGFILE" ]]; then
fi fi
# Set up logging of screen windows # Set up logging of screen windows
# Set SCREEN_LOGDIR to turn on logging of screen windows to the # Set ``SCREEN_LOGDIR`` to turn on logging of screen windows to the
# directory specified in SCREEN_LOGDIR, we will log to the the file # directory specified in ``SCREEN_LOGDIR``, we will log to the the file
# screen-$SERVICE_NAME-$TIMESTAMP.log in that dir and have a link # ``screen-$SERVICE_NAME-$TIMESTAMP.log`` in that dir and have a link
# screen-$SERVICE_NAME.log to the latest log file. # ``screen-$SERVICE_NAME.log`` to the latest log file.
# Logs are kept for as long specified in LOGDAYS. # Logs are kept for as long specified in ``LOGDAYS``.
if [[ -n "$SCREEN_LOGDIR" ]]; then if [[ -n "$SCREEN_LOGDIR" ]]; then
# We make sure the directory is created. # We make sure the directory is created.
@ -591,8 +607,11 @@ if [[ -n "$SCREEN_LOGDIR" ]]; then
fi fi
fi fi
# So that errors don't compound we exit on any errors so you see only the
# first error that occurred. # Set Up Script Execution
# -----------------------
# Exit on any errors so that errors don't compound
trap failed ERR trap failed ERR
failed() { failed() {
local r=$? local r=$?
@ -609,7 +628,7 @@ set -o xtrace
# Install Packages # Install Packages
# ================ # ================
# Openstack uses a fair number of other projects. # OpenStack uses a fair number of other projects.
# Install package requirements # Install package requirements
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
@ -650,7 +669,7 @@ mysql-server-5.1 mysql-server/start_on_boot boolean true
MYSQL_PRESEED MYSQL_PRESEED
fi fi
# while ``.my.cnf`` is not needed for openstack to function, it is useful # while ``.my.cnf`` is not needed for OpenStack to function, it is useful
# as it allows you to access the mysql databases via ``mysql nova`` instead # as it allows you to access the mysql databases via ``mysql nova`` instead
# of having to specify the username/password each time. # of having to specify the username/password each time.
if [[ ! -e $HOME/.my.cnf ]]; then if [[ ! -e $HOME/.my.cnf ]]; then
@ -702,8 +721,6 @@ fi
if is_service_enabled n-cpu; then if is_service_enabled n-cpu; then
# Virtualization Configuration
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
LIBVIRT_PKG_NAME=libvirt-bin LIBVIRT_PKG_NAME=libvirt-bin
else else
@ -746,7 +763,10 @@ fi
# Install python requirements # Install python requirements
pip_install $(get_packages $FILES/pips | sort -u) pip_install $(get_packages $FILES/pips | sort -u)
# Check out OpenStack sources
# Check Out Source
# ----------------
git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH
# Check out the client libs that are used most # Check out the client libs that are used most
@ -799,6 +819,7 @@ if is_service_enabled ceilometer; then
install_ceilometer install_ceilometer
fi fi
# Initialization # Initialization
# ============== # ==============
@ -822,6 +843,7 @@ if is_service_enabled g-api n-api; then
fi fi
# Do this _after_ glance is installed to override the old binary # Do this _after_ glance is installed to override the old binary
# TODO(dtroyer): figure out when this is no longer necessary
setup_develop $GLANCECLIENT_DIR setup_develop $GLANCECLIENT_DIR
setup_develop $NOVA_DIR setup_develop $NOVA_DIR
@ -848,6 +870,7 @@ if [[ $TRACK_DEPENDS = True ]] ; then
exit 0 exit 0
fi fi
# Syslog # Syslog
# ------ # ------
@ -889,10 +912,9 @@ fi
# Mysql # Mysql
# ----- # -----
if is_service_enabled mysql; then if is_service_enabled mysql; then
#start mysql-server # Start mysql-server
if [[ "$os_PACKAGE" = "rpm" ]]; then if [[ "$os_PACKAGE" = "rpm" ]]; then
# RPM doesn't start the service # RPM doesn't start the service
start_service mysqld start_service mysqld
@ -1015,7 +1037,8 @@ if is_service_enabled horizon; then
APACHE_CONF=conf.d/horizon.conf APACHE_CONF=conf.d/horizon.conf
sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
fi fi
## Configure apache to run horizon
# Configure apache to run horizon
sudo sh -c "sed -e \" sudo sh -c "sed -e \"
s,%USER%,$APACHE_USER,g; s,%USER%,$APACHE_USER,g;
s,%GROUP%,$APACHE_GROUP,g; s,%GROUP%,$APACHE_GROUP,g;
@ -1023,6 +1046,7 @@ if is_service_enabled horizon; then
s,%APACHE_NAME%,$APACHE_NAME,g; s,%APACHE_NAME%,$APACHE_NAME,g;
s,%DEST%,$DEST,g; s,%DEST%,$DEST,g;
\" $FILES/apache-horizon.template >/etc/$APACHE_NAME/$APACHE_CONF" \" $FILES/apache-horizon.template >/etc/$APACHE_NAME/$APACHE_CONF"
restart_service $APACHE_NAME restart_service $APACHE_NAME
fi fi
@ -1106,7 +1130,7 @@ fi
# ------- # -------
if is_service_enabled quantum; then if is_service_enabled quantum; then
# Put config files in /etc/quantum for everyone to find # Put config files in ``/etc/quantum`` for everyone to find
if [[ ! -d /etc/quantum ]]; then if [[ ! -d /etc/quantum ]]; then
sudo mkdir -p /etc/quantum sudo mkdir -p /etc/quantum
fi fi
@ -1127,7 +1151,7 @@ if is_service_enabled quantum; then
exit 1 exit 1
fi fi
# If needed, move config file from $QUANTUM_DIR/etc/quantum to /etc/quantum # If needed, move config file from ``$QUANTUM_DIR/etc/quantum`` to ``/etc/quantum``
mkdir -p /$Q_PLUGIN_CONF_PATH mkdir -p /$Q_PLUGIN_CONF_PATH
Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
cp $QUANTUM_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE cp $QUANTUM_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE
@ -1265,10 +1289,11 @@ screen_it q-agt "sudo python $AGENT_BINARY --config-file $Q_CONF_FILE --config-f
# Start up the quantum agent # Start up the quantum agent
screen_it q-dhcp "sudo python $AGENT_DHCP_BINARY --config-file $Q_CONF_FILE --config-file=$Q_DHCP_CONF_FILE" screen_it q-dhcp "sudo python $AGENT_DHCP_BINARY --config-file $Q_CONF_FILE --config-file=$Q_DHCP_CONF_FILE"
# Nova # Nova
# ---- # ----
# Put config files in /etc/nova for everyone to find # Put config files in ``/etc/nova`` for everyone to find
NOVA_CONF_DIR=/etc/nova NOVA_CONF_DIR=/etc/nova
if [[ ! -d $NOVA_CONF_DIR ]]; then if [[ ! -d $NOVA_CONF_DIR ]]; then
sudo mkdir -p $NOVA_CONF_DIR sudo mkdir -p $NOVA_CONF_DIR
@ -1278,7 +1303,7 @@ sudo chown `whoami` $NOVA_CONF_DIR
cp -p $NOVA_DIR/etc/nova/policy.json $NOVA_CONF_DIR cp -p $NOVA_DIR/etc/nova/policy.json $NOVA_CONF_DIR
# If Nova ships the new rootwrap filters files, deploy them # If Nova ships the new rootwrap filters files, deploy them
# (owned by root) and add a parameter to $NOVA_ROOTWRAP # (owned by root) and add a parameter to ``$NOVA_ROOTWRAP``
ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP" ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP"
if [[ -d $NOVA_DIR/etc/nova/rootwrap.d ]]; then if [[ -d $NOVA_DIR/etc/nova/rootwrap.d ]]; then
# Wipe any existing rootwrap.d files first # Wipe any existing rootwrap.d files first
@ -1351,7 +1376,7 @@ if is_service_enabled n-cpu; then
# Force IP forwarding on, just on case # Force IP forwarding on, just on case
sudo sysctl -w net.ipv4.ip_forward=1 sudo sysctl -w net.ipv4.ip_forward=1
# attempt to load modules: network block device - used to manage qcow images # Attempt to load modules: network block device - used to manage qcow images
sudo modprobe nbd || true sudo modprobe nbd || true
# Check for kvm (hardware based virtualization). If unable to initialize # Check for kvm (hardware based virtualization). If unable to initialize
@ -1415,9 +1440,11 @@ ResultActive=yes
EOF' EOF'
LIBVIRT_DAEMON=libvirtd LIBVIRT_DAEMON=libvirtd
fi fi
# The user that nova runs as needs to be member of libvirtd group otherwise
# The user that nova runs as needs to be member of **libvirtd** group otherwise
# nova-compute will be unable to use libvirt. # nova-compute will be unable to use libvirt.
sudo usermod -a -G libvirtd `whoami` sudo usermod -a -G libvirtd `whoami`
# libvirt detects various settings on startup, as we potentially changed # libvirt detects various settings on startup, as we potentially changed
# the system configuration (modules, filesystems), we need to restart # the system configuration (modules, filesystems), we need to restart
# libvirt to detect those changes. # libvirt to detect those changes.
@ -1475,17 +1502,17 @@ fi
if is_service_enabled swift; then if is_service_enabled swift; then
# We make sure to kill all swift processes first # Make sure to kill all swift processes first
swift-init all stop || true swift-init all stop || true
# We first do a bit of setup by creating the directories and # First do a bit of setup by creating the directories and
# changing the permissions so we can run it as our user. # changing the permissions so we can run it as our user.
USER_GROUP=$(id -g) USER_GROUP=$(id -g)
sudo mkdir -p ${SWIFT_DATA_DIR}/drives sudo mkdir -p ${SWIFT_DATA_DIR}/drives
sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_DIR} sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_DIR}
# We then create a loopback disk and format it to XFS. # Create a loopback disk and format it to XFS.
if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
sudo umount ${SWIFT_DATA_DIR}/drives/sdb1 sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
@ -1498,24 +1525,22 @@ if is_service_enabled swift; then
dd if=/dev/zero of=${SWIFT_DATA_DIR}/drives/images/swift.img \ dd if=/dev/zero of=${SWIFT_DATA_DIR}/drives/images/swift.img \
bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE} bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE}
fi fi
# Make a fresh XFS filesystem # Make a fresh XFS filesystem
mkfs.xfs -f -i size=1024 ${SWIFT_DATA_DIR}/drives/images/swift.img mkfs.xfs -f -i size=1024 ${SWIFT_DATA_DIR}/drives/images/swift.img
# After the drive being created we mount the disk with a few mount # Mount the disk with mount options to make it as efficient as possible
# options to make it most efficient as possible for swift.
mkdir -p ${SWIFT_DATA_DIR}/drives/sdb1 mkdir -p ${SWIFT_DATA_DIR}/drives/sdb1
if ! egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then if ! egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8 \ sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8 \
${SWIFT_DATA_DIR}/drives/images/swift.img ${SWIFT_DATA_DIR}/drives/sdb1 ${SWIFT_DATA_DIR}/drives/images/swift.img ${SWIFT_DATA_DIR}/drives/sdb1
fi fi
# We then create link to that mounted location so swift would know # Create a link to the above mount
# where to go.
for x in $(seq ${SWIFT_REPLICAS}); do for x in $(seq ${SWIFT_REPLICAS}); do
sudo ln -sf ${SWIFT_DATA_DIR}/drives/sdb1/$x ${SWIFT_DATA_DIR}/$x; done sudo ln -sf ${SWIFT_DATA_DIR}/drives/sdb1/$x ${SWIFT_DATA_DIR}/$x; done
# We now have to emulate a few different servers into one we # Create all of the directories needed to emulate a few different servers
# create all the directories needed for swift
for x in $(seq ${SWIFT_REPLICAS}); do for x in $(seq ${SWIFT_REPLICAS}); do
drive=${SWIFT_DATA_DIR}/drives/sdb1/${x} drive=${SWIFT_DATA_DIR}/drives/sdb1/${x}
node=${SWIFT_DATA_DIR}/${x}/node node=${SWIFT_DATA_DIR}/${x}/node
@ -1531,7 +1556,7 @@ if is_service_enabled swift; then
sudo chown -R $USER: ${SWIFT_CONFIG_DIR} /var/run/swift sudo chown -R $USER: ${SWIFT_CONFIG_DIR} /var/run/swift
if [[ "$SWIFT_CONFIG_DIR" != "/etc/swift" ]]; then if [[ "$SWIFT_CONFIG_DIR" != "/etc/swift" ]]; then
# Some swift tools are hard-coded to use /etc/swift and are apparenty not going to be fixed. # Some swift tools are hard-coded to use ``/etc/swift`` and are apparenty not going to be fixed.
# Create a symlink if the config dir is moved # Create a symlink if the config dir is moved
sudo ln -sf ${SWIFT_CONFIG_DIR} /etc/swift sudo ln -sf ${SWIFT_CONFIG_DIR} /etc/swift
fi fi
@ -1622,9 +1647,8 @@ EOF
cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONFIG_DIR}/swift.conf cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONFIG_DIR}/swift.conf
iniset ${SWIFT_CONFIG_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH} iniset ${SWIFT_CONFIG_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH}
# We need to generate a object/account/proxy configuration # This function generates an object/account/proxy configuration
# emulating 4 nodes on different ports we have a little function # emulating 4 nodes on different ports
# that help us doing that.
function generate_swift_configuration() { function generate_swift_configuration() {
local server_type=$1 local server_type=$1
local bind_port=$2 local bind_port=$2
@ -1667,8 +1691,8 @@ EOF
generate_swift_configuration container 6011 2 generate_swift_configuration container 6011 2
generate_swift_configuration account 6012 2 generate_swift_configuration account 6012 2
# We have some specific configuration for swift for rsyslog. See # Specific configuration for swift for rsyslog. See
# the file /etc/rsyslog.d/10-swift.conf for more info. # ``/etc/rsyslog.d/10-swift.conf`` for more info.
swift_log_dir=${SWIFT_DATA_DIR}/logs swift_log_dir=${SWIFT_DATA_DIR}/logs
rm -rf ${swift_log_dir} rm -rf ${swift_log_dir}
mkdir -p ${swift_log_dir}/hourly mkdir -p ${swift_log_dir}/hourly
@ -1709,7 +1733,7 @@ EOF
} && popd >/dev/null } && popd >/dev/null
# We then can start rsync. # Start rsync
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
sudo /etc/init.d/rsync restart || : sudo /etc/init.d/rsync restart || :
else else
@ -1762,7 +1786,7 @@ elif is_service_enabled n-vol; then
sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
# Clean out existing volumes # Clean out existing volumes
for lv in `sudo lvs --noheadings -o lv_name $VOLUME_GROUP`; do for lv in `sudo lvs --noheadings -o lv_name $VOLUME_GROUP`; do
# VOLUME_NAME_PREFIX prefixes the LVs we want # ``VOLUME_NAME_PREFIX`` prefixes the LVs we want
if [[ "${lv#$VOLUME_NAME_PREFIX}" != "$lv" ]]; then if [[ "${lv#$VOLUME_NAME_PREFIX}" != "$lv" ]]; then
sudo lvremove -f $VOLUME_GROUP/$lv sudo lvremove -f $VOLUME_GROUP/$lv
fi fi
@ -1798,10 +1822,10 @@ function add_nova_opt {
echo "$1" >> $NOVA_CONF_DIR/$NOVA_CONF echo "$1" >> $NOVA_CONF_DIR/$NOVA_CONF
} }
# Remove legacy nova.conf # Remove legacy ``nova.conf``
rm -f $NOVA_DIR/bin/nova.conf rm -f $NOVA_DIR/bin/nova.conf
# (re)create nova.conf # (Re)create ``nova.conf``
rm -f $NOVA_CONF_DIR/$NOVA_CONF rm -f $NOVA_CONF_DIR/$NOVA_CONF
add_nova_opt "[DEFAULT]" add_nova_opt "[DEFAULT]"
add_nova_opt "verbose=True" add_nova_opt "verbose=True"
@ -1911,13 +1935,13 @@ if is_service_enabled cinder; then
add_nova_opt "volume_api_class=nova.volume.cinder.API" add_nova_opt "volume_api_class=nova.volume.cinder.API"
fi fi
# Provide some transition from EXTRA_FLAGS to EXTRA_OPTS # Provide some transition from ``EXTRA_FLAGS`` to ``EXTRA_OPTS``
if [[ -z "$EXTRA_OPTS" && -n "$EXTRA_FLAGS" ]]; then if [[ -z "$EXTRA_OPTS" && -n "$EXTRA_FLAGS" ]]; then
EXTRA_OPTS=$EXTRA_FLAGS EXTRA_OPTS=$EXTRA_FLAGS
fi fi
# You can define extra nova conf flags by defining the array EXTRA_OPTS, # Define extra nova conf flags by defining the array ``EXTRA_OPTS``.
# For Example: EXTRA_OPTS=(foo=true bar=2) # For Example: ``EXTRA_OPTS=(foo=true bar=2)``
for I in "${EXTRA_OPTS[@]}"; do for I in "${EXTRA_OPTS[@]}"; do
# Attempt to convert flags to options # Attempt to convert flags to options
add_nova_opt ${I//--} add_nova_opt ${I//--}
@ -1954,42 +1978,46 @@ fi
# Nova Database # Nova Database
# ~~~~~~~~~~~~~ # -------------
# All nova components talk to a central database. We will need to do this step # All nova components talk to a central database. We will need to do this step
# only once for an entire cluster. # only once for an entire cluster.
if is_service_enabled mysql && is_service_enabled nova; then if is_service_enabled mysql && is_service_enabled nova; then
# (re)create nova database # (Re)create nova database
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS nova;' mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS nova;'
# Explicitly use latin1: to avoid lp#829209, nova expects the database to # 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 # use latin1 by default, and then upgrades the database to utf8 (see the
# 082_essex.py in nova) # 082_essex.py in nova)
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE nova CHARACTER SET latin1;' mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE nova CHARACTER SET latin1;'
# (re)create nova database # (Re)create nova database
$NOVA_BIN_DIR/nova-manage db sync $NOVA_BIN_DIR/nova-manage db sync
fi fi
# Heat # Heat
# ------ # ----
if is_service_enabled heat; then if is_service_enabled heat; then
init_heat init_heat
fi fi
# Launch Services # Launch Services
# =============== # ===============
# nova api crashes if we start it with a regular screen command, # Nova api crashes if we start it with a regular screen command,
# so send the start command by forcing text into the window. # so send the start command by forcing text into the window.
# Only run the services specified in ``ENABLED_SERVICES`` # Only run the services specified in ``ENABLED_SERVICES``
# launch the glance registry service # Launch the glance registry service
if is_service_enabled g-reg; then if is_service_enabled g-reg; then
screen_it g-reg "cd $GLANCE_DIR; bin/glance-registry --config-file=$GLANCE_CONF_DIR/glance-registry.conf" screen_it g-reg "cd $GLANCE_DIR; bin/glance-registry --config-file=$GLANCE_CONF_DIR/glance-registry.conf"
fi fi
# launch the glance api and wait for it to answer before continuing # Launch the glance api and wait for it to answer before continuing
if is_service_enabled g-api; then if is_service_enabled g-api; then
screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=$GLANCE_CONF_DIR/glance-api.conf" screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=$GLANCE_CONF_DIR/glance-api.conf"
echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..." echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..."
@ -2000,7 +2028,7 @@ if is_service_enabled g-api; then
fi fi
if is_service_enabled key; then if is_service_enabled key; then
# (re)create keystone database # (Re)create keystone database
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS keystone;' mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS keystone;'
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE keystone CHARACTER SET utf8;' mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE keystone CHARACTER SET utf8;'
@ -2018,7 +2046,7 @@ if is_service_enabled key; then
cp -p $KEYSTONE_DIR/etc/policy.json $KEYSTONE_CONF_DIR cp -p $KEYSTONE_DIR/etc/policy.json $KEYSTONE_CONF_DIR
fi fi
# Rewrite stock keystone.conf: # Rewrite stock ``keystone.conf``
iniset $KEYSTONE_CONF DEFAULT admin_token "$SERVICE_TOKEN" iniset $KEYSTONE_CONF DEFAULT admin_token "$SERVICE_TOKEN"
iniset $KEYSTONE_CONF sql connection "$BASE_SQL_CONN/keystone?charset=utf8" iniset $KEYSTONE_CONF sql connection "$BASE_SQL_CONN/keystone?charset=utf8"
iniset $KEYSTONE_CONF ec2 driver "keystone.contrib.ec2.backends.sql.Ec2" iniset $KEYSTONE_CONF ec2 driver "keystone.contrib.ec2.backends.sql.Ec2"
@ -2029,12 +2057,13 @@ if is_service_enabled key; then
iniset $KEYSTONE_CONF filter:s3_extension paste.filter_factory "keystone.contrib.s3:S3Extension.factory" iniset $KEYSTONE_CONF filter:s3_extension paste.filter_factory "keystone.contrib.s3:S3Extension.factory"
if [[ "$KEYSTONE_CATALOG_BACKEND" = "sql" ]]; then if [[ "$KEYSTONE_CATALOG_BACKEND" = "sql" ]]; then
# Configure keystone.conf to use sql # Configure ``keystone.conf`` to use sql
iniset $KEYSTONE_CONF catalog driver keystone.catalog.backends.sql.Catalog iniset $KEYSTONE_CONF catalog driver keystone.catalog.backends.sql.Catalog
inicomment $KEYSTONE_CONF catalog template_file inicomment $KEYSTONE_CONF catalog template_file
else else
KEYSTONE_CATALOG=$KEYSTONE_CONF_DIR/default_catalog.templates KEYSTONE_CATALOG=$KEYSTONE_CONF_DIR/default_catalog.templates
cp -p $FILES/default_catalog.templates $KEYSTONE_CATALOG cp -p $FILES/default_catalog.templates $KEYSTONE_CATALOG
# Add swift endpoints to service catalog if swift is enabled # Add swift endpoints to service catalog if swift is enabled
if is_service_enabled swift; then if is_service_enabled swift; then
echo "catalog.RegionOne.object_store.publicURL = http://%SERVICE_HOST%:8080/v1/AUTH_\$(tenant_id)s" >> $KEYSTONE_CATALOG echo "catalog.RegionOne.object_store.publicURL = http://%SERVICE_HOST%:8080/v1/AUTH_\$(tenant_id)s" >> $KEYSTONE_CATALOG
@ -2056,7 +2085,7 @@ if is_service_enabled key; then
s,%S3_SERVICE_PORT%,$S3_SERVICE_PORT,g; s,%S3_SERVICE_PORT%,$S3_SERVICE_PORT,g;
" -i $KEYSTONE_CATALOG " -i $KEYSTONE_CATALOG
# Configure keystone.conf to use templates # Configure ``keystone.conf`` to use templates
iniset $KEYSTONE_CONF catalog driver "keystone.catalog.backends.templated.TemplatedCatalog" iniset $KEYSTONE_CONF catalog driver "keystone.catalog.backends.templated.TemplatedCatalog"
iniset $KEYSTONE_CONF catalog template_file "$KEYSTONE_CATALOG" iniset $KEYSTONE_CONF catalog template_file "$KEYSTONE_CATALOG"
fi fi
@ -2073,10 +2102,11 @@ if is_service_enabled key; then
# Initialize keystone database # Initialize keystone database
$KEYSTONE_DIR/bin/keystone-manage db_sync $KEYSTONE_DIR/bin/keystone-manage db_sync
# set up certificates
# Set up certificates
$KEYSTONE_DIR/bin/keystone-manage pki_setup $KEYSTONE_DIR/bin/keystone-manage pki_setup
# launch keystone and wait for it to answer before continuing # Launch keystone and wait for it to answer before continuing
screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone-all --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG -d --debug" screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone-all --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG -d --debug"
echo "Waiting for keystone to start..." echo "Waiting for keystone to start..."
if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= curl -s $KEYSTONE_AUTH_PROTOCOL://$SERVICE_HOST:$KEYSTONE_API_PORT/v2.0/ >/dev/null; do sleep 1; done"; then if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= curl -s $KEYSTONE_AUTH_PROTOCOL://$SERVICE_HOST:$KEYSTONE_API_PORT/v2.0/ >/dev/null; do sleep 1; done"; then
@ -2084,7 +2114,7 @@ if is_service_enabled key; then
exit 1 exit 1
fi fi
# keystone_data.sh creates services, admin and demo users, and roles. # ``keystone_data.sh`` creates services, admin and demo users, and roles.
SERVICE_ENDPOINT=$KEYSTONE_AUTH_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/v2.0 SERVICE_ENDPOINT=$KEYSTONE_AUTH_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/v2.0
ADMIN_PASSWORD=$ADMIN_PASSWORD SERVICE_TENANT_NAME=$SERVICE_TENANT_NAME SERVICE_PASSWORD=$SERVICE_PASSWORD \ ADMIN_PASSWORD=$ADMIN_PASSWORD SERVICE_TENANT_NAME=$SERVICE_TENANT_NAME SERVICE_PASSWORD=$SERVICE_PASSWORD \
@ -2130,7 +2160,7 @@ if is_service_enabled q-svc; then
# Create a small network # Create a small network
# Since quantum command is executed in admin context at this point, # Since quantum command is executed in admin context at this point,
# --tenant_id needs to be specified. # ``--tenant_id`` needs to be specified.
NET_ID=$(quantum net-create --tenant_id $TENANT_ID net1 | grep ' id ' | get_field 2) NET_ID=$(quantum net-create --tenant_id $TENANT_ID net1 | grep ' id ' | get_field 2)
quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE
elif is_service_enabled mysql && is_service_enabled nova; then elif is_service_enabled mysql && is_service_enabled nova; then
@ -2144,12 +2174,9 @@ elif is_service_enabled mysql && is_service_enabled nova; then
$NOVA_BIN_DIR/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL $NOVA_BIN_DIR/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL
fi fi
# Launching nova-compute should be as simple as running ``nova-compute`` but # The group **libvirtd** is added to the current user in this script.
# have to do a little more than that in our script. Since we add the group # Use 'sg' to execute nova-compute as a member of the **libvirtd** group.
# ``libvirtd`` to our user in this script, when nova-compute is run it is # ``screen_it`` checks ``is_service_enabled``, it is not needed here
# within the context of our original shell (so our groups won't be updated).
# Use 'sg' to execute nova-compute as a member of the libvirtd group.
# We don't check for is_service_enable as screen_it does it for us
screen_it n-cpu "cd $NOVA_DIR && sg libvirtd $NOVA_BIN_DIR/nova-compute" screen_it n-cpu "cd $NOVA_DIR && sg libvirtd $NOVA_BIN_DIR/nova-compute"
screen_it n-crt "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cert" screen_it n-crt "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cert"
screen_it n-vol "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-volume" screen_it n-vol "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-volume"
@ -2178,18 +2205,17 @@ if is_service_enabled heat; then
start_heat start_heat
fi fi
# Install Images # Install Images
# ============== # ==============
# Upload an image to glance. # Upload an image to glance.
# #
# The default image is cirros, a small testing image, which lets you login as root # The default image is cirros, a small testing image which lets you login as **root**
#
# cirros also uses ``cloud-init``, supporting login via keypair and sending scripts as # cirros also uses ``cloud-init``, supporting login via keypair and sending scripts as
# userdata. See https://help.ubuntu.com/community/CloudInit for more on cloud-init # userdata. See https://help.ubuntu.com/community/CloudInit for more on cloud-init
# #
# Override ``IMAGE_URLS`` with a comma-separated list of uec images. # Override ``IMAGE_URLS`` with a comma-separated list of UEC images.
#
# * **oneiric**: http://uec-images.ubuntu.com/oneiric/current/oneiric-server-cloudimg-amd64.tar.gz # * **oneiric**: http://uec-images.ubuntu.com/oneiric/current/oneiric-server-cloudimg-amd64.tar.gz
# * **precise**: http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64.tar.gz # * **precise**: http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64.tar.gz
@ -2224,7 +2250,7 @@ set +o xtrace
# Using the cloud # Using the cloud
# =============== # ---------------
echo "" echo ""
echo "" echo ""
@ -2244,7 +2270,7 @@ if is_service_enabled key; then
echo "The password: $ADMIN_PASSWORD" echo "The password: $ADMIN_PASSWORD"
fi fi
# Echo HOST_IP - useful for build_uec.sh, which uses dhcp to give the instance an address # Echo ``HOST_IP`` - useful for ``build_uec.sh``, which uses dhcp to give the instance an address
echo "This is your host ip: $HOST_IP" echo "This is your host ip: $HOST_IP"
# Warn that ``EXTRA_FLAGS`` needs to be converted to ``EXTRA_OPTS`` # Warn that ``EXTRA_FLAGS`` needs to be converted to ``EXTRA_OPTS``
@ -2252,5 +2278,5 @@ if [[ -n "$EXTRA_FLAGS" ]]; then
echo "WARNING: EXTRA_FLAGS is defined and may need to be converted to EXTRA_OPTS" echo "WARNING: EXTRA_FLAGS is defined and may need to be converted to EXTRA_OPTS"
fi fi
# Indicate how long this took to run (bash maintained variable 'SECONDS') # Indicate how long this took to run (bash maintained variable ``SECONDS``)
echo "stack.sh completed in $SECONDS seconds." echo "stack.sh completed in $SECONDS seconds."

38
stackrc
View File

@ -1,3 +1,5 @@
# stackrc
#
# Find the other rc files # Find the other rc files
RC_DIR=$(cd $(dirname "$BASH_SOURCE") && pwd) RC_DIR=$(cd $(dirname "$BASH_SOURCE") && pwd)
@ -5,21 +7,22 @@ RC_DIR=$(cd $(dirname "$BASH_SOURCE") && pwd)
DEST=/opt/stack DEST=/opt/stack
# Specify which services to launch. These generally correspond to # Specify which services to launch. These generally correspond to
# screen tabs. If you like to add other services that are not enabled # screen tabs. To change the default list, use the ``enable_service`` and
# by default you can append them in your ENABLED_SERVICES variable in # ``disable_service`` functions in ``localrc``.
# your localrc. For example for swift you can just add this in your # For example, to enable Swift add this to ``localrc``:
# localrc to add it with the other services: # enable_service swift
# ENABLED_SERVICES+=,swift
# #
# If you like to explicitly remove services you can add a -$service in # And to disable Cinder and use Nova Volumes instead:
# ENABLED_SERVICES, for example in your localrc to install all defaults but not # disable_service c-api c-sch c-vol cinder
# cinder you would just need to set this : # enable_service n-vol
# ENABLED_SERVICES+=,-cinder
ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,mysql,rabbit ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,mysql,rabbit
# Set the default Nova APIs to enable # Set the default Nova APIs to enable
NOVA_ENABLED_APIS=ec2,osapi_compute,osapi_volume,metadata NOVA_ENABLED_APIS=ec2,osapi_compute,osapi_volume,metadata
# Repositories
# ------------
# Base GIT Repo URL # Base GIT Repo URL
# Another option is http://review.openstack.org/p # Another option is http://review.openstack.org/p
GIT_BASE=https://github.com GIT_BASE=https://github.com
@ -46,7 +49,6 @@ SWIFT_BRANCH=master
SWIFT3_REPO=https://github.com/fujita/swift3.git SWIFT3_REPO=https://github.com/fujita/swift3.git
SWIFT3_BRANCH=master SWIFT3_BRANCH=master
# python swift client library # python swift client library
SWIFTCLIENT_REPO=${GIT_BASE}/openstack/python-swiftclient SWIFTCLIENT_REPO=${GIT_BASE}/openstack/python-swiftclient
SWIFTCLIENT_BRANCH=master SWIFTCLIENT_BRANCH=master
@ -75,7 +77,7 @@ HORIZON_BRANCH=master
NOVACLIENT_REPO=${GIT_BASE}/openstack/python-novaclient.git NOVACLIENT_REPO=${GIT_BASE}/openstack/python-novaclient.git
NOVACLIENT_BRANCH=master NOVACLIENT_BRANCH=master
# Shared openstack python client library # consolidated openstack python client
OPENSTACKCLIENT_REPO=${GIT_BASE}/openstack/python-openstackclient.git OPENSTACKCLIENT_REPO=${GIT_BASE}/openstack/python-openstackclient.git
OPENSTACKCLIENT_BRANCH=master OPENSTACKCLIENT_BRANCH=master
@ -110,7 +112,7 @@ if [ -f $RC_DIR/localrc ]; then
source $RC_DIR/localrc source $RC_DIR/localrc
fi fi
# Specify a comma-separated list of uec images to download and install into glance. # Specify a comma-separated list of UEC images to download and install into glance.
# supported urls here are: # supported urls here are:
# * "uec-style" images: # * "uec-style" images:
# If the file ends in .tar.gz, uncompress the tarball and and select the first # If the file ends in .tar.gz, uncompress the tarball and and select the first
@ -123,13 +125,17 @@ fi
# example: # example:
# http://cloud-images.ubuntu.com/releases/oneiric/release/ubuntu-11.10-server-cloudimg-armel-disk1.img # http://cloud-images.ubuntu.com/releases/oneiric/release/ubuntu-11.10-server-cloudimg-armel-disk1.img
# http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-rootfs.img.gz # http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-rootfs.img.gz
# * OpenVZ image:
# OpenVZ uses its own format of image, and does not support UEC style images
#IMAGE_URLS="http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz" # old ttylinux-uec image #IMAGE_URLS="http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz" # old ttylinux-uec image
#IMAGE_URLS="http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img" # cirros full disk image #IMAGE_URLS="http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img" # cirros full disk image
#
# Set default image based on LIBVIRT_TYPE or VIRT_DRIVER, which may be set in localrc # Set default image based on ``VIRT_DRIVER`` and ``LIBVIRT_TYPE``, either of
# but allow DEFAULT_IMAGE_NAME and IMAGE_URLS to be set directly in localrc, too. # which may be set in ``localrc``. Also allow ``DEFAULT_IMAGE_NAME`` and
# ``IMAGE_URLS`` to be set directly in ``localrc``.
case "$VIRT_DRIVER" in case "$VIRT_DRIVER" in
openvz) # OpenVZ uses its own format of image, and does not support uec style images openvz)
DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ubuntu-11.10-x86_64} DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ubuntu-11.10-x86_64}
IMAGE_URLS=${IMAGE_URLS:-"http://download.openvz.org/template/precreated/ubuntu-11.10-x86_64.tar.gz"};; IMAGE_URLS=${IMAGE_URLS:-"http://download.openvz.org/template/precreated/ubuntu-11.10-x86_64.tar.gz"};;
libvirt) libvirt)

View File

@ -6,7 +6,7 @@
# mysql and rabbit are left running as OpenStack code refreshes # mysql and rabbit are left running as OpenStack code refreshes
# do not require them to be restarted. # 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 ``--all``
# on the command line # on the command line
# Keep track of the current devstack directory. # Keep track of the current devstack directory.