Enforce function declaration format in bash8

Check that function calls look like ^function foo {$ in bash8, and fix
all existing failures of that check.  Add a note to HACKING.rst

Change-Id: Ic19eecb39e0b20273d1bcd551a42fe400d54e938
This commit is contained in:
Ian Wienand 2014-02-21 15:35:08 +11:00
parent 0ed4af02da
commit aee18c749b
94 changed files with 601 additions and 585 deletions

View File

@ -275,3 +275,5 @@ Variables and Functions
- local variables should be lower case, global variables should be
upper case
- function names should_have_underscores, NotCamelCase.
- functions should be declared as per the regex ^function foo {$
with code starting on the next line

View File

@ -32,7 +32,7 @@ source $TOP_DIR/lib/cinder
TEMPFILE=`mktemp`
RECLONE=True
function log_message() {
function log_message {
MESSAGE=$1
STEP_HEADER=$2
if [[ "$STEP_HEADER" = "True" ]]; then

View File

@ -57,7 +57,7 @@ AGGREGATE_NAME=test_aggregate_$RANDOM
AGGREGATE2_NAME=test_aggregate_$RANDOM
AGGREGATE_A_ZONE=nova
exit_if_aggregate_present() {
function exit_if_aggregate_present {
aggregate_name=$1
if [ $(nova aggregate-list | grep -c " $aggregate_name ") == 0 ]; then

View File

@ -154,7 +154,7 @@ set +o xtrace
# Results
# =======
function report() {
function report {
if [[ -n "$2" ]]; then
echo "$1: $2"
fi

View File

@ -165,7 +165,7 @@ set +o xtrace
# Results
# =======
function report() {
function report {
if [[ -n "$2" ]]; then
echo "$1: $2"
fi

View File

@ -20,7 +20,7 @@ echo "*********************************************************************"
set -o errtrace
trap failed ERR
failed() {
function failed {
local r=$?
set +o errtrace
set +o xtrace
@ -395,7 +395,7 @@ function test_functions {
# Usage and main
# --------------
usage() {
function usage {
echo "$0: [-h]"
echo " -h, --help Display help message"
echo " -t, --tenant Create tenants"
@ -408,7 +408,7 @@ usage() {
echo " -T, --test Test functions"
}
main() {
function main {
echo Description

View File

@ -51,7 +51,7 @@ function cleanup_tmp {
# - ``GLANCE_HOSTPORT``
#
# upload_image image-url glance-token
function upload_image() {
function upload_image {
local image_url=$1
local token=$2
@ -341,7 +341,7 @@ function use_database {
# Wait for an HTTP server to start answering requests
# wait_for_service timeout url
function wait_for_service() {
function wait_for_service {
local timeout=$1
local url=$2
timeout $timeout sh -c "while ! curl --noproxy '*' -s $url >/dev/null; do sleep 1; done"
@ -351,7 +351,7 @@ function wait_for_service() {
# ping check
# Uses globals ``ENABLED_SERVICES``
# ping_check from-net ip boot-timeout expected
function ping_check() {
function ping_check {
if is_service_enabled neutron; then
_ping_check_neutron "$1" $2 $3 $4
return
@ -361,7 +361,7 @@ function ping_check() {
# ping check for nova
# Uses globals ``MULTI_HOST``, ``PRIVATE_NETWORK``
function _ping_check_novanet() {
function _ping_check_novanet {
local from_net=$1
local ip=$2
local boot_timeout=$3
@ -386,7 +386,7 @@ function _ping_check_novanet() {
}
# Get ip of instance
function get_instance_ip(){
function get_instance_ip {
local vm_id=$1
local network_name=$2
local nova_result="$(nova show $vm_id)"
@ -401,7 +401,7 @@ function get_instance_ip(){
# ssh check
# ssh_check net-name key-file floating-ip default-user active-timeout
function ssh_check() {
function ssh_check {
if is_service_enabled neutron; then
_ssh_check_neutron "$1" $2 $3 $4 $5
return
@ -409,7 +409,7 @@ function ssh_check() {
_ssh_check_novanet "$1" $2 $3 $4 $5
}
function _ssh_check_novanet() {
function _ssh_check_novanet {
local NET_NAME=$1
local KEY_FILE=$2
local FLOATING_IP=$3
@ -425,7 +425,7 @@ function _ssh_check_novanet() {
# Get the location of the $module-rootwrap executables, where module is cinder
# or nova.
# get_rootwrap_location module
function get_rootwrap_location() {
function get_rootwrap_location {
local module=$1
echo "$(get_python_exec_prefix)/$module-rootwrap"
@ -434,7 +434,7 @@ function get_rootwrap_location() {
# Path permissions sanity check
# check_path_perm_sanity path
function check_path_perm_sanity() {
function check_path_perm_sanity {
# Ensure no element of the path has 0700 permissions, which is very
# likely to cause issues for daemons. Inspired by default 0700
# homedir permissions on RHEL and common practice of making DEST in
@ -505,7 +505,7 @@ function _vercmp_r {
# The above will return "0", as the versions are equal.
#
# vercmp_numbers ver1 ver2
vercmp_numbers() {
function vercmp_numbers {
typeset v1=$1 v2=$2 sep
typeset -a ver1 ver2
@ -523,7 +523,7 @@ vercmp_numbers() {
# Defaults are respectively 'project_name' and 'user_name'
#
# setup_colorized_logging something.conf SOMESECTION
function setup_colorized_logging() {
function setup_colorized_logging {
local conf_file=$1
local conf_section=$2
local project_var=${3:-"project_name"}

View File

@ -38,7 +38,7 @@ set +o xtrace
# Append a new option in an ini file without replacing the old value
# iniadd config-file section option value1 value2 value3 ...
function iniadd() {
function iniadd {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local file=$1
@ -52,7 +52,7 @@ function iniadd() {
# Comment an option in an INI file
# inicomment config-file section option
function inicomment() {
function inicomment {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local file=$1
@ -64,7 +64,7 @@ function inicomment() {
# Get an option from an INI file
# iniget config-file section option
function iniget() {
function iniget {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local file=$1
@ -78,7 +78,7 @@ function iniget() {
# Get a multiple line option from an INI file
# iniget_multiline config-file section option
function iniget_multiline() {
function iniget_multiline {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local file=$1
@ -92,7 +92,7 @@ function iniget_multiline() {
# Determinate is the given option present in the INI file
# ini_has_option config-file section option
function ini_has_option() {
function ini_has_option {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local file=$1
@ -106,7 +106,7 @@ function ini_has_option() {
# Set an option in an INI file
# iniset config-file section option value
function iniset() {
function iniset {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local file=$1
@ -135,7 +135,7 @@ $option = $value
# Set a multiple line option in an INI file
# iniset_multiline config-file section option value1 value2 valu3 ...
function iniset_multiline() {
function iniset_multiline {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local file=$1
@ -167,7 +167,7 @@ $option = $v
# Uncomment an option in an INI file
# iniuncomment config-file section option
function iniuncomment() {
function iniuncomment {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local file=$1
@ -181,7 +181,7 @@ function iniuncomment() {
# Accepts as False: 0 no No NO false False FALSE
# Accepts as True: 1 yes Yes YES true True TRUE
# VAR=$(trueorfalse default-value test-value)
function trueorfalse() {
function trueorfalse {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local default=$1
@ -213,7 +213,7 @@ function backtrace {
# Prints line number and "message" then exits
# die $LINENO "message"
function die() {
function die {
local exitcode=$?
set +o xtrace
local line=$1; shift
@ -231,7 +231,7 @@ function die() {
# exit code is non-zero and prints "message" and exits
# NOTE: env-var is the variable name without a '$'
# die_if_not_set $LINENO env-var "message"
function die_if_not_set() {
function die_if_not_set {
local exitcode=$?
FXTRACE=$(set +o | grep xtrace)
set +o xtrace
@ -245,7 +245,7 @@ function die_if_not_set() {
# Prints line number and "message" in error format
# err $LINENO "message"
function err() {
function err {
local exitcode=$?
errXTRACE=$(set +o | grep xtrace)
set +o xtrace
@ -262,7 +262,7 @@ function err() {
# exit code is non-zero and prints "message"
# NOTE: env-var is the variable name without a '$'
# err_if_not_set $LINENO env-var "message"
function err_if_not_set() {
function err_if_not_set {
local exitcode=$?
errinsXTRACE=$(set +o | grep xtrace)
set +o xtrace
@ -291,14 +291,14 @@ function exit_distro_not_supported {
# Test if the named environment variable is set and not zero length
# is_set env-var
function is_set() {
function is_set {
local var=\$"$1"
eval "[ -n \"$var\" ]" # For ex.: sh -c "[ -n \"$var\" ]" would be better, but several exercises depends on this
}
# Prints line number and "message" in warning format
# warn $LINENO "message"
function warn() {
function warn {
local exitcode=$?
errXTRACE=$(set +o | grep xtrace)
set +o xtrace
@ -324,7 +324,7 @@ function warn() {
# os_PACKAGE - package type
# os_CODENAME - vendor's codename for release
# GetOSVersion
GetOSVersion() {
function GetOSVersion {
# Figure out which vendor we are
if [[ -x "`which sw_vers 2>/dev/null`" ]]; then
# OS/X
@ -414,7 +414,7 @@ GetOSVersion() {
# Translate the OS version values into common nomenclature
# Sets global ``DISTRO`` from the ``os_*`` values
function GetDistro() {
function GetDistro {
GetOSVersion
if [[ "$os_VENDOR" =~ (Ubuntu) || "$os_VENDOR" =~ (Debian) ]]; then
# 'Everyone' refers to Ubuntu / Debian releases by the code name adjective
@ -491,7 +491,7 @@ function is_ubuntu {
# Returns openstack release name for a given branch name
# ``get_release_name_from_branch branch-name``
function get_release_name_from_branch(){
function get_release_name_from_branch {
local branch=$1
if [[ $branch =~ "stable/" ]]; then
echo ${branch#*/}
@ -577,7 +577,7 @@ function git_clone {
# to timeout(1); otherwise the default value of 0 maintains the status
# quo of waiting forever.
# usage: git_timed <git-command>
function git_timed() {
function git_timed {
local count=0
local timeout=0
@ -603,7 +603,7 @@ function git_timed() {
# git update using reference as a branch.
# git_update_branch ref
function git_update_branch() {
function git_update_branch {
GIT_BRANCH=$1
@ -615,7 +615,7 @@ function git_update_branch() {
# git update using reference as a branch.
# git_update_remote_branch ref
function git_update_remote_branch() {
function git_update_remote_branch {
GIT_BRANCH=$1
@ -625,7 +625,7 @@ function git_update_remote_branch() {
# git update using reference as a tag. Be careful editing source at that repo
# as working copy will be in a detached mode
# git_update_tag ref
function git_update_tag() {
function git_update_tag {
GIT_TAG=$1
@ -641,7 +641,7 @@ function git_update_tag() {
# Get the default value for HOST_IP
# get_default_host_ip fixed_range floating_range host_ip_iface host_ip
function get_default_host_ip() {
function get_default_host_ip {
local fixed_range=$1
local floating_range=$2
local host_ip_iface=$3
@ -673,7 +673,7 @@ function get_default_host_ip() {
# Fields are numbered starting with 1
# Reverse syntax is supported: -1 is the last field, -2 is second to last, etc.
# get_field field-number
function get_field() {
function get_field {
while read data; do
if [ "$1" -lt 0 ]; then
field="(\$(NF$1))"
@ -687,7 +687,7 @@ function get_field() {
# Add a policy to a policy.json file
# Do nothing if the policy already exists
# ``policy_add policy_file policy_name policy_permissions``
function policy_add() {
function policy_add {
local policy_file=$1
local policy_name=$2
local policy_perm=$3
@ -717,7 +717,7 @@ function policy_add() {
# =================
# _get_package_dir
function _get_package_dir() {
function _get_package_dir {
local pkg_dir
if is_ubuntu; then
pkg_dir=$FILES/apts
@ -734,7 +734,7 @@ function _get_package_dir() {
# Wrapper for ``apt-get`` to set cache and proxy environment variables
# Uses globals ``OFFLINE``, ``*_proxy``
# apt_get operation package [package ...]
function apt_get() {
function apt_get {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
@ -759,7 +759,7 @@ function apt_get() {
# - ``# NOPRIME`` defers installation to be performed later in `stack.sh`
# - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection
# of the package to the distros listed. The distro names are case insensitive.
function get_packages() {
function get_packages {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local services=$@
@ -870,7 +870,7 @@ function get_packages() {
# Distro-agnostic package installer
# install_package package [package ...]
function install_package() {
function install_package {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
if is_ubuntu; then
@ -895,7 +895,7 @@ function install_package() {
# Distro-agnostic function to tell if a package is installed
# is_package_installed package [package ...]
function is_package_installed() {
function is_package_installed {
if [[ -z "$@" ]]; then
return 1
fi
@ -915,7 +915,7 @@ function is_package_installed() {
# Distro-agnostic package uninstaller
# uninstall_package package [package ...]
function uninstall_package() {
function uninstall_package {
if is_ubuntu; then
apt_get purge "$@"
elif is_fedora; then
@ -930,7 +930,7 @@ function uninstall_package() {
# Wrapper for ``yum`` to set proxy environment variables
# Uses globals ``OFFLINE``, ``*_proxy``
# yum_install package [package ...]
function yum_install() {
function yum_install {
[[ "$OFFLINE" = "True" ]] && return
local sudo="sudo"
[[ "$(id -u)" = "0" ]] && sudo="env"
@ -941,7 +941,7 @@ function yum_install() {
# zypper wrapper to set arguments correctly
# zypper_install package [package ...]
function zypper_install() {
function zypper_install {
[[ "$OFFLINE" = "True" ]] && return
local sudo="sudo"
[[ "$(id -u)" = "0" ]] && sudo="env"
@ -958,7 +958,7 @@ function zypper_install() {
# files to produce the same logs as screen_it(). The log filename is derived
# from the service name and global-and-now-misnamed SCREEN_LOGDIR
# _run_process service "command-line"
function _run_process() {
function _run_process {
local service=$1
local command="$2"
@ -983,7 +983,7 @@ function _run_process() {
# Helper to remove the ``*.failure`` files under ``$SERVICE_DIR/$SCREEN_NAME``.
# This is used for ``service_check`` when all the ``screen_it`` are called finished
# init_service_check
function init_service_check() {
function init_service_check {
SCREEN_NAME=${SCREEN_NAME:-stack}
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
@ -996,7 +996,7 @@ function init_service_check() {
# Find out if a process exists by partial name.
# is_running name
function is_running() {
function is_running {
local name=$1
ps auxw | grep -v grep | grep ${name} > /dev/null
RC=$?
@ -1009,7 +1009,7 @@ function is_running() {
# of screen_it() without screen. PIDs are written to
# $SERVICE_DIR/$SCREEN_NAME/$service.pid
# run_process service "command-line"
function run_process() {
function run_process {
local service=$1
local command="$2"
@ -1092,7 +1092,7 @@ function screen_rc {
# If screen is being used kill the screen window; this will catch processes
# that did not leave a PID behind
# screen_stop service
function screen_stop() {
function screen_stop {
SCREEN_NAME=${SCREEN_NAME:-stack}
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
USE_SCREEN=$(trueorfalse True $USE_SCREEN)
@ -1112,7 +1112,7 @@ function screen_stop() {
# Helper to get the status of each running service
# service_check
function service_check() {
function service_check {
local service
local failures
SCREEN_NAME=${SCREEN_NAME:-stack}
@ -1145,7 +1145,7 @@ function service_check() {
# Get the path to the pip command.
# get_pip_command
function get_pip_command() {
function get_pip_command {
which pip || which pip-python
if [ $? -ne 0 ]; then
@ -1155,7 +1155,7 @@ function get_pip_command() {
# Get the path to the direcotry where python executables are installed.
# get_python_exec_prefix
function get_python_exec_prefix() {
function get_python_exec_prefix {
if is_fedora || is_suse; then
echo "/usr/bin"
else
@ -1221,7 +1221,7 @@ function pip_install {
#
# Uses globals ``TRACK_DEPENDS``, ``REQUIREMENTS_DIR``, ``UNDO_REQUIREMENTS``
# setup_develop directory
function setup_develop() {
function setup_develop {
local project_dir=$1
echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir"
@ -1257,7 +1257,7 @@ function setup_develop() {
# using pip before running `setup.py develop`
# Uses globals ``STACK_USER``
# setup_develop_no_requirements_update directory
function setup_develop_no_requirements_update() {
function setup_develop_no_requirements_update {
local project_dir=$1
pip_install -e $project_dir
@ -1271,7 +1271,7 @@ function setup_develop_no_requirements_update() {
# 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 '
s/,,/,/g;
s/^,//;
@ -1284,7 +1284,7 @@ function _cleanup_service_list () {
# before a minimal installation
# Uses global ``ENABLED_SERVICES``
# disable_all_services
function disable_all_services() {
function disable_all_services {
ENABLED_SERVICES=""
}
@ -1293,7 +1293,7 @@ function disable_all_services() {
# ENABLED_SERVICES+=",-rabbit"
# Uses global ``ENABLED_SERVICES``
# disable_negated_services
function disable_negated_services() {
function disable_negated_services {
local tmpsvcs="${ENABLED_SERVICES}"
local service
for service in ${tmpsvcs//,/ }; do
@ -1314,7 +1314,7 @@ function disable_negated_services() {
# for nova, glance, and neutron built into is_service_enabled().
# Uses global ``ENABLED_SERVICES``
# disable_service service [service ...]
function disable_service() {
function disable_service {
local tmpsvcs=",${ENABLED_SERVICES},"
local service
for service in $@; do
@ -1335,7 +1335,7 @@ function disable_service() {
# for nova, glance, and neutron built into is_service_enabled().
# Uses global ``ENABLED_SERVICES``
# enable_service service [service ...]
function enable_service() {
function enable_service {
local tmpsvcs="${ENABLED_SERVICES}"
for service in $@; do
if ! is_service_enabled $service; then
@ -1369,7 +1369,7 @@ function enable_service() {
#
# Uses global ``ENABLED_SERVICES``
# is_service_enabled service [service ...]
function is_service_enabled() {
function is_service_enabled {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local enabled=1
@ -1424,7 +1424,7 @@ function use_exclusive_service {
# Only run the command if the target file (the last arg) is not on an
# NFS filesystem.
function _safe_permission_operation() {
function _safe_permission_operation {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
local args=( $@ )
@ -1457,7 +1457,7 @@ function _safe_permission_operation() {
# Exit 0 if address is in network or 1 if address is not in network
# ip-range is in CIDR notation: 1.2.3.4/20
# address_in_net ip-address ip-range
function address_in_net() {
function address_in_net {
local ip=$1
local range=$2
local masklen=${range#*/}
@ -1468,7 +1468,7 @@ function address_in_net() {
# Add a user to a group.
# add_user_to_group user group
function add_user_to_group() {
function add_user_to_group {
local user=$1
local group=$2
@ -1486,7 +1486,7 @@ function add_user_to_group() {
# Convert CIDR notation to a IPv4 netmask
# cidr2netmask cidr-bits
function cidr2netmask() {
function cidr2netmask {
local maskpat="255 255 255 255"
local maskdgt="254 252 248 240 224 192 128"
set -- ${maskpat:0:$(( ($1 / 8) * 4 ))}${maskdgt:$(( (7 - ($1 % 8)) * 4 )):3}
@ -1509,7 +1509,7 @@ function cp_it {
#
# http_proxy=http://proxy.example.com:3128/ no_proxy=repo.example.net ./stack.sh
function export_proxy_variables() {
function export_proxy_variables {
if [[ -n "$http_proxy" ]]; then
export http_proxy=$http_proxy
fi
@ -1522,7 +1522,7 @@ function export_proxy_variables() {
}
# Returns true if the directory is on a filesystem mounted via NFS.
function is_nfs_directory() {
function is_nfs_directory {
local mount_type=`stat -f -L -c %T $1`
test "$mount_type" == "nfs"
}
@ -1530,7 +1530,7 @@ function is_nfs_directory() {
# Return the network portion of the given IP address using netmask
# netmask is in the traditional dotted-quad format
# maskip ip-address netmask
function maskip() {
function maskip {
local ip=$1
local mask=$2
local l="${ip%.*}"; local r="${ip#*.}"; local n="${mask%.*}"; local m="${mask#*.}"
@ -1540,7 +1540,7 @@ function maskip() {
# Service wrapper to restart services
# restart_service service-name
function restart_service() {
function restart_service {
if is_ubuntu; then
sudo /usr/sbin/service $1 restart
else
@ -1550,19 +1550,19 @@ function restart_service() {
# Only change permissions of a file or directory if it is not on an
# NFS filesystem.
function safe_chmod() {
function safe_chmod {
_safe_permission_operation chmod $@
}
# Only change ownership of a file or directory if it is not on an NFS
# filesystem.
function safe_chown() {
function safe_chown {
_safe_permission_operation chown $@
}
# Service wrapper to start services
# start_service service-name
function start_service() {
function start_service {
if is_ubuntu; then
sudo /usr/sbin/service $1 start
else
@ -1572,7 +1572,7 @@ function start_service() {
# Service wrapper to stop services
# stop_service service-name
function stop_service() {
function stop_service {
if is_ubuntu; then
sudo /usr/sbin/service $1 stop
else

View File

@ -50,7 +50,7 @@ fi
#
# Uses global ``APACHE_ENABLED_SERVICES``
# APACHE_ENABLED_SERVICES service [service ...]
function is_apache_enabled_service() {
function is_apache_enabled_service {
services=$@
for service in ${services}; do
[[ ,${APACHE_ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
@ -59,7 +59,7 @@ function is_apache_enabled_service() {
}
# install_apache_wsgi() - Install Apache server and wsgi module
function install_apache_wsgi() {
function install_apache_wsgi {
# Apache installation, because we mark it NOPRIME
if is_ubuntu; then
# Install apache2, which is NOPRIME'd
@ -79,7 +79,7 @@ function install_apache_wsgi() {
}
# enable_apache_site() - Enable a particular apache site
function enable_apache_site() {
function enable_apache_site {
local site=$@
if is_ubuntu; then
sudo a2ensite ${site}
@ -90,7 +90,7 @@ function enable_apache_site() {
}
# disable_apache_site() - Disable a particular apache site
function disable_apache_site() {
function disable_apache_site {
local site=$@
if is_ubuntu; then
sudo a2dissite ${site}
@ -100,12 +100,12 @@ function disable_apache_site() {
}
# start_apache_server() - Start running apache server
function start_apache_server() {
function start_apache_server {
start_service $APACHE_NAME
}
# stop_apache_server() - Stop running apache server
function stop_apache_server() {
function stop_apache_server {
if [ -n "$APACHE_NAME" ]; then
stop_service $APACHE_NAME
else
@ -114,7 +114,7 @@ function stop_apache_server() {
}
# restart_apache_server
function restart_apache_server() {
function restart_apache_server {
restart_service $APACHE_NAME
}

View File

@ -166,7 +166,7 @@ BM_SHELL_IN_A_BOX=${BM_SHELL_IN_A_BOX:-http://shellinabox.googlecode.com/files/s
# Check if baremetal is properly enabled
# Returns false if VIRT_DRIVER is not baremetal, or if ENABLED_SERVICES
# does not contain "baremetal"
function is_baremetal() {
function is_baremetal {
if [[ "$ENABLED_SERVICES" =~ 'baremetal' && "$VIRT_DRIVER" = 'baremetal' ]]; then
return 0
fi
@ -175,7 +175,7 @@ function is_baremetal() {
# Install diskimage-builder and shell-in-a-box
# so that we can build the deployment kernel & ramdisk
function prepare_baremetal_toolchain() {
function prepare_baremetal_toolchain {
git_clone $BM_IMAGE_BUILD_REPO $BM_IMAGE_BUILD_DIR $BM_IMAGE_BUILD_BRANCH
git_clone $BM_POSEUR_REPO $BM_POSEUR_DIR $BM_POSEUR_BRANCH
@ -197,7 +197,7 @@ function prepare_baremetal_toolchain() {
}
# set up virtualized environment for devstack-gate testing
function create_fake_baremetal_env() {
function create_fake_baremetal_env {
local bm_poseur="$BM_POSEUR_DIR/bm_poseur"
# TODO(deva): add support for >1 VM
sudo $bm_poseur $BM_POSEUR_EXTRA_OPTS create-bridge
@ -211,14 +211,14 @@ function create_fake_baremetal_env() {
BM_SECOND_MAC='12:34:56:78:90:12'
}
function cleanup_fake_baremetal_env() {
function cleanup_fake_baremetal_env {
local bm_poseur="$BM_POSEUR_DIR/bm_poseur"
sudo $bm_poseur $BM_POSEUR_EXTRA_OPTS destroy-vm
sudo $bm_poseur $BM_POSEUR_EXTRA_OPTS destroy-bridge
}
# prepare various directories needed by baremetal hypervisor
function configure_baremetal_nova_dirs() {
function configure_baremetal_nova_dirs {
# ensure /tftpboot is prepared
sudo mkdir -p /tftpboot
sudo mkdir -p /tftpboot/pxelinux.cfg
@ -249,7 +249,7 @@ function configure_baremetal_nova_dirs() {
# build deploy kernel+ramdisk, then upload them to glance
# this function sets BM_DEPLOY_KERNEL_ID and BM_DEPLOY_RAMDISK_ID
function upload_baremetal_deploy() {
function upload_baremetal_deploy {
token=$1
if [ "$BM_BUILD_DEPLOY_RAMDISK" = "True" ]; then
@ -281,7 +281,7 @@ function upload_baremetal_deploy() {
# create a basic baremetal flavor, associated with deploy kernel & ramdisk
#
# Usage: create_baremetal_flavor <aki_uuid> <ari_uuid>
function create_baremetal_flavor() {
function create_baremetal_flavor {
aki=$1
ari=$2
nova flavor-create $BM_FLAVOR_NAME $BM_FLAVOR_ID \
@ -298,7 +298,7 @@ function create_baremetal_flavor() {
# Sets KERNEL_ID and RAMDISK_ID
#
# Usage: extract_and_upload_k_and_r_from_image $token $file
function extract_and_upload_k_and_r_from_image() {
function extract_and_upload_k_and_r_from_image {
token=$1
file=$2
image_name=$(basename "$file" ".qcow2")
@ -339,7 +339,7 @@ function extract_and_upload_k_and_r_from_image() {
# Takes the same parameters, but has some peculiarities which made it
# easier to create a separate method, rather than complicate the logic
# of the existing function.
function upload_baremetal_image() {
function upload_baremetal_image {
local image_url=$1
local token=$2
@ -429,7 +429,7 @@ function upload_baremetal_image() {
DEFAULT_IMAGE_NAME="${IMAGE_NAME%.img}"
}
function clear_baremetal_of_all_nodes() {
function clear_baremetal_of_all_nodes {
list=$(nova baremetal-node-list | awk -F '| ' 'NR>3 {print $2}' )
for node in $list; do
nova baremetal-node-delete $node
@ -440,7 +440,7 @@ function clear_baremetal_of_all_nodes() {
# Defaults to using BM_FIRST_MAC and BM_SECOND_MAC if parameters not specified
#
# Usage: add_baremetal_node <first_mac> <second_mac>
function add_baremetal_node() {
function add_baremetal_node {
mac_1=${1:-$BM_FIRST_MAC}
mac_2=${2:-$BM_SECOND_MAC}

View File

@ -105,18 +105,18 @@ create_ceilometer_accounts() {
# cleanup_ceilometer() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_ceilometer() {
function cleanup_ceilometer {
mongo ceilometer --eval "db.dropDatabase();"
}
# configure_ceilometerclient() - Set config files, create data dirs, etc
function configure_ceilometerclient() {
function configure_ceilometerclient {
setup_develop $CEILOMETERCLIENT_DIR
sudo install -D -m 0644 -o $STACK_USER {$CEILOMETERCLIENT_DIR/tools/,/etc/bash_completion.d/}ceilometer.bash_completion
}
# configure_ceilometer() - Set config files, create data dirs, etc
function configure_ceilometer() {
function configure_ceilometer {
setup_develop $CEILOMETER_DIR
[ ! -d $CEILOMETER_CONF_DIR ] && sudo mkdir -m 755 -p $CEILOMETER_CONF_DIR
@ -162,7 +162,7 @@ function configure_ceilometer() {
fi
}
function configure_mongodb() {
function configure_mongodb {
if is_fedora; then
# install mongodb client
install_package mongodb
@ -174,7 +174,7 @@ function configure_mongodb() {
}
# init_ceilometer() - Initialize etc.
function init_ceilometer() {
function init_ceilometer {
# Create cache dir
sudo mkdir -p $CEILOMETER_AUTH_CACHE_DIR
sudo chown $STACK_USER $CEILOMETER_AUTH_CACHE_DIR
@ -187,17 +187,17 @@ function init_ceilometer() {
}
# install_ceilometer() - Collect source and prepare
function install_ceilometer() {
function install_ceilometer {
git_clone $CEILOMETER_REPO $CEILOMETER_DIR $CEILOMETER_BRANCH
}
# install_ceilometerclient() - Collect source and prepare
function install_ceilometerclient() {
function install_ceilometerclient {
git_clone $CEILOMETERCLIENT_REPO $CEILOMETERCLIENT_DIR $CEILOMETERCLIENT_BRANCH
}
# start_ceilometer() - Start running processes, including screen
function start_ceilometer() {
function start_ceilometer {
if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
screen_it ceilometer-acompute "cd ; sg $LIBVIRT_GROUP \"ceilometer-agent-compute --config-file $CEILOMETER_CONF\""
fi
@ -216,7 +216,7 @@ function start_ceilometer() {
}
# stop_ceilometer() - Stop running processes
function stop_ceilometer() {
function stop_ceilometer {
# Kill the ceilometer screen windows
for serv in ceilometer-acompute ceilometer-acentral ceilometer-anotification ceilometer-collector ceilometer-api ceilometer-alarm-notifier ceilometer-alarm-evaluator; do
screen_stop $serv

View File

@ -102,7 +102,7 @@ function is_cinder_enabled {
# _clean_lvm_lv removes all cinder LVM volumes
#
# Usage: _clean_lvm_lv $VOLUME_GROUP $VOLUME_NAME_PREFIX
function _clean_lvm_lv() {
function _clean_lvm_lv {
local vg=$1
local lv_prefix=$2
@ -119,7 +119,7 @@ function _clean_lvm_lv() {
# volume group used by cinder
#
# Usage: _clean_lvm_backing_file() $VOLUME_GROUP
function _clean_lvm_backing_file() {
function _clean_lvm_backing_file {
local vg=$1
# if there is no logical volume left, it's safe to attempt a cleanup
@ -136,7 +136,7 @@ function _clean_lvm_backing_file() {
# cleanup_cinder() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_cinder() {
function cleanup_cinder {
# ensure the volume group is cleared up because fails might
# leave dead volumes in the group
TARGETS=$(sudo tgtadm --op show --mode target)
@ -181,7 +181,7 @@ function cleanup_cinder() {
}
# configure_cinder_rootwrap() - configure Cinder's rootwrap
function configure_cinder_rootwrap() {
function configure_cinder_rootwrap {
# Set the paths of certain binaries
CINDER_ROOTWRAP=$(get_rootwrap_location cinder)
@ -212,7 +212,7 @@ function configure_cinder_rootwrap() {
}
# configure_cinder() - Set config files, create data dirs, etc
function configure_cinder() {
function configure_cinder {
if [[ ! -d $CINDER_CONF_DIR ]]; then
sudo mkdir -p $CINDER_CONF_DIR
fi
@ -328,7 +328,7 @@ function configure_cinder() {
# service cinder admin # if enabled
# Migrated from keystone_data.sh
create_cinder_accounts() {
function create_cinder_accounts {
SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
@ -373,14 +373,14 @@ create_cinder_accounts() {
}
# create_cinder_cache_dir() - Part of the init_cinder() process
function create_cinder_cache_dir() {
function create_cinder_cache_dir {
# Create cache dir
sudo mkdir -p $CINDER_AUTH_CACHE_DIR
sudo chown $STACK_USER $CINDER_AUTH_CACHE_DIR
rm -f $CINDER_AUTH_CACHE_DIR/*
}
create_cinder_volume_group() {
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
@ -428,7 +428,7 @@ create_cinder_volume_group() {
}
# init_cinder() - Initialize database and volume group
function init_cinder() {
function init_cinder {
# Force nova volumes off
NOVA_ENABLED_APIS=$(echo $NOVA_ENABLED_APIS | sed "s/osapi_volume,//")
@ -464,20 +464,20 @@ function init_cinder() {
}
# install_cinder() - Collect source and prepare
function install_cinder() {
function install_cinder {
git_clone $CINDER_REPO $CINDER_DIR $CINDER_BRANCH
setup_develop $CINDER_DIR
}
# install_cinderclient() - Collect source and prepare
function install_cinderclient() {
function install_cinderclient {
git_clone $CINDERCLIENT_REPO $CINDERCLIENT_DIR $CINDERCLIENT_BRANCH
setup_develop $CINDERCLIENT_DIR
sudo install -D -m 0644 -o $STACK_USER {$CINDERCLIENT_DIR/tools/,/etc/bash_completion.d/}cinder.bash_completion
}
# apply config.d approach for cinder volumes directory
function _configure_tgt_for_config_d() {
function _configure_tgt_for_config_d {
if [[ ! -d /etc/tgt/stack.d/ ]]; then
sudo ln -sf $CINDER_STATE_PATH/volumes /etc/tgt/stack.d
echo "include /etc/tgt/stack.d/*" | sudo tee -a /etc/tgt/targets.conf
@ -485,7 +485,7 @@ function _configure_tgt_for_config_d() {
}
# start_cinder() - Start running processes, including screen
function start_cinder() {
function start_cinder {
if is_service_enabled c-vol; then
# Delete any old stack.conf
sudo rm -f /etc/tgt/conf.d/stack.conf
@ -529,7 +529,7 @@ function start_cinder() {
}
# stop_cinder() - Stop running processes
function stop_cinder() {
function stop_cinder {
# Kill the cinder screen windows
for serv in c-api c-bak c-sch c-vol; do
screen_stop $serv

View File

@ -27,7 +27,7 @@ set +o xtrace
# ------------
# configure_cinder_driver - Set config files, create data dirs, etc
function configure_cinder_driver() {
function configure_cinder_driver {
iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.xenapi.sm.XenAPINFSDriver"
iniset $CINDER_CONF DEFAULT xenapi_connection_url "$CINDER_XENAPI_CONNECTION_URL"
iniset $CINDER_CONF DEFAULT xenapi_connection_username "$CINDER_XENAPI_CONNECTION_USERNAME"

View File

@ -27,7 +27,7 @@ set +o xtrace
# ------------
# configure_cinder_driver - Set config files, create data dirs, etc
function configure_cinder_driver() {
function configure_cinder_driver {
# To use glusterfs, set the following in localrc:
# CINDER_DRIVER=glusterfs
# CINDER_GLUSTERFS_SHARES="127.0.0.1:/vol1;127.0.0.1:/vol2"

View File

@ -27,7 +27,7 @@ set +o xtrace
# ------------
# configure_cinder_driver - Set config files, create data dirs, etc
function configure_cinder_driver() {
function configure_cinder_driver {
iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.nfs.NfsDriver"
iniset $CINDER_CONF DEFAULT nfs_shares_config "$CINDER_CONF_DIR/nfs_shares.conf"
echo "$CINDER_NFS_SERVERPATH" | sudo tee "$CINDER_CONF_DIR/nfs_shares.conf"

View File

@ -27,7 +27,7 @@ set +o xtrace
# ------------
# configure_cinder_driver - Set config files, create data dirs, etc
function configure_cinder_driver() {
function configure_cinder_driver {
iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.sheepdog.SheepdogDriver"
}

View File

@ -27,7 +27,7 @@ set +o xtrace
# ------------
# configure_cinder_driver - Set config files, create data dirs, etc
function configure_cinder_driver() {
function configure_cinder_driver {
# To use solidfire, set the following in localrc:
# CINDER_DRIVER=solidfire
# SAN_IP=<mvip>

View File

@ -27,7 +27,7 @@ set +o xtrace
# ------------
# configure_cinder_driver - Set config files, create data dirs, etc
function configure_cinder_driver() {
function configure_cinder_driver {
iniset $CINDER_CONF DEFAULT vmware_host_ip "$VMWAREAPI_IP"
iniset $CINDER_CONF DEFAULT vmware_host_username "$VMWAREAPI_USER"
iniset $CINDER_CONF DEFAULT vmware_host_password "$VMWAREAPI_PASSWORD"

View File

@ -25,7 +25,7 @@ CONFIG_AWK_CMD=${CONFIG_AWK_CMD:-awk}
# Get the section for the specific group and config file
# get_meta_section infile group configfile
function get_meta_section() {
function get_meta_section {
local file=$1
local matchgroup=$2
local configfile=$3
@ -57,7 +57,7 @@ function get_meta_section() {
# Get a list of config files for a specific group
# get_meta_section_files infile group
function get_meta_section_files() {
function get_meta_section_files {
local file=$1
local matchgroup=$2
@ -77,7 +77,7 @@ function get_meta_section_files() {
# Merge the contents of a meta-config file into its destination config file
# If configfile does not exist it will be created.
# merge_config_file infile group configfile
function merge_config_file() {
function merge_config_file {
local file=$1
local matchgroup=$2
local configfile=$3
@ -106,7 +106,7 @@ function merge_config_file() {
# Merge all of the files specified by group
# merge_config_group infile group [group ...]
function merge_config_group() {
function merge_config_group {
local localfile=$1; shift
local matchgroups=$@

View File

@ -47,42 +47,42 @@ GANTT_BIN_DIR=$(get_python_exec_prefix)
# cleanup_gantt() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_gantt() {
function cleanup_gantt {
echo "Cleanup Gantt"
}
# configure_gantt() - Set config files, create data dirs, etc
function configure_gantt() {
function configure_gantt {
echo "Configure Gantt"
}
# init_gantt() - Initialize database and volume group
function init_gantt() {
function init_gantt {
echo "Initialize Gantt"
}
# install_gantt() - Collect source and prepare
function install_gantt() {
function install_gantt {
git_clone $GANTT_REPO $GANTT_DIR $GANTT_BRANCH
setup_develop $GANTT_DIR
}
# install_ganttclient() - Collect source and prepare
function install_ganttclient() {
function install_ganttclient {
echo "Install Gantt Client"
# git_clone $GANTTCLIENT_REPO $GANTTCLIENT_DIR $GANTTCLIENT_BRANCH
# setup_develop $GANTTCLIENT_DIR
}
# start_gantt() - Start running processes, including screen
function start_gantt() {
function start_gantt {
if is_service_enabled gantt; then
screen_it gantt "cd $GANTT_DIR && $GANTT_BIN_DIR/gantt-scheduler --config-file $GANTT_CONF"
fi
}
# stop_gantt() - Stop running processes
function stop_gantt() {
function stop_gantt {
echo "Stop Gantt"
screen_stop gantt
}

View File

@ -68,14 +68,14 @@ function is_glance_enabled {
# cleanup_glance() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_glance() {
function cleanup_glance {
# kill instances (nova)
# delete image files (glance)
sudo rm -rf $GLANCE_CACHE_DIR $GLANCE_IMAGE_DIR $GLANCE_AUTH_CACHE_DIR
}
# configure_glance() - Set config files, create data dirs, etc
function configure_glance() {
function configure_glance {
if [[ ! -d $GLANCE_CONF_DIR ]]; then
sudo mkdir -p $GLANCE_CONF_DIR
fi
@ -160,7 +160,7 @@ function configure_glance() {
}
# create_glance_cache_dir() - Part of the init_glance() process
function create_glance_cache_dir() {
function create_glance_cache_dir {
# Create cache dir
sudo mkdir -p $GLANCE_AUTH_CACHE_DIR/api
sudo chown $STACK_USER $GLANCE_AUTH_CACHE_DIR/api
@ -171,7 +171,7 @@ function create_glance_cache_dir() {
}
# init_glance() - Initialize databases, etc.
function init_glance() {
function init_glance {
# Delete existing images
rm -rf $GLANCE_IMAGE_DIR
mkdir -p $GLANCE_IMAGE_DIR
@ -190,19 +190,19 @@ function init_glance() {
}
# install_glanceclient() - Collect source and prepare
function install_glanceclient() {
function install_glanceclient {
git_clone $GLANCECLIENT_REPO $GLANCECLIENT_DIR $GLANCECLIENT_BRANCH
setup_develop $GLANCECLIENT_DIR
}
# install_glance() - Collect source and prepare
function install_glance() {
function install_glance {
git_clone $GLANCE_REPO $GLANCE_DIR $GLANCE_BRANCH
setup_develop $GLANCE_DIR
}
# start_glance() - Start running processes, including screen
function start_glance() {
function start_glance {
screen_it g-reg "cd $GLANCE_DIR; $GLANCE_BIN_DIR/glance-registry --config-file=$GLANCE_CONF_DIR/glance-registry.conf"
screen_it g-api "cd $GLANCE_DIR; $GLANCE_BIN_DIR/glance-api --config-file=$GLANCE_CONF_DIR/glance-api.conf"
echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..."
@ -212,7 +212,7 @@ function start_glance() {
}
# stop_glance() - Stop running processes
function stop_glance() {
function stop_glance {
# Kill the Glance screen windows
screen_stop g-api
screen_stop g-reg

View File

@ -47,14 +47,14 @@ TEMPEST_SERVICES+=,heat
# cleanup_heat() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_heat() {
function cleanup_heat {
sudo rm -rf $HEAT_AUTH_CACHE_DIR
sudo rm -rf $HEAT_ENV_DIR
sudo rm -rf $HEAT_TEMPLATES_DIR
}
# configure_heat() - Set config files, create data dirs, etc
function configure_heat() {
function configure_heat {
setup_develop $HEAT_DIR
if [[ ! -d $HEAT_CONF_DIR ]]; then
@ -137,7 +137,7 @@ function configure_heat() {
}
# init_heat() - Initialize database
function init_heat() {
function init_heat {
# (re)create heat database
recreate_database heat utf8
@ -147,26 +147,26 @@ function init_heat() {
}
# create_heat_cache_dir() - Part of the init_heat() process
function create_heat_cache_dir() {
function create_heat_cache_dir {
# Create cache dirs
sudo mkdir -p $HEAT_AUTH_CACHE_DIR
sudo chown $STACK_USER $HEAT_AUTH_CACHE_DIR
}
# install_heatclient() - Collect source and prepare
function install_heatclient() {
function install_heatclient {
git_clone $HEATCLIENT_REPO $HEATCLIENT_DIR $HEATCLIENT_BRANCH
setup_develop $HEATCLIENT_DIR
sudo install -D -m 0644 -o $STACK_USER {$HEATCLIENT_DIR/tools/,/etc/bash_completion.d/}heat.bash_completion
}
# install_heat() - Collect source and prepare
function install_heat() {
function install_heat {
git_clone $HEAT_REPO $HEAT_DIR $HEAT_BRANCH
}
# start_heat() - Start running processes, including screen
function start_heat() {
function start_heat {
screen_it h-eng "cd $HEAT_DIR; bin/heat-engine --config-file=$HEAT_CONF"
screen_it h-api "cd $HEAT_DIR; bin/heat-api --config-file=$HEAT_CONF"
screen_it h-api-cfn "cd $HEAT_DIR; bin/heat-api-cfn --config-file=$HEAT_CONF"
@ -174,7 +174,7 @@ function start_heat() {
}
# stop_heat() - Stop running processes
function stop_heat() {
function stop_heat {
# Kill the screen windows
for serv in h-eng h-api h-api-cfn h-api-cw; do
screen_stop $serv
@ -198,7 +198,7 @@ function disk_image_create {
# create_heat_accounts() - Set up common required heat accounts
# Note this is in addition to what is in files/keystone_data.sh
function create_heat_accounts() {
function create_heat_accounts {
# Note we have to pass token/endpoint here because the current endpoint and
# version negotiation in OSC means just --os-identity-api-version=3 won't work
KS_ENDPOINT_V3="$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v3"

View File

@ -39,7 +39,7 @@ TEMPEST_SERVICES+=,horizon
# ---------
# utility method of setting python option
function _horizon_config_set() {
function _horizon_config_set {
local file=$1
local section=$2
local option=$3
@ -64,7 +64,7 @@ function _horizon_config_set() {
# cleanup_horizon() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_horizon() {
function cleanup_horizon {
if [[ is_fedora && $DISTRO =~ (rhel6) ]]; then
# If ``/usr/bin/node`` points into ``$DEST``
# we installed it via ``install_nodejs``
@ -75,12 +75,12 @@ function cleanup_horizon() {
}
# configure_horizon() - Set config files, create data dirs, etc
function configure_horizon() {
function configure_horizon {
setup_develop $HORIZON_DIR
}
# init_horizon() - Initialize databases, etc.
function init_horizon() {
function init_horizon {
# ``local_settings.py`` is used to override horizon default settings.
local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py
cp $HORIZON_SETTINGS $local_settings
@ -143,7 +143,7 @@ function init_horizon() {
}
# install_horizon() - Collect source and prepare
function install_horizon() {
function install_horizon {
# Apache installation, because we mark it NOPRIME
install_apache_wsgi
@ -151,13 +151,13 @@ function install_horizon() {
}
# start_horizon() - Start running processes, including screen
function start_horizon() {
function start_horizon {
restart_apache_server
screen_it horizon "cd $HORIZON_DIR && sudo tail -f /var/log/$APACHE_NAME/horizon_error.log"
}
# stop_horizon() - Stop running processes (non-screen)
function stop_horizon() {
function stop_horizon {
stop_apache_server
}

View File

@ -27,7 +27,7 @@ REQUIREMENTS_DIR=$DEST/requirements
# ------------
# unfubar_setuptools() - Unbreak the giant mess that is the current state of setuptools
function unfubar_setuptools() {
function unfubar_setuptools {
# this is a giant game of who's on first, but it does consistently work
# there is hope that upstream python packaging fixes this in the future
echo_summary "Unbreaking setuptools"
@ -40,7 +40,7 @@ function unfubar_setuptools() {
# install_infra() - Collect source and prepare
function install_infra() {
function install_infra {
# bring down global requirements
git_clone $REQUIREMENTS_REPO $REQUIREMENTS_DIR $REQUIREMENTS_BRANCH

View File

@ -57,25 +57,25 @@ function is_ironic_enabled {
}
# install_ironic() - Collect source and prepare
function install_ironic() {
function install_ironic {
git_clone $IRONIC_REPO $IRONIC_DIR $IRONIC_BRANCH
setup_develop $IRONIC_DIR
}
# install_ironicclient() - Collect sources and prepare
function install_ironicclient() {
function install_ironicclient {
git_clone $IRONICCLIENT_REPO $IRONICCLIENT_DIR $IRONICCLIENT_BRANCH
setup_develop $IRONICCLIENT_DIR
}
# cleanup_ironic() - Remove residual data files, anything left over from previous
# runs that would need to clean up.
function cleanup_ironic() {
function cleanup_ironic {
sudo rm -rf $IRONIC_AUTH_CACHE_DIR
}
# configure_ironic() - Set config files, create data dirs, etc
function configure_ironic() {
function configure_ironic {
if [[ ! -d $IRONIC_CONF_DIR ]]; then
sudo mkdir -p $IRONIC_CONF_DIR
fi
@ -101,7 +101,7 @@ function configure_ironic() {
# configure_ironic_api() - Is used by configure_ironic(). Performs
# API specific configuration.
function configure_ironic_api() {
function configure_ironic_api {
iniset $IRONIC_CONF_FILE DEFAULT auth_strategy keystone
iniset $IRONIC_CONF_FILE DEFAULT policy_file $IRONIC_POLICY_JSON
iniset $IRONIC_CONF_FILE keystone_authtoken auth_host $KEYSTONE_AUTH_HOST
@ -120,7 +120,7 @@ function configure_ironic_api() {
# configure_ironic_conductor() - Is used by configure_ironic().
# Sets conductor specific settings.
function configure_ironic_conductor() {
function configure_ironic_conductor {
cp $IRONIC_DIR/etc/ironic/rootwrap.conf $IRONIC_ROOTWRAP_CONF
cp -r $IRONIC_DIR/etc/ironic/rootwrap.d $IRONIC_CONF_DIR
@ -128,7 +128,7 @@ function configure_ironic_conductor() {
}
# create_ironic_cache_dir() - Part of the init_ironic() process
function create_ironic_cache_dir() {
function create_ironic_cache_dir {
# Create cache dir
sudo mkdir -p $IRONIC_AUTH_CACHE_DIR/api
sudo chown $STACK_USER $IRONIC_AUTH_CACHE_DIR/api
@ -143,7 +143,7 @@ function create_ironic_cache_dir() {
# Tenant User Roles
# ------------------------------------------------------------------
# service ironic admin # if enabled
create_ironic_accounts() {
function create_ironic_accounts {
SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
@ -178,7 +178,7 @@ create_ironic_accounts() {
# init_ironic() - Initialize databases, etc.
function init_ironic() {
function init_ironic {
# (Re)create ironic database
recreate_database ironic utf8
@ -192,7 +192,7 @@ function init_ironic() {
}
# start_ironic() - Start running processes, including screen
function start_ironic() {
function start_ironic {
# Start Ironic API server, if enabled.
if is_service_enabled ir-api; then
start_ironic_api
@ -206,7 +206,7 @@ function start_ironic() {
# start_ironic_api() - Used by start_ironic().
# Starts Ironic API server.
function start_ironic_api() {
function start_ironic_api {
screen_it ir-api "cd $IRONIC_DIR; $IRONIC_BIN_DIR/ironic-api --config-file=$IRONIC_CONF_FILE"
echo "Waiting for ir-api ($IRONIC_HOSTPORT) to start..."
if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- http://$IRONIC_HOSTPORT; do sleep 1; done"; then
@ -216,13 +216,13 @@ function start_ironic_api() {
# start_ironic_conductor() - Used by start_ironic().
# Starts Ironic conductor.
function start_ironic_conductor() {
function start_ironic_conductor {
screen_it ir-cond "cd $IRONIC_DIR; $IRONIC_BIN_DIR/ironic-conductor --config-file=$IRONIC_CONF_FILE"
# TODO(romcheg): Find a way to check whether the conductor has started.
}
# stop_ironic() - Stop running processes
function stop_ironic() {
function stop_ironic {
# Kill the Ironic screen windows
screen -S $SCREEN_NAME -p ir-api -X kill
screen -S $SCREEN_NAME -p ir-cond -X kill

View File

@ -90,7 +90,7 @@ fi
# ---------
# cleanup_keystone() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_keystone() {
function cleanup_keystone {
# kill instances (nova)
# delete image files (glance)
# This function intentionally left blank
@ -98,14 +98,14 @@ function cleanup_keystone() {
}
# _cleanup_keystone_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file
function _cleanup_keystone_apache_wsgi() {
function _cleanup_keystone_apache_wsgi {
sudo rm -f $KEYSTONE_WSGI_DIR/*.wsgi
disable_apache_site keystone
sudo rm -f /etc/$APACHE_NAME/$APACHE_CONF_DIR/keystone
}
# _config_keystone_apache_wsgi() - Set WSGI config files of Keystone
function _config_keystone_apache_wsgi() {
function _config_keystone_apache_wsgi {
sudo mkdir -p $KEYSTONE_WSGI_DIR
# copy proxy vhost and wsgi file
@ -125,7 +125,7 @@ function _config_keystone_apache_wsgi() {
}
# configure_keystone() - Set config files, create data dirs, etc
function configure_keystone() {
function configure_keystone {
if [[ ! -d $KEYSTONE_CONF_DIR ]]; then
sudo mkdir -p $KEYSTONE_CONF_DIR
fi
@ -272,7 +272,7 @@ function configure_keystone() {
# invisible_to_admin demo Member
# Migrated from keystone_data.sh
create_keystone_accounts() {
function create_keystone_accounts {
# admin
ADMIN_TENANT=$(openstack project create \
@ -346,14 +346,14 @@ create_keystone_accounts() {
# Configure the API version for the OpenStack projects.
# configure_API_version conf_file version
function configure_API_version() {
function configure_API_version {
local conf_file=$1
local api_version=$2
iniset $conf_file keystone_authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v$api_version
}
# init_keystone() - Initialize databases, etc.
function init_keystone() {
function init_keystone {
if is_service_enabled ldap; then
init_ldap
fi
@ -377,14 +377,14 @@ function init_keystone() {
}
# install_keystoneclient() - Collect source and prepare
function install_keystoneclient() {
function install_keystoneclient {
git_clone $KEYSTONECLIENT_REPO $KEYSTONECLIENT_DIR $KEYSTONECLIENT_BRANCH
setup_develop $KEYSTONECLIENT_DIR
sudo install -D -m 0644 -o $STACK_USER {$KEYSTONECLIENT_DIR/tools/,/etc/bash_completion.d/}keystone.bash_completion
}
# install_keystone() - Collect source and prepare
function install_keystone() {
function install_keystone {
# only install ldap if the service has been enabled
if is_service_enabled ldap; then
install_ldap
@ -408,7 +408,7 @@ function install_keystone() {
}
# start_keystone() - Start running processes, including screen
function start_keystone() {
function start_keystone {
# Get right service port for testing
local service_port=$KEYSTONE_SERVICE_PORT
if is_service_enabled tls-proxy; then
@ -436,7 +436,7 @@ function start_keystone() {
}
# stop_keystone() - Stop running processes
function stop_keystone() {
function stop_keystone {
# Kill the Keystone screen window
screen_stop key
}

View File

@ -49,7 +49,7 @@ fi
# Perform common variable substitutions on the data files
# _ldap_varsubst file
function _ldap_varsubst() {
function _ldap_varsubst {
local infile=$1
sed -e "
s|\${LDAP_OLCDB_NUMBER}|$LDAP_OLCDB_NUMBER|
@ -62,7 +62,7 @@ function _ldap_varsubst() {
}
# clean_ldap() - Remove ldap server
function cleanup_ldap() {
function cleanup_ldap {
uninstall_package $(get_packages ldap)
if is_ubuntu; then
uninstall_package slapd ldap-utils libslp1
@ -76,7 +76,7 @@ function cleanup_ldap() {
# init_ldap
# init_ldap() - Initialize databases, etc.
function init_ldap() {
function init_ldap {
local keystone_ldif
TMP_LDAP_DIR=$(mktemp -d -t ldap.$$.XXXXXXXXXX)
@ -106,7 +106,7 @@ function init_ldap() {
# install_ldap
# install_ldap() - Collect source and prepare
function install_ldap() {
function install_ldap {
echo "Installing LDAP inside function"
echo "os_VENDOR is $os_VENDOR"
@ -143,17 +143,17 @@ function install_ldap() {
}
# start_ldap() - Start LDAP
function start_ldap() {
function start_ldap {
sudo service $LDAP_SERVICE_NAME restart
}
# stop_ldap() - Stop LDAP
function stop_ldap() {
function stop_ldap {
sudo service $LDAP_SERVICE_NAME stop
}
# clear_ldap_state() - Clear LDAP State
function clear_ldap_state() {
function clear_ldap_state {
ldapdelete -x -w $LDAP_PASSWORD -D "$LDAP_MANAGER_DN" -H $LDAP_URL -r "$LDAP_BASE_DN"
}

View File

@ -73,19 +73,19 @@ function is_marconi_enabled {
# cleanup_marconi() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_marconi() {
function cleanup_marconi {
if ! timeout $SERVICE_TIMEOUT sh -c "while ! mongo marconi --eval 'db.dropDatabase();'; do sleep 1; done"; then
die $LINENO "Mongo DB did not start"
fi
}
# configure_marconiclient() - Set config files, create data dirs, etc
function configure_marconiclient() {
function configure_marconiclient {
setup_develop $MARCONICLIENT_DIR
}
# configure_marconi() - Set config files, create data dirs, etc
function configure_marconi() {
function configure_marconi {
setup_develop $MARCONI_DIR
[ ! -d $MARCONI_CONF_DIR ] && sudo mkdir -m 755 -p $MARCONI_CONF_DIR
@ -110,7 +110,7 @@ function configure_marconi() {
fi
}
function configure_mongodb() {
function configure_mongodb {
# Set nssize to 2GB. This increases the number of namespaces supported
# # per database.
if is_ubuntu; then
@ -126,7 +126,7 @@ function configure_mongodb() {
}
# init_marconi() - Initialize etc.
function init_marconi() {
function init_marconi {
# Create cache dir
sudo mkdir -p $MARCONI_AUTH_CACHE_DIR
sudo chown $STACK_USER $MARCONI_AUTH_CACHE_DIR
@ -134,19 +134,19 @@ function init_marconi() {
}
# install_marconi() - Collect source and prepare
function install_marconi() {
function install_marconi {
git_clone $MARCONI_REPO $MARCONI_DIR $MARCONI_BRANCH
setup_develop $MARCONI_DIR
}
# install_marconiclient() - Collect source and prepare
function install_marconiclient() {
function install_marconiclient {
git_clone $MARCONICLIENT_REPO $MARCONICLIENT_DIR $MARCONICLIENT_BRANCH
setup_develop $MARCONICLIENT_DIR
}
# start_marconi() - Start running processes, including screen
function start_marconi() {
function start_marconi {
screen_it marconi-server "marconi-server --config-file $MARCONI_CONF"
echo "Waiting for Marconi to start..."
if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- $MARCONI_SERVICE_PROTOCOL://$MARCONI_SERVICE_HOST:$MARCONI_SERVICE_PORT/v1/health; do sleep 1; done"; then
@ -155,14 +155,14 @@ function start_marconi() {
}
# stop_marconi() - Stop running processes
function stop_marconi() {
function stop_marconi {
# Kill the marconi screen windows
for serv in marconi-server; do
screen -S $SCREEN_NAME -p $serv -X kill
done
}
function create_marconi_accounts() {
function create_marconi_accounts {
SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")

View File

@ -253,7 +253,7 @@ function is_neutron_enabled {
# configure_neutron()
# Set common config for all neutron server and agents.
function configure_neutron() {
function configure_neutron {
_configure_neutron_common
iniset_rpc_backend neutron $NEUTRON_CONF DEFAULT
@ -289,7 +289,7 @@ function configure_neutron() {
_configure_neutron_debug_command
}
function create_nova_conf_neutron() {
function create_nova_conf_neutron {
iniset $NOVA_CONF DEFAULT network_api_class "nova.network.neutronv2.api.API"
iniset $NOVA_CONF DEFAULT neutron_admin_username "$Q_ADMIN_USERNAME"
iniset $NOVA_CONF DEFAULT neutron_admin_password "$SERVICE_PASSWORD"
@ -316,7 +316,7 @@ function create_nova_conf_neutron() {
}
# create_neutron_cache_dir() - Part of the _neutron_setup_keystone() process
function create_neutron_cache_dir() {
function create_neutron_cache_dir {
# Create cache dir
sudo mkdir -p $NEUTRON_AUTH_CACHE_DIR
sudo chown $STACK_USER $NEUTRON_AUTH_CACHE_DIR
@ -330,7 +330,7 @@ function create_neutron_cache_dir() {
# service neutron admin # if enabled
# Migrated from keystone_data.sh
function create_neutron_accounts() {
function create_neutron_accounts {
SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
@ -362,7 +362,7 @@ function create_neutron_accounts() {
fi
}
function create_neutron_initial_network() {
function create_neutron_initial_network {
TENANT_ID=$(openstack project list | grep " demo " | get_field 1)
die_if_not_set $LINENO TENANT_ID "Failure retrieving TENANT_ID for demo"
@ -429,27 +429,27 @@ function create_neutron_initial_network() {
}
# init_neutron() - Initialize databases, etc.
function init_neutron() {
function init_neutron {
recreate_database $Q_DB_NAME utf8
# Run Neutron db migrations
$NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
}
# install_neutron() - Collect source and prepare
function install_neutron() {
function install_neutron {
git_clone $NEUTRON_REPO $NEUTRON_DIR $NEUTRON_BRANCH
setup_develop $NEUTRON_DIR
}
# install_neutronclient() - Collect source and prepare
function install_neutronclient() {
function install_neutronclient {
git_clone $NEUTRONCLIENT_REPO $NEUTRONCLIENT_DIR $NEUTRONCLIENT_BRANCH
setup_develop $NEUTRONCLIENT_DIR
sudo install -D -m 0644 -o $STACK_USER {$NEUTRONCLIENT_DIR/tools/,/etc/bash_completion.d/}neutron.bash_completion
}
# install_neutron_agent_packages() - Collect source and prepare
function install_neutron_agent_packages() {
function install_neutron_agent_packages {
# install packages that are specific to plugin agent(s)
if is_service_enabled q-agt q-dhcp q-l3; then
neutron_plugin_install_agent_packages
@ -461,7 +461,7 @@ function install_neutron_agent_packages() {
}
# Start running processes, including screen
function start_neutron_service_and_check() {
function start_neutron_service_and_check {
# build config-file options
local cfg_file
local CFG_FILE_OPTIONS="--config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE"
@ -477,7 +477,7 @@ function start_neutron_service_and_check() {
}
# Start running processes, including screen
function start_neutron_agents() {
function start_neutron_agents {
# Start up the neutron agents if enabled
screen_it q-agt "cd $NEUTRON_DIR && python $AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE"
screen_it q-dhcp "cd $NEUTRON_DIR && python $AGENT_DHCP_BINARY --config-file $NEUTRON_CONF --config-file=$Q_DHCP_CONF_FILE"
@ -510,7 +510,7 @@ function start_neutron_agents() {
}
# stop_neutron() - Stop running processes (non-screen)
function stop_neutron() {
function stop_neutron {
if is_service_enabled q-dhcp; then
pid=$(ps aux | awk '/[d]nsmasq.+interface=(tap|ns-)/ { print $2 }')
[ ! -z "$pid" ] && sudo kill -9 $pid
@ -535,7 +535,7 @@ function stop_neutron() {
# cleanup_neutron() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_neutron() {
function cleanup_neutron {
if is_neutron_ovs_base_plugin; then
neutron_ovs_base_cleanup
fi
@ -549,7 +549,7 @@ function cleanup_neutron() {
# _configure_neutron_common()
# Set common config for all neutron server and agents.
# This MUST be called before other ``_configure_neutron_*`` functions.
function _configure_neutron_common() {
function _configure_neutron_common {
# Put config files in ``NEUTRON_CONF_DIR`` for everyone to find
if [[ ! -d $NEUTRON_CONF_DIR ]]; then
sudo mkdir -p $NEUTRON_CONF_DIR
@ -611,7 +611,7 @@ function _configure_neutron_common() {
_neutron_setup_rootwrap
}
function _configure_neutron_debug_command() {
function _configure_neutron_debug_command {
if [[ "$Q_USE_DEBUG_COMMAND" != "True" ]]; then
return
fi
@ -628,7 +628,7 @@ function _configure_neutron_debug_command() {
neutron_plugin_configure_debug_command
}
function _configure_neutron_dhcp_agent() {
function _configure_neutron_dhcp_agent {
AGENT_DHCP_BINARY="$NEUTRON_BIN_DIR/neutron-dhcp-agent"
Q_DHCP_CONF_FILE=$NEUTRON_CONF_DIR/dhcp_agent.ini
@ -652,7 +652,7 @@ function _configure_neutron_dhcp_agent() {
neutron_plugin_configure_dhcp_agent
}
function _configure_neutron_l3_agent() {
function _configure_neutron_l3_agent {
Q_L3_ENABLED=True
# for l3-agent, only use per tenant router if we have namespaces
Q_L3_ROUTER_PER_TENANT=$Q_USE_NAMESPACE
@ -676,7 +676,7 @@ function _configure_neutron_l3_agent() {
neutron_plugin_configure_l3_agent
}
function _configure_neutron_metadata_agent() {
function _configure_neutron_metadata_agent {
AGENT_META_BINARY="$NEUTRON_BIN_DIR/neutron-metadata-agent"
Q_META_CONF_FILE=$NEUTRON_CONF_DIR/metadata_agent.ini
@ -691,30 +691,29 @@ function _configure_neutron_metadata_agent() {
}
function _configure_neutron_lbaas() {
function _configure_neutron_lbaas {
neutron_agent_lbaas_configure_common
neutron_agent_lbaas_configure_agent
}
function _configure_neutron_metering() {
function _configure_neutron_metering {
neutron_agent_metering_configure_common
neutron_agent_metering_configure_agent
}
function _configure_neutron_fwaas() {
function _configure_neutron_fwaas {
neutron_fwaas_configure_common
neutron_fwaas_configure_driver
}
function _configure_neutron_vpn()
{
function _configure_neutron_vpn {
neutron_vpn_install_agent_packages
neutron_vpn_configure_common
}
# _configure_neutron_plugin_agent() - Set config files for neutron plugin agent
# It is called when q-agt is enabled.
function _configure_neutron_plugin_agent() {
function _configure_neutron_plugin_agent {
# Specify the default root helper prior to agent configuration to
# ensure that an agent's configuration can override the default
iniset /$Q_PLUGIN_CONF_FILE agent root_helper "$Q_RR_COMMAND"
@ -727,7 +726,7 @@ function _configure_neutron_plugin_agent() {
# _configure_neutron_service() - Set config files for neutron service
# It is called when q-svc is enabled.
function _configure_neutron_service() {
function _configure_neutron_service {
Q_API_PASTE_FILE=$NEUTRON_CONF_DIR/api-paste.ini
Q_POLICY_FILE=$NEUTRON_CONF_DIR/policy.json
@ -765,7 +764,7 @@ function _configure_neutron_service() {
#------------------
# _neutron_service_plugin_class_add() - add service plugin class
function _neutron_service_plugin_class_add() {
function _neutron_service_plugin_class_add {
local service_plugin_class=$1
if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
Q_SERVICE_PLUGIN_CLASSES=$service_plugin_class
@ -775,7 +774,7 @@ function _neutron_service_plugin_class_add() {
}
# _neutron_setup_rootwrap() - configure Neutron's rootwrap
function _neutron_setup_rootwrap() {
function _neutron_setup_rootwrap {
if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
return
fi
@ -815,7 +814,7 @@ function _neutron_setup_rootwrap() {
}
# Configures keystone integration for neutron service and agents
function _neutron_setup_keystone() {
function _neutron_setup_keystone {
local conf_file=$1
local section=$2
local use_auth_url=$3
@ -842,7 +841,7 @@ function _neutron_setup_keystone() {
fi
}
function _neutron_setup_interface_driver() {
function _neutron_setup_interface_driver {
# ovs_use_veth needs to be set before the plugin configuration
# occurs to allow plugins to override the setting.
@ -854,14 +853,14 @@ function _neutron_setup_interface_driver() {
# Functions for Neutron Exercises
#--------------------------------
function delete_probe() {
function delete_probe {
local from_net="$1"
net_id=`_get_net_id $from_net`
probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}'`
neutron-debug --os-tenant-name admin --os-username admin probe-delete $probe_id
}
function setup_neutron_debug() {
function setup_neutron_debug {
if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
public_net_id=`_get_net_id $PUBLIC_NETWORK_NAME`
neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create --device-owner compute $public_net_id
@ -870,23 +869,23 @@ function setup_neutron_debug() {
fi
}
function teardown_neutron_debug() {
function teardown_neutron_debug {
delete_probe $PUBLIC_NETWORK_NAME
delete_probe $PRIVATE_NETWORK_NAME
}
function _get_net_id() {
function _get_net_id {
neutron --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk '{print $2}'
}
function _get_probe_cmd_prefix() {
function _get_probe_cmd_prefix {
local from_net="$1"
net_id=`_get_net_id $from_net`
probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}' | head -n 1`
echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id"
}
function _ping_check_neutron() {
function _ping_check_neutron {
local from_net=$1
local ip=$2
local timeout_sec=$3
@ -908,7 +907,7 @@ function _ping_check_neutron() {
}
# ssh check
function _ssh_check_neutron() {
function _ssh_check_neutron {
local from_net=$1
local key_file=$2
local ip=$3
@ -934,39 +933,39 @@ for f in $TOP_DIR/lib/neutron_thirdparty/*; do
fi
done
function _neutron_third_party_do() {
function _neutron_third_party_do {
for third_party in ${NEUTRON_THIRD_PARTIES//,/ }; do
${1}_${third_party}
done
}
# configure_neutron_third_party() - Set config files, create data dirs, etc
function configure_neutron_third_party() {
function configure_neutron_third_party {
_neutron_third_party_do configure
}
# init_neutron_third_party() - Initialize databases, etc.
function init_neutron_third_party() {
function init_neutron_third_party {
_neutron_third_party_do init
}
# install_neutron_third_party() - Collect source and prepare
function install_neutron_third_party() {
function install_neutron_third_party {
_neutron_third_party_do install
}
# start_neutron_third_party() - Start running processes, including screen
function start_neutron_third_party() {
function start_neutron_third_party {
_neutron_third_party_do start
}
# stop_neutron_third_party - Stop running processes (non-screen)
function stop_neutron_third_party() {
function stop_neutron_third_party {
_neutron_third_party_do stop
}
# check_neutron_third_party_integration() - Check that third party integration is sane
function check_neutron_third_party_integration() {
function check_neutron_third_party_integration {
_neutron_third_party_do check
}

View File

@ -8,15 +8,15 @@ set +o xtrace
source $TOP_DIR/lib/neutron_plugins/ovs_base
source $TOP_DIR/lib/neutron_thirdparty/bigswitch_floodlight # for third party service specific configuration values
function neutron_plugin_create_nova_conf() {
function neutron_plugin_create_nova_conf {
:
}
function neutron_plugin_install_agent_packages() {
function neutron_plugin_install_agent_packages {
_neutron_ovs_base_install_agent_packages
}
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/bigswitch
Q_PLUGIN_CONF_FILENAME=restproxy.ini
Q_DB_NAME="restproxy_neutron"
@ -25,23 +25,23 @@ function neutron_plugin_configure_common() {
BS_FL_CONTROLLER_TIMEOUT=${BS_FL_CONTROLLER_TIMEOUT:-10}
}
function neutron_plugin_configure_debug_command() {
function neutron_plugin_configure_debug_command {
_neutron_ovs_base_configure_debug_command
}
function neutron_plugin_configure_dhcp_agent() {
function neutron_plugin_configure_dhcp_agent {
:
}
function neutron_plugin_configure_l3_agent() {
function neutron_plugin_configure_l3_agent {
_neutron_ovs_base_configure_l3_agent
}
function neutron_plugin_configure_plugin_agent() {
function neutron_plugin_configure_plugin_agent {
:
}
function neutron_plugin_configure_service() {
function neutron_plugin_configure_service {
iniset /$Q_PLUGIN_CONF_FILE restproxy servers $BS_FL_CONTROLLERS_PORT
iniset /$Q_PLUGIN_CONF_FILE restproxy servertimeout $BS_FL_CONTROLLER_TIMEOUT
if [ "$BS_FL_VIF_DRIVER" = "ivs" ]; then
@ -49,7 +49,7 @@ function neutron_plugin_configure_service() {
fi
}
function neutron_plugin_setup_interface_driver() {
function neutron_plugin_setup_interface_driver {
local conf_file=$1
if [ "$BS_FL_VIF_DRIVER" = "ivs" ]; then
iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.IVSInterfaceDriver
@ -59,12 +59,12 @@ function neutron_plugin_setup_interface_driver() {
}
function has_neutron_plugin_security_group() {
function has_neutron_plugin_security_group {
# 1 means False here
return 1
}
function neutron_plugin_check_adv_test_requirements() {
function neutron_plugin_check_adv_test_requirements {
is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
}

View File

@ -5,53 +5,53 @@
BRCD_XTRACE=$(set +o | grep xtrace)
set +o xtrace
function is_neutron_ovs_base_plugin() {
function is_neutron_ovs_base_plugin {
return 1
}
function neutron_plugin_create_nova_conf() {
function neutron_plugin_create_nova_conf {
NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"}
}
function neutron_plugin_install_agent_packages() {
function neutron_plugin_install_agent_packages {
install_package bridge-utils
}
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/brocade
Q_PLUGIN_CONF_FILENAME=brocade.ini
Q_DB_NAME="brcd_neutron"
Q_PLUGIN_CLASS="neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2"
}
function neutron_plugin_configure_debug_command() {
function neutron_plugin_configure_debug_command {
iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge
}
function neutron_plugin_configure_dhcp_agent() {
function neutron_plugin_configure_dhcp_agent {
iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
}
function neutron_plugin_configure_l3_agent() {
function neutron_plugin_configure_l3_agent {
iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge
iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport
}
function neutron_plugin_configure_plugin_agent() {
function neutron_plugin_configure_plugin_agent {
AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent"
}
function neutron_plugin_setup_interface_driver() {
function neutron_plugin_setup_interface_driver {
local conf_file=$1
iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver
}
function has_neutron_plugin_security_group() {
function has_neutron_plugin_security_group {
# 0 means True here
return 0
}
function neutron_plugin_check_adv_test_requirements() {
function neutron_plugin_check_adv_test_requirements {
is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
}

View File

@ -27,12 +27,12 @@ NCCLIENT_REPO=${NCCLIENT_REPO:-${GIT_BASE}/CiscoSystems/ncclient.git}
NCCLIENT_BRANCH=${NCCLIENT_BRANCH:-master}
# This routine put a prefix on an existing function name
function _prefix_function() {
function _prefix_function {
declare -F $1 > /dev/null || die "$1 doesn't exist"
eval "$(echo "${2}_${1}()"; declare -f ${1} | tail -n +2)"
}
function _has_ovs_subplugin() {
function _has_ovs_subplugin {
local subplugin
for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do
if [[ "$subplugin" == "openvswitch" ]]; then
@ -42,7 +42,7 @@ function _has_ovs_subplugin() {
return 1
}
function _has_nexus_subplugin() {
function _has_nexus_subplugin {
local subplugin
for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do
if [[ "$subplugin" == "nexus" ]]; then
@ -52,7 +52,7 @@ function _has_nexus_subplugin() {
return 1
}
function _has_n1kv_subplugin() {
function _has_n1kv_subplugin {
local subplugin
for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do
if [[ "$subplugin" == "n1kv" ]]; then
@ -64,7 +64,7 @@ function _has_n1kv_subplugin() {
# This routine populates the cisco config file with the information for
# a particular nexus switch
function _config_switch() {
function _config_switch {
local cisco_cfg_file=$1
local switch_ip=$2
local username=$3
@ -99,7 +99,7 @@ _prefix_function neutron_plugin_setup_interface_driver ovs
_prefix_function has_neutron_plugin_security_group ovs
# Check the version of the installed ncclient package
function check_ncclient_version() {
function check_ncclient_version {
python << EOF
version = '$NCCLIENT_VERSION'
import sys
@ -115,13 +115,13 @@ EOF
}
# Install the ncclient package
function install_ncclient() {
function install_ncclient {
git_clone $NCCLIENT_REPO $NCCLIENT_DIR $NCCLIENT_BRANCH
(cd $NCCLIENT_DIR; sudo python setup.py install)
}
# Check if the required version of ncclient has been installed
function is_ncclient_installed() {
function is_ncclient_installed {
# Check if the Cisco ncclient repository exists
if [[ -d $NCCLIENT_DIR ]]; then
remotes=$(cd $NCCLIENT_DIR; git remote -v | grep fetch | awk '{ print $2}')
@ -144,7 +144,7 @@ function is_ncclient_installed() {
return 0
}
function has_neutron_plugin_security_group() {
function has_neutron_plugin_security_group {
if _has_ovs_subplugin; then
ovs_has_neutron_plugin_security_group
else
@ -152,14 +152,14 @@ function has_neutron_plugin_security_group() {
fi
}
function is_neutron_ovs_base_plugin() {
function is_neutron_ovs_base_plugin {
# Cisco uses OVS if openvswitch subplugin is deployed
_has_ovs_subplugin
return
}
# populate required nova configuration parameters
function neutron_plugin_create_nova_conf() {
function neutron_plugin_create_nova_conf {
if _has_ovs_subplugin; then
ovs_neutron_plugin_create_nova_conf
else
@ -167,13 +167,13 @@ function neutron_plugin_create_nova_conf() {
fi
}
function neutron_plugin_install_agent_packages() {
function neutron_plugin_install_agent_packages {
# Cisco plugin uses openvswitch to operate in one of its configurations
ovs_neutron_plugin_install_agent_packages
}
# Configure common parameters
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
# setup default subplugins
if [ ! -v Q_CISCO_PLUGIN_SUBPLUGINS ]; then
declare -ga Q_CISCO_PLUGIN_SUBPLUGINS
@ -191,23 +191,23 @@ function neutron_plugin_configure_common() {
Q_DB_NAME=cisco_neutron
}
function neutron_plugin_configure_debug_command() {
function neutron_plugin_configure_debug_command {
if _has_ovs_subplugin; then
ovs_neutron_plugin_configure_debug_command
fi
}
function neutron_plugin_configure_dhcp_agent() {
function neutron_plugin_configure_dhcp_agent {
iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
}
function neutron_plugin_configure_l3_agent() {
function neutron_plugin_configure_l3_agent {
if _has_ovs_subplugin; then
ovs_neutron_plugin_configure_l3_agent
fi
}
function _configure_nexus_subplugin() {
function _configure_nexus_subplugin {
local cisco_cfg_file=$1
# Install a known compatible ncclient from the Cisco repository if necessary
@ -252,7 +252,7 @@ function _configure_nexus_subplugin() {
}
# Configure n1kv plugin
function _configure_n1kv_subplugin() {
function _configure_n1kv_subplugin {
local cisco_cfg_file=$1
# populate the cisco plugin cfg file with the VSM information
@ -270,13 +270,13 @@ function _configure_n1kv_subplugin() {
_neutron_ovs_base_setup_bridge $OVS_BRIDGE
}
function neutron_plugin_configure_plugin_agent() {
function neutron_plugin_configure_plugin_agent {
if _has_ovs_subplugin; then
ovs_neutron_plugin_configure_plugin_agent
fi
}
function neutron_plugin_configure_service() {
function neutron_plugin_configure_service {
local subplugin
local cisco_cfg_file
@ -318,7 +318,7 @@ function neutron_plugin_configure_service() {
fi
}
function neutron_plugin_setup_interface_driver() {
function neutron_plugin_setup_interface_driver {
local conf_file=$1
iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver
}

View File

@ -7,7 +7,7 @@ set +o xtrace
source $TOP_DIR/lib/neutron_plugins/openvswitch
save_function() {
function save_function {
local ORIG_FUNC=$(declare -f $1)
local NEW_FUNC="$2${ORIG_FUNC#$1}"
eval "$NEW_FUNC"
@ -15,14 +15,14 @@ save_function() {
save_function neutron_plugin_configure_service _neutron_plugin_configure_service
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/embrane
Q_PLUGIN_CONF_FILENAME=heleos_conf.ini
Q_DB_NAME="ovs_neutron"
Q_PLUGIN_CLASS="neutron.plugins.embrane.plugins.embrane_ovs_plugin.EmbraneOvsPlugin"
}
function neutron_plugin_configure_service() {
function neutron_plugin_configure_service {
_neutron_plugin_configure_service
iniset /$Q_PLUGIN_CONF_FILE heleos esm_mgmt $HELEOS_ESM_MGMT
iniset /$Q_PLUGIN_CONF_FILE heleos admin_username $HELEOS_ADMIN_USERNAME

View File

@ -7,14 +7,14 @@ set +o xtrace
source $TOP_DIR/lib/neutron_plugins/linuxbridge_agent
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/linuxbridge
Q_PLUGIN_CONF_FILENAME=linuxbridge_conf.ini
Q_DB_NAME="neutron_linux_bridge"
Q_PLUGIN_CLASS="neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2"
}
function neutron_plugin_configure_service() {
function neutron_plugin_configure_service {
if [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then
iniset /$Q_PLUGIN_CONF_FILE vlans tenant_network_type vlan
else
@ -47,7 +47,7 @@ function neutron_plugin_configure_service() {
done
}
function has_neutron_plugin_security_group() {
function has_neutron_plugin_security_group {
# 0 means True here
return 0
}

View File

@ -5,33 +5,33 @@
PLUGIN_XTRACE=$(set +o | grep xtrace)
set +o xtrace
function is_neutron_ovs_base_plugin() {
function is_neutron_ovs_base_plugin {
# linuxbridge doesn't use OVS
return 1
}
function neutron_plugin_create_nova_conf() {
function neutron_plugin_create_nova_conf {
:
}
function neutron_plugin_install_agent_packages() {
function neutron_plugin_install_agent_packages {
install_package bridge-utils
}
function neutron_plugin_configure_debug_command() {
function neutron_plugin_configure_debug_command {
iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge
}
function neutron_plugin_configure_dhcp_agent() {
function neutron_plugin_configure_dhcp_agent {
iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
}
function neutron_plugin_configure_l3_agent() {
function neutron_plugin_configure_l3_agent {
iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge
iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport
}
function neutron_plugin_configure_plugin_agent() {
function neutron_plugin_configure_plugin_agent {
# Setup physical network interface mappings. Override
# ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more
# complex physical network configurations.
@ -63,12 +63,12 @@ function neutron_plugin_configure_plugin_agent() {
done
}
function neutron_plugin_setup_interface_driver() {
function neutron_plugin_setup_interface_driver {
local conf_file=$1
iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver
}
function neutron_plugin_check_adv_test_requirements() {
function neutron_plugin_check_adv_test_requirements {
is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
}

View File

@ -9,32 +9,32 @@ MIDONET_API_URL=${MIDONET_API_URL:-http://localhost:$MIDONET_API_PORT/midonet-ap
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
function is_neutron_ovs_base_plugin() {
function is_neutron_ovs_base_plugin {
# MidoNet does not use l3-agent
# 0 means True here
return 1
}
function neutron_plugin_create_nova_conf() {
function neutron_plugin_create_nova_conf {
NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"}
}
function neutron_plugin_install_agent_packages() {
function neutron_plugin_install_agent_packages {
:
}
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/midonet
Q_PLUGIN_CONF_FILENAME=midonet.ini
Q_DB_NAME="neutron_midonet"
Q_PLUGIN_CLASS="neutron.plugins.midonet.plugin.MidonetPluginV2"
}
function neutron_plugin_configure_debug_command() {
function neutron_plugin_configure_debug_command {
:
}
function neutron_plugin_configure_dhcp_agent() {
function neutron_plugin_configure_dhcp_agent {
DHCP_DRIVER=${DHCP_DRIVER:-"neutron.plugins.midonet.agent.midonet_driver.DhcpNoOpDriver"}
neutron_plugin_setup_interface_driver $Q_DHCP_CONF_FILE
iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_driver $DHCP_DRIVER
@ -42,15 +42,15 @@ function neutron_plugin_configure_dhcp_agent() {
iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True
}
function neutron_plugin_configure_l3_agent() {
function neutron_plugin_configure_l3_agent {
die $LINENO "q-l3 must not be executed with MidoNet plugin!"
}
function neutron_plugin_configure_plugin_agent() {
function neutron_plugin_configure_plugin_agent {
die $LINENO "q-agt must not be executed with MidoNet plugin!"
}
function neutron_plugin_configure_service() {
function neutron_plugin_configure_service {
if [[ "$MIDONET_API_URL" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE MIDONET midonet_uri $MIDONET_API_URL
fi
@ -68,17 +68,17 @@ function neutron_plugin_configure_service() {
Q_L3_ROUTER_PER_TENANT=True
}
function neutron_plugin_setup_interface_driver() {
function neutron_plugin_setup_interface_driver {
local conf_file=$1
iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.MidonetInterfaceDriver
}
function has_neutron_plugin_security_group() {
function has_neutron_plugin_security_group {
# 0 means True here
return 0
}
function neutron_plugin_check_adv_test_requirements() {
function neutron_plugin_check_adv_test_requirements {
# 0 means True here
return 1
}

View File

@ -33,7 +33,7 @@ Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS=${Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS:-}
# L3 Plugin to load for ML2
ML2_L3_PLUGIN=${ML2_L3_PLUGIN:-neutron.services.l3_router.l3_router_plugin.L3RouterPlugin}
function populate_ml2_config() {
function populate_ml2_config {
CONF=$1
SECTION=$2
OPTS=$3
@ -47,7 +47,7 @@ function populate_ml2_config() {
done
}
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/ml2
Q_PLUGIN_CONF_FILENAME=ml2_conf.ini
Q_DB_NAME="neutron_ml2"
@ -57,7 +57,7 @@ function neutron_plugin_configure_common() {
_neutron_service_plugin_class_add $ML2_L3_PLUGIN
}
function neutron_plugin_configure_service() {
function neutron_plugin_configure_service {
if [[ "$Q_ML2_TENANT_NETWORK_TYPE" != "" ]]; then
Q_SRV_EXTRA_OPTS+=(tenant_network_types=$Q_ML2_TENANT_NETWORK_TYPE)
elif [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then
@ -114,7 +114,7 @@ function neutron_plugin_configure_service() {
populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2_type_vlan $Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS
}
function has_neutron_plugin_security_group() {
function has_neutron_plugin_security_group {
return 0
}

View File

@ -22,11 +22,11 @@ OFC_RETRY_INTERVAL=${OFC_RETRY_INTERVAL:-1}
source $TOP_DIR/lib/neutron_plugins/ovs_base
function neutron_plugin_create_nova_conf() {
function neutron_plugin_create_nova_conf {
_neutron_ovs_base_configure_nova_vif_driver
}
function neutron_plugin_install_agent_packages() {
function neutron_plugin_install_agent_packages {
# SKIP_OVS_INSTALL is useful when we want to use Open vSwitch whose
# version is different from the version provided by the distribution.
if [[ "$SKIP_OVS_INSTALL" = "True" ]]; then
@ -36,26 +36,26 @@ function neutron_plugin_install_agent_packages() {
_neutron_ovs_base_install_agent_packages
}
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/nec
Q_PLUGIN_CONF_FILENAME=nec.ini
Q_DB_NAME="neutron_nec"
Q_PLUGIN_CLASS="neutron.plugins.nec.nec_plugin.NECPluginV2"
}
function neutron_plugin_configure_debug_command() {
function neutron_plugin_configure_debug_command {
_neutron_ovs_base_configure_debug_command
}
function neutron_plugin_configure_dhcp_agent() {
function neutron_plugin_configure_dhcp_agent {
:
}
function neutron_plugin_configure_l3_agent() {
function neutron_plugin_configure_l3_agent {
_neutron_ovs_base_configure_l3_agent
}
function _quantum_plugin_setup_bridge() {
function _quantum_plugin_setup_bridge {
if [[ "$SKIP_OVS_BRIDGE_SETUP" = "True" ]]; then
return
fi
@ -72,7 +72,7 @@ function _quantum_plugin_setup_bridge() {
_neutron_setup_ovs_tunnels $OVS_BRIDGE
}
function neutron_plugin_configure_plugin_agent() {
function neutron_plugin_configure_plugin_agent {
_quantum_plugin_setup_bridge
AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-nec-agent"
@ -80,7 +80,7 @@ function neutron_plugin_configure_plugin_agent() {
_neutron_ovs_base_configure_firewall_driver
}
function neutron_plugin_configure_service() {
function neutron_plugin_configure_service {
iniset $NEUTRON_CONF DEFAULT api_extensions_path neutron/plugins/nec/extensions/
iniset /$Q_PLUGIN_CONF_FILE ofc host $OFC_API_HOST
iniset /$Q_PLUGIN_CONF_FILE ofc port $OFC_API_PORT
@ -91,7 +91,7 @@ function neutron_plugin_configure_service() {
_neutron_ovs_base_configure_firewall_driver
}
function neutron_plugin_setup_interface_driver() {
function neutron_plugin_setup_interface_driver {
local conf_file=$1
iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver
iniset $conf_file DEFAULT ovs_use_veth True
@ -101,7 +101,7 @@ function neutron_plugin_setup_interface_driver() {
# ---------------------------
# Setup OVS tunnel manually
function _neutron_setup_ovs_tunnels() {
function _neutron_setup_ovs_tunnels {
local bridge=$1
local id=0
GRE_LOCAL_IP=${GRE_LOCAL_IP:-$HOST_IP}
@ -117,12 +117,12 @@ function _neutron_setup_ovs_tunnels() {
fi
}
function has_neutron_plugin_security_group() {
function has_neutron_plugin_security_group {
# 0 means True here
return 0
}
function neutron_plugin_check_adv_test_requirements() {
function neutron_plugin_check_adv_test_requirements {
is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
}

View File

@ -7,14 +7,14 @@ set +o xtrace
source $TOP_DIR/lib/neutron_plugins/openvswitch_agent
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/openvswitch
Q_PLUGIN_CONF_FILENAME=ovs_neutron_plugin.ini
Q_DB_NAME="ovs_neutron"
Q_PLUGIN_CLASS="neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2"
}
function neutron_plugin_configure_service() {
function neutron_plugin_configure_service {
if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then
iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type gre
iniset /$Q_PLUGIN_CONF_FILE ovs tunnel_id_ranges $TENANT_TUNNEL_RANGES
@ -52,7 +52,7 @@ function neutron_plugin_configure_service() {
done
}
function has_neutron_plugin_security_group() {
function has_neutron_plugin_security_group {
return 0
}

View File

@ -7,7 +7,7 @@ set +o xtrace
source $TOP_DIR/lib/neutron_plugins/ovs_base
function neutron_plugin_create_nova_conf() {
function neutron_plugin_create_nova_conf {
_neutron_ovs_base_configure_nova_vif_driver
if [ "$VIRT_DRIVER" = 'xenserver' ]; then
iniset $NOVA_CONF DEFAULT xenapi_vif_driver nova.virt.xenapi.vif.XenAPIOpenVswitchDriver
@ -17,24 +17,24 @@ function neutron_plugin_create_nova_conf() {
fi
}
function neutron_plugin_install_agent_packages() {
function neutron_plugin_install_agent_packages {
_neutron_ovs_base_install_agent_packages
}
function neutron_plugin_configure_debug_command() {
function neutron_plugin_configure_debug_command {
_neutron_ovs_base_configure_debug_command
}
function neutron_plugin_configure_dhcp_agent() {
function neutron_plugin_configure_dhcp_agent {
iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
}
function neutron_plugin_configure_l3_agent() {
function neutron_plugin_configure_l3_agent {
_neutron_ovs_base_configure_l3_agent
iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport
}
function neutron_plugin_configure_plugin_agent() {
function neutron_plugin_configure_plugin_agent {
# Setup integration bridge
_neutron_ovs_base_setup_bridge $OVS_BRIDGE
_neutron_ovs_base_configure_firewall_driver
@ -118,12 +118,12 @@ function neutron_plugin_configure_plugin_agent() {
done
}
function neutron_plugin_setup_interface_driver() {
function neutron_plugin_setup_interface_driver {
local conf_file=$1
iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver
}
function neutron_plugin_check_adv_test_requirements() {
function neutron_plugin_check_adv_test_requirements {
is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
}

View File

@ -8,19 +8,19 @@ set +o xtrace
OVS_BRIDGE=${OVS_BRIDGE:-br-int}
PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex}
function is_neutron_ovs_base_plugin() {
function is_neutron_ovs_base_plugin {
# Yes, we use OVS.
return 0
}
function _neutron_ovs_base_setup_bridge() {
function _neutron_ovs_base_setup_bridge {
local bridge=$1
neutron-ovs-cleanup
sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge
sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge
}
function neutron_ovs_base_cleanup() {
function neutron_ovs_base_cleanup {
# remove all OVS ports that look like Neutron created ports
for port in $(sudo ovs-vsctl list port | grep -o -e tap[0-9a-f\-]* -e q[rg]-[0-9a-f\-]*); do
sudo ovs-vsctl del-port ${port}
@ -32,7 +32,7 @@ function neutron_ovs_base_cleanup() {
done
}
function _neutron_ovs_base_install_agent_packages() {
function _neutron_ovs_base_install_agent_packages {
local kernel_version
# Install deps
# FIXME add to ``files/apts/neutron``, but don't install if not needed!
@ -50,11 +50,11 @@ function _neutron_ovs_base_install_agent_packages() {
fi
}
function _neutron_ovs_base_configure_debug_command() {
function _neutron_ovs_base_configure_debug_command {
iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
}
function _neutron_ovs_base_configure_firewall_driver() {
function _neutron_ovs_base_configure_firewall_driver {
if [[ "$Q_USE_SECGROUP" == "True" ]]; then
iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
else
@ -62,7 +62,7 @@ function _neutron_ovs_base_configure_firewall_driver() {
fi
}
function _neutron_ovs_base_configure_l3_agent() {
function _neutron_ovs_base_configure_l3_agent {
iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
neutron-ovs-cleanup
@ -72,7 +72,7 @@ function _neutron_ovs_base_configure_l3_agent() {
sudo ip addr flush dev $PUBLIC_BRIDGE
}
function _neutron_ovs_base_configure_nova_vif_driver() {
function _neutron_ovs_base_configure_nova_vif_driver {
:
}

View File

@ -6,15 +6,15 @@
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
function neutron_plugin_create_nova_conf() {
function neutron_plugin_create_nova_conf {
:
}
function neutron_plugin_setup_interface_driver() {
function neutron_plugin_setup_interface_driver {
:
}
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/plumgrid
Q_PLUGIN_CONF_FILENAME=plumgrid.ini
Q_DB_NAME="plumgrid_neutron"
@ -26,7 +26,7 @@ function neutron_plugin_configure_common() {
PLUMGRID_TIMEOUT=${PLUMGRID_TIMEOUT:-70}
}
function neutron_plugin_configure_service() {
function neutron_plugin_configure_service {
iniset /$Q_PLUGIN_CONF_FILE PLUMgridDirector director_server $PLUMGRID_DIRECTOR_IP
iniset /$Q_PLUGIN_CONF_FILE PLUMgridDirector director_server_port $PLUMGRID_DIRECTOR_PORT
iniset /$Q_PLUGIN_CONF_FILE PLUMgridDirector username $PLUMGRID_ADMIN
@ -34,21 +34,21 @@ function neutron_plugin_configure_service() {
iniset /$Q_PLUGIN_CONF_FILE PLUMgridDirector servertimeout $PLUMGRID_TIMEOUT
}
function neutron_plugin_configure_debug_command() {
function neutron_plugin_configure_debug_command {
:
}
function is_neutron_ovs_base_plugin() {
function is_neutron_ovs_base_plugin {
# False
return 1
}
function has_neutron_plugin_security_group() {
function has_neutron_plugin_security_group {
# False
return 1
}
function neutron_plugin_check_adv_test_requirements() {
function neutron_plugin_check_adv_test_requirements {
is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
}
# Restore xtrace

View File

@ -8,12 +8,12 @@ set +o xtrace
source $TOP_DIR/lib/neutron_plugins/ovs_base
source $TOP_DIR/lib/neutron_thirdparty/ryu # for configuration value
function neutron_plugin_create_nova_conf() {
function neutron_plugin_create_nova_conf {
_neutron_ovs_base_configure_nova_vif_driver
iniset $NOVA_CONF DEFAULT libvirt_ovs_integration_bridge "$OVS_BRIDGE"
}
function neutron_plugin_install_agent_packages() {
function neutron_plugin_install_agent_packages {
_neutron_ovs_base_install_agent_packages
# neutron_ryu_agent requires ryu module
@ -22,28 +22,28 @@ function neutron_plugin_install_agent_packages() {
configure_ryu
}
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/ryu
Q_PLUGIN_CONF_FILENAME=ryu.ini
Q_DB_NAME="ovs_neutron"
Q_PLUGIN_CLASS="neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2"
}
function neutron_plugin_configure_debug_command() {
function neutron_plugin_configure_debug_command {
_neutron_ovs_base_configure_debug_command
iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT
}
function neutron_plugin_configure_dhcp_agent() {
function neutron_plugin_configure_dhcp_agent {
iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT
}
function neutron_plugin_configure_l3_agent() {
function neutron_plugin_configure_l3_agent {
iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT
_neutron_ovs_base_configure_l3_agent
}
function neutron_plugin_configure_plugin_agent() {
function neutron_plugin_configure_plugin_agent {
# Set up integration bridge
_neutron_ovs_base_setup_bridge $OVS_BRIDGE
if [ -n "$RYU_INTERNAL_INTERFACE" ]; then
@ -55,24 +55,24 @@ function neutron_plugin_configure_plugin_agent() {
_neutron_ovs_base_configure_firewall_driver
}
function neutron_plugin_configure_service() {
function neutron_plugin_configure_service {
iniset /$Q_PLUGIN_CONF_FILE ovs openflow_rest_api $RYU_API_HOST:$RYU_API_PORT
_neutron_ovs_base_configure_firewall_driver
}
function neutron_plugin_setup_interface_driver() {
function neutron_plugin_setup_interface_driver {
local conf_file=$1
iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver
iniset $conf_file DEFAULT ovs_use_veth True
}
function has_neutron_plugin_security_group() {
function has_neutron_plugin_security_group {
# 0 means True here
return 0
}
function neutron_plugin_check_adv_test_requirements() {
function neutron_plugin_check_adv_test_requirements {
is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
}

View File

@ -7,11 +7,11 @@ set +o xtrace
FWAAS_PLUGIN=neutron.services.firewall.fwaas_plugin.FirewallPlugin
function neutron_fwaas_configure_common() {
function neutron_fwaas_configure_common {
_neutron_service_plugin_class_add $FWAAS_PLUGIN
}
function neutron_fwaas_configure_driver() {
function neutron_fwaas_configure_driver {
FWAAS_DRIVER_CONF_FILENAME=/etc/neutron/fwaas_driver.ini
cp $NEUTRON_DIR/etc/fwaas_driver.ini $FWAAS_DRIVER_CONF_FILENAME
@ -19,7 +19,7 @@ function neutron_fwaas_configure_driver() {
iniset_multiline $FWAAS_DRIVER_CONF_FILENAME fwaas driver "neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver"
}
function neutron_fwaas_stop() {
function neutron_fwaas_stop {
:
}

View File

@ -9,7 +9,7 @@ set +o xtrace
AGENT_LBAAS_BINARY="$NEUTRON_BIN_DIR/neutron-lbaas-agent"
LBAAS_PLUGIN=neutron.services.loadbalancer.plugin.LoadBalancerPlugin
function neutron_agent_lbaas_install_agent_packages() {
function neutron_agent_lbaas_install_agent_packages {
if is_ubuntu || is_fedora; then
install_package haproxy
elif is_suse; then
@ -18,11 +18,11 @@ function neutron_agent_lbaas_install_agent_packages() {
fi
}
function neutron_agent_lbaas_configure_common() {
function neutron_agent_lbaas_configure_common {
_neutron_service_plugin_class_add $LBAAS_PLUGIN
}
function neutron_agent_lbaas_configure_agent() {
function neutron_agent_lbaas_configure_agent {
LBAAS_AGENT_CONF_PATH=/etc/neutron/services/loadbalancer/haproxy
mkdir -p $LBAAS_AGENT_CONF_PATH
@ -41,7 +41,7 @@ function neutron_agent_lbaas_configure_agent() {
fi
}
function neutron_lbaas_stop() {
function neutron_lbaas_stop {
pids=$(ps aux | awk '/haproxy/ { print $2 }')
[ ! -z "$pids" ] && sudo kill $pids
}

View File

@ -9,11 +9,11 @@ set +o xtrace
AGENT_METERING_BINARY="$NEUTRON_BIN_DIR/neutron-metering-agent"
METERING_PLUGIN="neutron.services.metering.metering_plugin.MeteringPlugin"
function neutron_agent_metering_configure_common() {
function neutron_agent_metering_configure_common {
_neutron_service_plugin_class_add $METERING_PLUGIN
}
function neutron_agent_metering_configure_agent() {
function neutron_agent_metering_configure_agent {
METERING_AGENT_CONF_PATH=/etc/neutron/services/metering
mkdir -p $METERING_AGENT_CONF_PATH
@ -22,7 +22,7 @@ function neutron_agent_metering_configure_agent() {
cp $NEUTRON_DIR/etc/metering_agent.ini $METERING_AGENT_CONF_FILENAME
}
function neutron_metering_stop() {
function neutron_metering_stop {
:
}

View File

@ -10,15 +10,15 @@ AGENT_VPN_BINARY="$NEUTRON_BIN_DIR/neutron-vpn-agent"
VPN_PLUGIN="neutron.services.vpn.plugin.VPNDriverPlugin"
IPSEC_PACKAGE=${IPSEC_PACKAGE:-"openswan"}
function neutron_vpn_install_agent_packages() {
function neutron_vpn_install_agent_packages {
install_package $IPSEC_PACKAGE
}
function neutron_vpn_configure_common() {
function neutron_vpn_configure_common {
_neutron_service_plugin_class_add $VPN_PLUGIN
}
function neutron_vpn_stop() {
function neutron_vpn_stop {
local ipsec_data_dir=$DATA_DIR/neutron/ipsec
local pids
if [ -d $ipsec_data_dir ]; then

View File

@ -7,7 +7,7 @@ set +o xtrace
source $TOP_DIR/lib/neutron_plugins/ovs_base
function setup_integration_bridge() {
function setup_integration_bridge {
_neutron_ovs_base_setup_bridge $OVS_BRIDGE
# Set manager to NSX controller (1st of list)
if [[ "$NSX_CONTROLLERS" != "" ]]; then
@ -20,24 +20,24 @@ function setup_integration_bridge() {
sudo ovs-vsctl set-manager ssl:$OVS_MGR_IP
}
function is_neutron_ovs_base_plugin() {
function is_neutron_ovs_base_plugin {
# NSX uses OVS, but not the l3-agent
return 0
}
function neutron_plugin_create_nova_conf() {
function neutron_plugin_create_nova_conf {
# if n-cpu is enabled, then setup integration bridge
if is_service_enabled n-cpu; then
setup_integration_bridge
fi
}
function neutron_plugin_install_agent_packages() {
function neutron_plugin_install_agent_packages {
# VMware NSX Plugin does not run q-agt, but it currently needs dhcp and metadata agents
_neutron_ovs_base_install_agent_packages
}
function neutron_plugin_configure_common() {
function neutron_plugin_configure_common {
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/vmware
Q_PLUGIN_CONF_FILENAME=nsx.ini
Q_DB_NAME="neutron_nsx"
@ -45,29 +45,29 @@ function neutron_plugin_configure_common() {
Q_PLUGIN_CLASS="neutron.plugins.nicira.NeutronPlugin.NvpPluginV2"
}
function neutron_plugin_configure_debug_command() {
function neutron_plugin_configure_debug_command {
sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE
iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge "$PUBLIC_BRIDGE"
}
function neutron_plugin_configure_dhcp_agent() {
function neutron_plugin_configure_dhcp_agent {
setup_integration_bridge
iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True
iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network True
iniset $Q_DHCP_CONF_FILE DEFAULT ovs_use_veth True
}
function neutron_plugin_configure_l3_agent() {
function neutron_plugin_configure_l3_agent {
# VMware NSX plugin does not run L3 agent
die $LINENO "q-l3 should must not be executed with VMware NSX plugin!"
}
function neutron_plugin_configure_plugin_agent() {
function neutron_plugin_configure_plugin_agent {
# VMware NSX plugin does not run L2 agent
die $LINENO "q-agt must not be executed with VMware NSX plugin!"
}
function neutron_plugin_configure_service() {
function neutron_plugin_configure_service {
if [[ "$MAX_LP_PER_BRIDGED_LS" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE nsx max_lp_per_bridged_ls $MAX_LP_PER_BRIDGED_LS
fi
@ -132,17 +132,17 @@ function neutron_plugin_configure_service() {
fi
}
function neutron_plugin_setup_interface_driver() {
function neutron_plugin_setup_interface_driver {
local conf_file=$1
iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver
}
function has_neutron_plugin_security_group() {
function has_neutron_plugin_security_group {
# 0 means True here
return 0
}
function neutron_plugin_check_adv_test_requirements() {
function neutron_plugin_check_adv_test_requirements {
is_service_enabled q-dhcp && return 0
}

View File

@ -8,11 +8,11 @@ set +o xtrace
BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80}
BS_FL_OF_PORT=${BS_FL_OF_PORT:-6633}
function configure_bigswitch_floodlight() {
function configure_bigswitch_floodlight {
:
}
function init_bigswitch_floodlight() {
function init_bigswitch_floodlight {
install_neutron_agent_packages
echo -n "Installing OVS managed by the openflow controllers:"
@ -32,19 +32,19 @@ function init_bigswitch_floodlight() {
sudo ovs-vsctl --no-wait set-controller ${OVS_BRIDGE} ${ctrls}
}
function install_bigswitch_floodlight() {
function install_bigswitch_floodlight {
:
}
function start_bigswitch_floodlight() {
function start_bigswitch_floodlight {
:
}
function stop_bigswitch_floodlight() {
function stop_bigswitch_floodlight {
:
}
function check_bigswitch_floodlight() {
function check_bigswitch_floodlight {
:
}

View File

@ -20,28 +20,28 @@ MIDONET_CLIENT_DIR=${MIDONET_CLIENT_DIR:-$MIDONET_DIR/python-midonetclient}
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
function configure_midonet() {
function configure_midonet {
:
}
function init_midonet() {
function init_midonet {
:
}
function install_midonet() {
function install_midonet {
git_clone $MIDONET_CLIENT_REPO $MIDONET_CLIENT_DIR $MIDONET_CLIENT_BRANCH
export PYTHONPATH=$MIDONET_CLIENT_DIR/src:$PYTHONPATH
}
function start_midonet() {
function start_midonet {
:
}
function stop_midonet() {
function stop_midonet {
:
}
function check_midonet() {
function check_midonet {
:
}

View File

@ -21,14 +21,14 @@ RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest}
# configure_ryu can be called multiple times as neutron_pluing/ryu may call
# this function for neutron-ryu-agent
_RYU_CONFIGURED=${_RYU_CONFIGURED:-False}
function configure_ryu() {
function configure_ryu {
if [[ "$_RYU_CONFIGURED" == "False" ]]; then
setup_develop $RYU_DIR
_RYU_CONFIGURED=True
fi
}
function init_ryu() {
function init_ryu {
RYU_CONF_DIR=/etc/ryu
if [[ ! -d $RYU_CONF_DIR ]]; then
sudo mkdir -p $RYU_CONF_DIR
@ -60,22 +60,22 @@ neutron_controller_addr=tcp:$RYU_OFP_HOST:$RYU_OFP_PORT
# Make this function idempotent and avoid cloning same repo many times
# with RECLONE=yes
_RYU_INSTALLED=${_RYU_INSTALLED:-False}
function install_ryu() {
function install_ryu {
if [[ "$_RYU_INSTALLED" == "False" ]]; then
git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH
_RYU_INSTALLED=True
fi
}
function start_ryu() {
function start_ryu {
screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --config-file $RYU_CONF"
}
function stop_ryu() {
function stop_ryu {
:
}
function check_ryu() {
function check_ryu {
:
}

View File

@ -31,7 +31,7 @@ TREMA_SS_CONFIG=$TREMA_SS_ETC_DIR/sliceable.conf
TREMA_SS_APACHE_CONFIG=/etc/apache2/sites-available/sliceable_switch.conf
# configure_trema - Set config files, create data dirs, etc
function configure_trema() {
function configure_trema {
# prepare dir
for d in $TREMA_SS_ETC_DIR $TREMA_SS_DB_DIR $TREMA_SS_SCRIPT_DIR; do
sudo mkdir -p $d
@ -41,7 +41,7 @@ function configure_trema() {
}
# init_trema - Initialize databases, etc.
function init_trema() {
function init_trema {
local _pwd=$(pwd)
# Initialize databases for Sliceable Switch
@ -70,7 +70,7 @@ function init_trema() {
$TREMA_SS_CONFIG
}
function gem_install() {
function gem_install {
[[ "$OFFLINE" = "True" ]] && return
[ -n "$RUBYGEMS_CMD" ] || get_gem_command
@ -79,7 +79,7 @@ function gem_install() {
sudo $RUBYGEMS_CMD install $pkg
}
function get_gem_command() {
function get_gem_command {
# Trema requires ruby 1.8, so gem1.8 is checked first
RUBYGEMS_CMD=$(which gem1.8 || which gem)
if [ -z "$RUBYGEMS_CMD" ]; then
@ -87,7 +87,7 @@ function get_gem_command() {
fi
}
function install_trema() {
function install_trema {
# Trema
gem_install trema
# Sliceable Switch
@ -97,7 +97,7 @@ function install_trema() {
make -C $TREMA_DIR/apps/sliceable_switch
}
function start_trema() {
function start_trema {
# APACHE_NAME is defined in init_horizon (in lib/horizon)
restart_service $APACHE_NAME
@ -105,11 +105,11 @@ function start_trema() {
trema run -d -c $TREMA_SS_CONFIG
}
function stop_trema() {
function stop_trema {
sudo TREMA_TMP=$TREMA_TMP_DIR trema killall
}
function check_trema() {
function check_trema {
:
}

View File

@ -22,11 +22,11 @@ NSX_GATEWAY_NETWORK_INTERFACE=${NSX_GATEWAY_NETWORK_INTERFACE:-eth2}
# is invoked by unstack.sh
FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.0/24}
function configure_vmware_nsx() {
function configure_vmware_nsx {
:
}
function init_vmware_nsx() {
function init_vmware_nsx {
if ! is_set NSX_GATEWAY_NETWORK_CIDR; then
NSX_GATEWAY_NETWORK_CIDR=$PUBLIC_NETWORK_GATEWAY/${FLOATING_RANGE#*/}
echo "The IP address to set on br-ex was not specified. "
@ -52,15 +52,15 @@ function init_vmware_nsx() {
sudo ip addr add dev $PUBLIC_BRIDGE $NSX_GATEWAY_NETWORK_CIDR
}
function install_vmware_nsx() {
function install_vmware_nsx {
:
}
function start_vmware_nsx() {
function start_vmware_nsx {
:
}
function stop_vmware_nsx() {
function stop_vmware_nsx {
if ! is_set NSX_GATEWAY_NETWORK_CIDR; then
NSX_GATEWAY_NETWORK_CIDR=$PUBLIC_NETWORK_GATEWAY/${FLOATING_RANGE#*/}
echo "The IP address expected on br-ex was not specified. "
@ -78,7 +78,7 @@ function stop_vmware_nsx() {
done
}
function check_vmware_nsx() {
function check_vmware_nsx {
neutron-check-nsx-config $NEUTRON_CONF_DIR/plugins/vmware/nsx.ini
}

View File

@ -144,7 +144,7 @@ function is_n-cell_enabled {
}
# Helper to clean iptables rules
function clean_iptables() {
function clean_iptables {
# Delete rules
sudo iptables -S -v | sed "s/-c [0-9]* [0-9]* //g" | grep "nova" | grep "\-A" | sed "s/-A/-D/g" | awk '{print "sudo iptables",$0}' | bash
# Delete nat rules
@ -157,7 +157,7 @@ function clean_iptables() {
# cleanup_nova() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_nova() {
function cleanup_nova {
if is_service_enabled n-cpu; then
# Clean iptables from previous runs
clean_iptables
@ -191,7 +191,7 @@ function cleanup_nova() {
}
# configure_nova_rootwrap() - configure Nova's rootwrap
function configure_nova_rootwrap() {
function configure_nova_rootwrap {
# Deploy new rootwrap filters files (owned by root).
# Wipe any existing rootwrap.d files first
if [[ -d $NOVA_CONF_DIR/rootwrap.d ]]; then
@ -219,7 +219,7 @@ function configure_nova_rootwrap() {
}
# configure_nova() - Set config files, create data dirs, etc
function configure_nova() {
function configure_nova {
# Put config files in ``/etc/nova`` for everyone to find
if [[ ! -d $NOVA_CONF_DIR ]]; then
sudo mkdir -p $NOVA_CONF_DIR
@ -367,7 +367,7 @@ create_nova_accounts() {
}
# create_nova_conf() - Create a new nova.conf file
function create_nova_conf() {
function create_nova_conf {
# Remove legacy ``nova.conf``
rm -f $NOVA_DIR/bin/nova.conf
@ -515,7 +515,7 @@ function create_nova_conf() {
iniset $NOVA_CONF DEFAULT glance_api_servers "$GLANCE_HOSTPORT"
}
function init_nova_cells() {
function init_nova_cells {
if is_service_enabled n-cell; then
cp $NOVA_CONF $NOVA_CELLS_CONF
iniset $NOVA_CELLS_CONF DEFAULT sql_connection `database_connection_url $NOVA_CELLS_DB`
@ -542,14 +542,14 @@ function init_nova_cells() {
}
# create_nova_cache_dir() - Part of the init_nova() process
function create_nova_cache_dir() {
function create_nova_cache_dir {
# Create cache dir
sudo mkdir -p $NOVA_AUTH_CACHE_DIR
sudo chown $STACK_USER $NOVA_AUTH_CACHE_DIR
rm -f $NOVA_AUTH_CACHE_DIR/*
}
function create_nova_conf_nova_network() {
function create_nova_conf_nova_network {
iniset $NOVA_CONF DEFAULT network_manager "nova.network.manager.$NETWORK_MANAGER"
iniset $NOVA_CONF DEFAULT public_interface "$PUBLIC_INTERFACE"
iniset $NOVA_CONF DEFAULT vlan_interface "$VLAN_INTERFACE"
@ -560,14 +560,14 @@ function create_nova_conf_nova_network() {
}
# create_nova_keys_dir() - Part of the init_nova() process
function create_nova_keys_dir() {
function create_nova_keys_dir {
# Create keys dir
sudo mkdir -p ${NOVA_STATE_PATH}/keys
sudo chown -R $STACK_USER ${NOVA_STATE_PATH}
}
# init_nova() - Initialize databases, etc.
function init_nova() {
function init_nova {
# All nova components talk to a central database.
# 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
@ -596,14 +596,14 @@ function init_nova() {
}
# install_novaclient() - Collect source and prepare
function install_novaclient() {
function install_novaclient {
git_clone $NOVACLIENT_REPO $NOVACLIENT_DIR $NOVACLIENT_BRANCH
setup_develop $NOVACLIENT_DIR
sudo install -D -m 0644 -o $STACK_USER {$NOVACLIENT_DIR/tools/,/etc/bash_completion.d/}nova.bash_completion
}
# install_nova() - Collect source and prepare
function install_nova() {
function install_nova {
if is_service_enabled n-cpu && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
install_nova_hypervisor
fi
@ -638,7 +638,7 @@ function install_nova() {
}
# start_nova_api() - Start the API process ahead of other things
function start_nova_api() {
function start_nova_api {
# Get right service port for testing
local service_port=$NOVA_SERVICE_PORT
if is_service_enabled tls-proxy; then
@ -658,7 +658,7 @@ function start_nova_api() {
}
# start_nova_compute() - Start the compute process
function start_nova_compute() {
function start_nova_compute {
if is_service_enabled n-cell; then
local compute_cell_conf=$NOVA_CELLS_CONF
else
@ -693,7 +693,7 @@ function start_nova_compute() {
}
# start_nova() - Start running processes, including screen
function start_nova_rest() {
function start_nova_rest {
local api_cell_conf=$NOVA_CONF
if is_service_enabled n-cell; then
local compute_cell_conf=$NOVA_CELLS_CONF
@ -722,13 +722,13 @@ function start_nova_rest() {
screen_it n-obj "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-objectstore --config-file $api_cell_conf"
}
function start_nova() {
function start_nova {
start_nova_compute
start_nova_rest
}
# stop_nova() - Stop running processes (non-screen)
function stop_nova() {
function stop_nova {
# Kill the nova screen windows
# Some services are listed here twice since more than one instance
# of a service may be running in certain configs.

View File

@ -33,13 +33,13 @@ STUB_NETWORK=${STUB_NETWORK:-False}
# ------------
# clean_nova_hypervisor - Clean up an installation
function cleanup_nova_hypervisor() {
function cleanup_nova_hypervisor {
# This function intentionally left blank
:
}
# configure_nova_hypervisor - Set config files, create data dirs, etc
function configure_nova_hypervisor() {
function configure_nova_hypervisor {
configure_baremetal_nova_dirs
iniset $NOVA_CONF baremetal sql_connection `database_connection_url nova_bm`
@ -67,19 +67,19 @@ function configure_nova_hypervisor() {
}
# install_nova_hypervisor() - Install external components
function install_nova_hypervisor() {
function install_nova_hypervisor {
# This function intentionally left blank
:
}
# start_nova_hypervisor - Start any required external services
function start_nova_hypervisor() {
function start_nova_hypervisor {
# This function intentionally left blank
:
}
# stop_nova_hypervisor - Stop any external services
function stop_nova_hypervisor() {
function stop_nova_hypervisor {
# This function intentionally left blank
:
}

View File

@ -44,7 +44,7 @@ DOCKER_APT_REPO=${DOCKER_APT_REPO:-https://get.docker.io/ubuntu}
# ------------
# clean_nova_hypervisor - Clean up an installation
function cleanup_nova_hypervisor() {
function cleanup_nova_hypervisor {
stop_service docker
# Clean out work area
@ -52,13 +52,13 @@ function cleanup_nova_hypervisor() {
}
# configure_nova_hypervisor - Set config files, create data dirs, etc
function configure_nova_hypervisor() {
function configure_nova_hypervisor {
iniset $NOVA_CONF DEFAULT compute_driver docker.DockerDriver
iniset $GLANCE_API_CONF DEFAULT container_formats ami,ari,aki,bare,ovf,docker
}
# install_nova_hypervisor() - Install external components
function install_nova_hypervisor() {
function install_nova_hypervisor {
# So far this is Ubuntu only
if ! is_ubuntu; then
die $LINENO "Docker is only supported on Ubuntu at this time"
@ -77,7 +77,7 @@ function install_nova_hypervisor() {
}
# start_nova_hypervisor - Start any required external services
function start_nova_hypervisor() {
function start_nova_hypervisor {
local docker_pid
read docker_pid <$DOCKER_PID_FILE
if [[ -z $docker_pid ]] || ! ps -p $docker_pid | grep [d]ocker; then
@ -111,7 +111,7 @@ function start_nova_hypervisor() {
}
# stop_nova_hypervisor - Stop any external services
function stop_nova_hypervisor() {
function stop_nova_hypervisor {
# Stop the docker registry container
docker kill $(docker ps | grep docker-registry | cut -d' ' -f1)
}

View File

@ -27,13 +27,13 @@ set +o xtrace
# ------------
# clean_nova_hypervisor - Clean up an installation
function cleanup_nova_hypervisor() {
function cleanup_nova_hypervisor {
# This function intentionally left blank
:
}
# configure_nova_hypervisor - Set config files, create data dirs, etc
function configure_nova_hypervisor() {
function configure_nova_hypervisor {
iniset $NOVA_CONF DEFAULT compute_driver "nova.virt.fake.FakeDriver"
# Disable arbitrary limits
iniset $NOVA_CONF DEFAULT quota_instances -1
@ -51,19 +51,19 @@ function configure_nova_hypervisor() {
}
# install_nova_hypervisor() - Install external components
function install_nova_hypervisor() {
function install_nova_hypervisor {
# This function intentionally left blank
:
}
# start_nova_hypervisor - Start any required external services
function start_nova_hypervisor() {
function start_nova_hypervisor {
# This function intentionally left blank
:
}
# stop_nova_hypervisor - Stop any external services
function stop_nova_hypervisor() {
function stop_nova_hypervisor {
# This function intentionally left blank
:
}

View File

@ -31,13 +31,13 @@ ENABLE_FILE_INJECTION=${ENABLE_FILE_INJECTION:-False}
# ------------
# clean_nova_hypervisor - Clean up an installation
function cleanup_nova_hypervisor() {
function cleanup_nova_hypervisor {
# This function intentionally left blank
:
}
# configure_nova_hypervisor - Set config files, create data dirs, etc
function configure_nova_hypervisor() {
function configure_nova_hypervisor {
if is_service_enabled neutron && is_neutron_ovs_base_plugin && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF; then
# Add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces
cat <<EOF | sudo tee -a $QEMU_CONF
@ -135,7 +135,7 @@ EOF
}
# install_nova_hypervisor() - Install external components
function install_nova_hypervisor() {
function install_nova_hypervisor {
if is_ubuntu; then
install_package kvm
install_package libvirt-bin
@ -165,13 +165,13 @@ function install_nova_hypervisor() {
}
# start_nova_hypervisor - Start any required external services
function start_nova_hypervisor() {
function start_nova_hypervisor {
# This function intentionally left blank
:
}
# stop_nova_hypervisor - Stop any external services
function stop_nova_hypervisor() {
function stop_nova_hypervisor {
# This function intentionally left blank
:
}

View File

@ -27,13 +27,13 @@ set +o xtrace
# ------------
# clean_nova_hypervisor - Clean up an installation
function cleanup_nova_hypervisor() {
function cleanup_nova_hypervisor {
# This function intentionally left blank
:
}
# configure_nova_hypervisor - Set config files, create data dirs, etc
function configure_nova_hypervisor() {
function configure_nova_hypervisor {
iniset $NOVA_CONF DEFAULT compute_driver "openvz.OpenVzDriver"
iniset $NOVA_CONF DEFAULT connection_type "openvz"
LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.libvirt.firewall.IptablesFirewallDriver"}
@ -41,19 +41,19 @@ function configure_nova_hypervisor() {
}
# install_nova_hypervisor() - Install external components
function install_nova_hypervisor() {
function install_nova_hypervisor {
# This function intentionally left blank
:
}
# start_nova_hypervisor - Start any required external services
function start_nova_hypervisor() {
function start_nova_hypervisor {
# This function intentionally left blank
:
}
# stop_nova_hypervisor - Stop any external services
function stop_nova_hypervisor() {
function stop_nova_hypervisor {
# This function intentionally left blank
:
}

View File

@ -27,13 +27,13 @@ set +o xtrace
# ------------
# clean_nova_hypervisor - Clean up an installation
function cleanup_nova_hypervisor() {
function cleanup_nova_hypervisor {
# This function intentionally left blank
:
}
# configure_nova_hypervisor - Set config files, create data dirs, etc
function configure_nova_hypervisor() {
function configure_nova_hypervisor {
iniset $NOVA_CONF DEFAULT compute_driver "vmwareapi.VMwareVCDriver"
VMWAREAPI_USER=${VMWAREAPI_USER:-"root"}
iniset $NOVA_CONF vmware host_ip "$VMWAREAPI_IP"
@ -46,19 +46,19 @@ function configure_nova_hypervisor() {
}
# install_nova_hypervisor() - Install external components
function install_nova_hypervisor() {
function install_nova_hypervisor {
# This function intentionally left blank
:
}
# start_nova_hypervisor - Start any required external services
function start_nova_hypervisor() {
function start_nova_hypervisor {
# This function intentionally left blank
:
}
# stop_nova_hypervisor - Stop any external services
function stop_nova_hypervisor() {
function stop_nova_hypervisor {
# This function intentionally left blank
:
}

View File

@ -37,13 +37,13 @@ VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=169.254.0.1}
# ------------
# clean_nova_hypervisor - Clean up an installation
function cleanup_nova_hypervisor() {
function cleanup_nova_hypervisor {
# This function intentionally left blank
:
}
# configure_nova_hypervisor - Set config files, create data dirs, etc
function configure_nova_hypervisor() {
function configure_nova_hypervisor {
if [ -z "$XENAPI_CONNECTION_URL" ]; then
die $LINENO "XENAPI_CONNECTION_URL is not specified"
fi
@ -87,19 +87,19 @@ CRONTAB
}
# install_nova_hypervisor() - Install external components
function install_nova_hypervisor() {
function install_nova_hypervisor {
# This function intentionally left blank
:
}
# start_nova_hypervisor - Start any required external services
function start_nova_hypervisor() {
function start_nova_hypervisor {
# This function intentionally left blank
:
}
# stop_nova_hypervisor - Stop any external services
function stop_nova_hypervisor() {
function stop_nova_hypervisor {
# This function intentionally left blank
:
}

View File

@ -33,7 +33,7 @@ TASKFLOW_DIR=$DEST/taskflow
# ------------
# install_oslo() - Collect source and prepare
function install_oslo() {
function install_oslo {
# TODO(sdague): remove this once we get to Icehouse, this just makes
# for a smoother transition of existing users.
cleanup_oslo
@ -64,7 +64,7 @@ function install_oslo() {
}
# cleanup_oslo() - purge possibly old versions of oslo
function cleanup_oslo() {
function cleanup_oslo {
# this means we've got an old oslo installed, lets get rid of it
if ! python -c 'import oslo.config' 2>/dev/null; then
echo "Found old oslo.config... removing to ensure consistency"

View File

@ -25,7 +25,7 @@ set +o xtrace
# Make sure we only have one rpc backend enabled.
# Also check the specified rpc backend is available on your platform.
function check_rpc_backend() {
function check_rpc_backend {
local rpc_needed=1
# We rely on the fact that filenames in lib/* match the service names
# that can be passed as arguments to is_service_enabled.
@ -91,7 +91,7 @@ function cleanup_rpc_backend {
}
# install rpc backend
function install_rpc_backend() {
function install_rpc_backend {
if is_service_enabled rabbit; then
# Install rabbitmq-server
# the temp file is necessary due to LP: #878600
@ -135,7 +135,7 @@ function install_rpc_backend() {
}
# restart the rpc backend
function restart_rpc_backend() {
function restart_rpc_backend {
if is_service_enabled rabbit; then
# Start rabbitmq-server
echo_summary "Starting RabbitMQ"
@ -165,7 +165,7 @@ function restart_rpc_backend() {
}
# iniset cofiguration
function iniset_rpc_backend() {
function iniset_rpc_backend {
local package=$1
local file=$2
local section=$3
@ -193,7 +193,7 @@ function iniset_rpc_backend() {
# Check if qpid can be used on the current distro.
# qpid_is_supported
function qpid_is_supported() {
function qpid_is_supported {
if [[ -z "$DISTRO" ]]; then
GetDistro
fi

View File

@ -55,7 +55,7 @@ TEMPEST_SERVICES+=,savanna
# Tenant User Roles
# ------------------------------
# service savanna admin
function create_savanna_accounts() {
function create_savanna_accounts {
SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
@ -88,14 +88,14 @@ function create_savanna_accounts() {
# cleanup_savanna() - Remove residual data files, anything left over from
# previous runs that would need to clean up.
function cleanup_savanna() {
function cleanup_savanna {
# Cleanup auth cache dir
sudo rm -rf $SAVANNA_AUTH_CACHE_DIR
}
# configure_savanna() - Set config files, create data dirs, etc
function configure_savanna() {
function configure_savanna {
if [[ ! -d $SAVANNA_CONF_DIR ]]; then
sudo mkdir -p $SAVANNA_CONF_DIR
@ -142,18 +142,18 @@ function configure_savanna() {
}
# install_savanna() - Collect source and prepare
function install_savanna() {
function install_savanna {
git_clone $SAVANNA_REPO $SAVANNA_DIR $SAVANNA_BRANCH
setup_develop $SAVANNA_DIR
}
# start_savanna() - Start running processes, including screen
function start_savanna() {
function start_savanna {
screen_it savanna "cd $SAVANNA_DIR && $SAVANNA_BIN_DIR/savanna-api --config-file $SAVANNA_CONF_FILE"
}
# stop_savanna() - Stop running processes
function stop_savanna() {
function stop_savanna {
# Kill the Savanna screen windows
screen -S $SCREEN_NAME -p savanna -X kill
}

View File

@ -35,7 +35,7 @@ SAVANNA_PYTHONCLIENT_DIR=$DEST/python-savannaclient
# Functions
# ---------
function configure_savanna_dashboard() {
function configure_savanna_dashboard {
echo -e "AUTO_ASSIGNMENT_ENABLED = False" >> $HORIZON_DIR/openstack_dashboard/local/local_settings.py
echo -e "HORIZON_CONFIG['dashboards'] += ('savanna',)" >> $HORIZON_DIR/openstack_dashboard/settings.py
@ -47,19 +47,19 @@ function configure_savanna_dashboard() {
}
# install_savanna_dashboard() - Collect source and prepare
function install_savanna_dashboard() {
function install_savanna_dashboard {
install_python_savannaclient
git_clone $SAVANNA_DASHBOARD_REPO $SAVANNA_DASHBOARD_DIR $SAVANNA_DASHBOARD_BRANCH
setup_develop $SAVANNA_DASHBOARD_DIR
}
function install_python_savannaclient() {
function install_python_savannaclient {
git_clone $SAVANNA_PYTHONCLIENT_REPO $SAVANNA_PYTHONCLIENT_DIR $SAVANNA_PYTHONCLIENT_BRANCH
setup_develop $SAVANNA_PYTHONCLIENT_DIR
}
# Cleanup file settings.py from Savanna
function cleanup_savanna_dashboard() {
function cleanup_savanna_dashboard {
sed -i '/savanna/d' $HORIZON_DIR/openstack_dashboard/settings.py
}

View File

@ -34,7 +34,7 @@ PECAN_DIR=$DEST/pecan
# ------------
# install_stackforge() - Collect source and prepare
function install_stackforge() {
function install_stackforge {
# TODO(sdague): remove this once we get to Icehouse, this just makes
# for a smoother transition of existing users.
cleanup_stackforge
@ -47,7 +47,7 @@ function install_stackforge() {
}
# cleanup_stackforge() - purge possibly old versions of stackforge libraries
function cleanup_stackforge() {
function cleanup_stackforge {
# this means we've got an old version installed, lets get rid of it
# otherwise python hates itself
for lib in wsme pecan; do

View File

@ -126,7 +126,7 @@ function is_swift_enabled {
}
# cleanup_swift() - Remove residual data files
function cleanup_swift() {
function cleanup_swift {
rm -f ${SWIFT_CONF_DIR}{*.builder,*.ring.gz,backups/*.builder,backups/*.ring.gz}
if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
@ -141,7 +141,7 @@ function cleanup_swift() {
}
# _cleanup_swift_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file
function _cleanup_swift_apache_wsgi() {
function _cleanup_swift_apache_wsgi {
sudo rm -f $SWIFT_APACHE_WSGI_DIR/*.wsgi
disable_apache_site proxy-server
for node_number in ${SWIFT_REPLICAS_SEQ}; do
@ -154,7 +154,7 @@ function _cleanup_swift_apache_wsgi() {
}
# _config_swift_apache_wsgi() - Set WSGI config files of Swift
function _config_swift_apache_wsgi() {
function _config_swift_apache_wsgi {
sudo mkdir -p ${SWIFT_APACHE_WSGI_DIR}
local apache_vhost_dir=/etc/${APACHE_NAME}/$APACHE_CONF_DIR
local proxy_port=${SWIFT_DEFAULT_BIND_PORT:-8080}
@ -233,7 +233,7 @@ function _config_swift_apache_wsgi() {
# This function generates an object/container/account configuration
# emulating 4 nodes on different ports
function generate_swift_config() {
function generate_swift_config {
local swift_node_config=$1
local node_id=$2
local bind_port=$3
@ -272,7 +272,7 @@ function generate_swift_config() {
# configure_swift() - Set config files, create data dirs and loop image
function configure_swift() {
function configure_swift {
local swift_pipeline="${SWIFT_EXTRAS_MIDDLEWARE_NO_AUTH}"
local node_number
local swift_node_config
@ -460,7 +460,7 @@ EOF
}
# create_swift_disk - Create Swift backing disk
function create_swift_disk() {
function create_swift_disk {
local node_number
# First do a bit of setup by creating the directories and
@ -520,7 +520,7 @@ function create_swift_disk() {
# swifttenanttest1 swiftusertest3 anotherrole
# swifttenanttest2 swiftusertest2 admin
function create_swift_accounts() {
function create_swift_accounts {
# Defines specific passwords used by tools/create_userrc.sh
SWIFTUSERTEST1_PASSWORD=testing
SWIFTUSERTEST2_PASSWORD=testing2
@ -578,7 +578,7 @@ function create_swift_accounts() {
}
# init_swift() - Initialize rings
function init_swift() {
function init_swift {
local node_number
# Make sure to kill all swift processes first
swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
@ -612,7 +612,7 @@ function init_swift() {
rm -f $SWIFT_AUTH_CACHE_DIR/*
}
function install_swift() {
function install_swift {
git_clone $SWIFT_REPO $SWIFT_DIR $SWIFT_BRANCH
setup_develop $SWIFT_DIR
if is_apache_enabled_service swift; then
@ -620,13 +620,13 @@ function install_swift() {
fi
}
function install_swiftclient() {
function install_swiftclient {
git_clone $SWIFTCLIENT_REPO $SWIFTCLIENT_DIR $SWIFTCLIENT_BRANCH
setup_develop $SWIFTCLIENT_DIR
}
# start_swift() - Start running processes, including screen
function start_swift() {
function start_swift {
# (re)start rsyslog
restart_service rsyslog
# (re)start memcached to make sure we have a clean memcache.
@ -674,7 +674,7 @@ function start_swift() {
}
# stop_swift() - Stop running processes (non-screen)
function stop_swift() {
function stop_swift {
if is_apache_enabled_service swift; then
swift-init --run-dir=${SWIFT_DATA_DIR}/run rest stop && return 0

View File

@ -70,7 +70,7 @@ IPV6_ENABLED=$(trueorfalse True $IPV6_ENABLED)
# ---------
# configure_tempest() - Set config files, create data dirs, etc
function configure_tempest() {
function configure_tempest {
setup_develop $TEMPEST_DIR
local image_lines
local images
@ -359,12 +359,12 @@ function configure_tempest() {
}
# install_tempest() - Collect source and prepare
function install_tempest() {
function install_tempest {
git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
}
# init_tempest() - Initialize ec2 images
function init_tempest() {
function init_tempest {
local base_image_name=cirros-0.3.1-x86_64
# /opt/stack/devstack/files/images/cirros-0.3.1-x86_64-uec
local image_dir="$FILES/images/${base_image_name}-uec"

View File

@ -45,7 +45,7 @@ function is_XXXX_enabled {
# cleanup_XXXX() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_XXXX() {
function cleanup_XXXX {
# kill instances (nova)
# delete image files (glance)
# This function intentionally left blank
@ -53,7 +53,7 @@ function cleanup_XXXX() {
}
# configure_XXXX() - Set config files, create data dirs, etc
function configure_XXXX() {
function configure_XXXX {
# sudo python setup.py deploy
# iniset $XXXX_CONF ...
# This function intentionally left blank
@ -61,26 +61,26 @@ function configure_XXXX() {
}
# init_XXXX() - Initialize databases, etc.
function init_XXXX() {
function init_XXXX {
# clean up from previous (possibly aborted) runs
# create required data files
:
}
# install_XXXX() - Collect source and prepare
function install_XXXX() {
function install_XXXX {
# git clone xxx
:
}
# start_XXXX() - Start running processes, including screen
function start_XXXX() {
function start_XXXX {
# screen_it XXXX "cd $XXXX_DIR && $XXXX_DIR/bin/XXXX-bin"
:
}
# stop_XXXX() - Stop running processes (non-screen)
function stop_XXXX() {
function stop_XXXX {
# FIXME(dtroyer): stop only our screen screen window?
:
}

20
lib/tls
View File

@ -61,7 +61,7 @@ STUD_CIPHERS='TLSv1+HIGH:!DES:!aNULL:!eNULL:@STRENGTH'
OPENSSL=${OPENSSL:-/usr/bin/openssl}
# Do primary CA configuration
function configure_CA() {
function configure_CA {
# build common config file
# Verify ``TLS_IP`` is good
@ -73,7 +73,7 @@ function configure_CA() {
# Creates a new CA directory structure
# create_CA_base ca-dir
function create_CA_base() {
function create_CA_base {
local ca_dir=$1
if [[ -d $ca_dir ]]; then
@ -92,7 +92,7 @@ function create_CA_base() {
# Create a new CA configuration file
# create_CA_config ca-dir common-name
function create_CA_config() {
function create_CA_config {
local ca_dir=$1
local common_name=$2
@ -145,7 +145,7 @@ keyUsage = cRLSign, keyCertSign
# Create a new signing configuration file
# create_signing_config ca-dir
function create_signing_config() {
function create_signing_config {
local ca_dir=$1
echo "
@ -225,7 +225,7 @@ function init_cert {
# make_cert creates and signs a new certificate with the given commonName and CA
# make_cert ca-dir cert-name "common-name" ["alt-name" ...]
function make_cert() {
function make_cert {
local ca_dir=$1
local cert_name=$2
local common_name=$3
@ -261,7 +261,7 @@ function make_cert() {
# Make an intermediate CA to sign everything else
# make_int_CA ca-dir signing-ca-dir
function make_int_CA() {
function make_int_CA {
local ca_dir=$1
local signing_ca_dir=$2
@ -291,7 +291,7 @@ function make_int_CA() {
# Make a root CA to sign other CAs
# make_root_CA ca-dir
function make_root_CA() {
function make_root_CA {
local ca_dir=$1
# Create the root CA
@ -319,7 +319,7 @@ function make_root_CA() {
# is a short-circuit boolean, i.e it returns on the first match.
#
# Uses global ``SSL_ENABLED_SERVICES``
function is_ssl_enabled_service() {
function is_ssl_enabled_service {
services=$@
for service in ${services}; do
[[ ,${SSL_ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
@ -337,7 +337,7 @@ function is_ssl_enabled_service() {
# example for keystone this would be KEYSTONE_SSL_CERT, KEYSTONE_SSL_KEY and
# KEYSTONE_SSL_CA. If it does not find these certificates the program will
# quit.
function ensure_certificates() {
function ensure_certificates {
local service=$1
local cert_var="${service}_SSL_CERT"
@ -362,7 +362,7 @@ function ensure_certificates() {
# Starts the TLS proxy for the given IP/ports
# start_tls_proxy front-host front-port back-host back-port
function start_tls_proxy() {
function start_tls_proxy {
local f_host=$1
local f_port=$2
local b_host=$3

View File

@ -53,7 +53,7 @@ function is_trove_enabled {
}
# setup_trove_logging() - Adds logging configuration to conf files
function setup_trove_logging() {
function setup_trove_logging {
local CONF=$1
iniset $CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
iniset $CONF DEFAULT use_syslog $SYSLOG
@ -69,7 +69,7 @@ function setup_trove_logging() {
# ------------------------------------------------------------------
# service trove admin # if enabled
create_trove_accounts() {
function create_trove_accounts {
# Trove
SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
SERVICE_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
@ -106,19 +106,19 @@ create_trove_accounts() {
# cleanup_trove() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_trove() {
function cleanup_trove {
#Clean up dirs
rm -fr $TROVE_AUTH_CACHE_DIR/*
rm -fr $TROVE_CONF_DIR/*
}
# configure_troveclient() - Set config files, create data dirs, etc
function configure_troveclient() {
function configure_troveclient {
setup_develop $TROVECLIENT_DIR
}
# configure_trove() - Set config files, create data dirs, etc
function configure_trove() {
function configure_trove {
setup_develop $TROVE_DIR
# Create the trove conf dir and cache dirs if they don't exist
@ -182,17 +182,17 @@ function configure_trove() {
}
# install_troveclient() - Collect source and prepare
function install_troveclient() {
function install_troveclient {
git_clone $TROVECLIENT_REPO $TROVECLIENT_DIR $TROVECLIENT_BRANCH
}
# install_trove() - Collect source and prepare
function install_trove() {
function install_trove {
git_clone $TROVE_REPO $TROVE_DIR $TROVE_BRANCH
}
# init_trove() - Initializes Trove Database as a Service
function init_trove() {
function init_trove {
#(Re)Create trove db
recreate_database trove utf8
@ -201,14 +201,14 @@ function init_trove() {
}
# start_trove() - Start running processes, including screen
function start_trove() {
function start_trove {
screen_it tr-api "cd $TROVE_DIR; $TROVE_BIN_DIR/trove-api --config-file=$TROVE_CONF_DIR/trove.conf --debug 2>&1"
screen_it tr-tmgr "cd $TROVE_DIR; $TROVE_BIN_DIR/trove-taskmanager --config-file=$TROVE_CONF_DIR/trove-taskmanager.conf --debug 2>&1"
screen_it tr-cond "cd $TROVE_DIR; $TROVE_BIN_DIR/trove-conductor --config-file=$TROVE_CONF_DIR/trove-conductor.conf --debug 2>&1"
}
# stop_trove() - Stop running processes
function stop_trove() {
function stop_trove {
# Kill the trove screen windows
for serv in tr-api tr-tmgr tr-cond; do
screen_stop $serv

View File

@ -464,7 +464,7 @@ fi
# -----------------
# Draw a spinner so the user knows something is happening
function spinner() {
function spinner {
local delay=0.75
local spinstr='/-\|'
printf "..." >&3
@ -479,7 +479,7 @@ function spinner() {
# Echo text to the log file, summary log file and stdout
# echo_summary "something to say"
function echo_summary() {
function echo_summary {
if [[ -t 3 && "$VERBOSE" != "True" ]]; then
kill >/dev/null 2>&1 $LAST_SPINNER_PID
if [ ! -z "$LAST_SPINNER_PID" ]; then
@ -495,7 +495,7 @@ function echo_summary() {
# Echo text only to stdout, no log files
# echo_nolog "something not for the logs"
function echo_nolog() {
function echo_nolog {
echo $@ >&3
}

View File

@ -42,7 +42,7 @@ fi
echo "Testing enable_service()"
function test_enable_service() {
function test_enable_service {
local start="$1"
local add="$2"
local finish="$3"
@ -68,7 +68,7 @@ test_enable_service 'a,b,c' c 'a,b,c'
test_enable_service 'a,b,-c' c 'a,b'
test_enable_service 'a,b,c' -c 'a,b'
function test_disable_service() {
function test_disable_service {
local start="$1"
local del="$2"
local finish="$3"
@ -109,7 +109,7 @@ fi
echo "Testing disable_negated_services()"
function test_disable_negated_services() {
function test_disable_negated_services {
local start="$1"
local finish="$2"

View File

@ -12,7 +12,7 @@ source $TOP/lib/config
# check_result() tests and reports the result values
# check_result "actual" "expected"
function check_result() {
function check_result {
local actual=$1
local expected=$2
if [[ "$actual" == "$expected" ]]; then
@ -26,7 +26,7 @@ TEST_1C_ADD="[eee]
type=new
multi = foo2"
function create_test1c() {
function create_test1c {
cat >test1c.conf <<EOF
[eee]
# original comment
@ -34,7 +34,7 @@ type=original
EOF
}
function create_test2a() {
function create_test2a {
cat >test2a.conf <<EOF
[ddd]
# original comment

View File

@ -102,6 +102,21 @@ def check_indents(line):
if (len(m.group('indent')) % 4) != 0:
print_error('E003: Indent not multiple of 4', line)
def check_function_decl(line):
failed = False
if line.startswith("function"):
if not re.search('^function [\w-]* \{$', line):
failed = True
else:
# catch the case without "function", e.g.
# things like '^foo() {'
if re.search('^\s*?\(\)\s*?\{', line):
failed = True
if failed:
print_error('E020: Function declaration not in format '
' "^function name {$"', line)
def starts_multiline(line):
m = re.search("[^<]<<\s*(?P<token>\w+)", line)
@ -169,6 +184,7 @@ def check_files(files, verbose):
check_indents(logical_line)
check_for_do(logical_line)
check_if_then(logical_line)
check_function_decl(logical_line)
prev_line = logical_line
prev_lineno = fileinput.filelineno()

View File

@ -17,7 +17,7 @@ PXEDIR=${PXEDIR:-/opt/ramstack/pxe}
PROGDIR=`dirname $0`
# Clean up any resources that may be in use
cleanup() {
function cleanup {
set +o errexit
# Mop up temporary files

View File

@ -14,7 +14,7 @@ if [ ! "$#" -eq "1" ]; then
fi
# Clean up any resources that may be in use
cleanup() {
function cleanup {
set +o errexit
# Mop up temporary files
@ -87,7 +87,7 @@ fi
# Finds and returns full device path for the next available NBD device.
# Exits script if error connecting or none free.
# map_nbd image
function map_nbd() {
function map_nbd {
for i in `seq 0 15`; do
if [ ! -e /sys/block/nbd$i/pid ]; then
NBD=/dev/nbd$i

View File

@ -20,7 +20,7 @@ if ! egrep -q "oneiric" /etc/lsb-release; then
fi
# Clean up resources that may be in use
cleanup() {
function cleanup {
set +o errexit
if [ -n "$MNT_DIR" ]; then

View File

@ -13,7 +13,7 @@ DEST_DIR=${1:-/tmp/syslinux-boot}
PXEDIR=${PXEDIR:-/opt/ramstack/pxe}
# Clean up any resources that may be in use
cleanup() {
function cleanup {
set +o errexit
# Mop up temporary files

View File

@ -22,7 +22,7 @@ cd $TOP_DIR
source ./stackrc
# Echo usage
usage() {
function usage {
echo "Add stack user and keys"
echo ""
echo "Usage: $0 [full path to raw uec base image]"

View File

@ -11,8 +11,7 @@ set -o xtrace
ACCOUNT_DIR=./accrc
display_help()
{
function display_help {
cat <<EOF
usage: $0 <options..>
@ -151,7 +150,7 @@ if ! nova x509-get-root-cert "$EUCALYPTUS_CERT"; then
fi
function add_entry(){
function add_entry {
local user_id=$1
local user_name=$2
local tenant_id=$3
@ -213,7 +212,7 @@ EOF
}
#admin users expected
function create_or_get_tenant(){
function create_or_get_tenant {
local tenant_name=$1
local tenant_id=`keystone tenant-list | awk '/\|[[:space:]]*'"$tenant_name"'[[:space:]]*\|.*\|/ {print $2}'`
if [ -n "$tenant_id" ]; then
@ -223,7 +222,7 @@ function create_or_get_tenant(){
fi
}
function create_or_get_role(){
function create_or_get_role {
local role_name=$1
local role_id=`keystone role-list| awk '/\|[[:space:]]*'"$role_name"'[[:space:]]*\|/ {print $2}'`
if [ -n "$role_id" ]; then
@ -234,7 +233,7 @@ function create_or_get_role(){
}
# Provides empty string when the user does not exists
function get_user_id(){
function get_user_id {
local user_name=$1
keystone user-list | awk '/^\|[^|]*\|[[:space:]]*'"$user_name"'[[:space:]]*\|.*\|/ {print $2}'
}

View File

@ -40,7 +40,7 @@ FILES=$TOP_DIR/files
# ---------------
# get_package_path python-package # in import notation
function get_package_path() {
function get_package_path {
local package=$1
echo $(python -c "import os; import $package; print(os.path.split(os.path.realpath($package.__file__))[0])")
}

View File

@ -18,7 +18,7 @@ TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
set -o errexit
set -o xtrace
usage() {
function usage {
echo "Usage: $0 - Download and prepare Ubuntu UEC images"
echo ""
echo "$0 [-r rootsize] release imagefile [kernel]"
@ -31,7 +31,7 @@ usage() {
}
# Clean up any resources that may be in use
cleanup() {
function cleanup {
set +o errexit
# Mop up temporary files

View File

@ -61,7 +61,7 @@ fi
# -----
# git_report <dir>
function git_report() {
function git_report {
local dir=$1
local proj ref branch head
if [[ -d $dir/.git ]]; then

View File

@ -22,7 +22,7 @@ if [ -e vpnrc ]; then
fi
# Do some IP manipulation
function cidr2netmask() {
function cidr2netmask {
set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
if [[ $1 -gt 1 ]]; then
shift $1
@ -50,7 +50,7 @@ VPN_CLIENT_DHCP="${VPN_CLIENT_DHCP:-net.1 net.254}"
VPN_DIR=/etc/openvpn
CA_DIR=$VPN_DIR/easy-rsa
usage() {
function usage {
echo "$0 - OpenVPN install and certificate generation"
echo ""
echo "$0 --client name"
@ -102,7 +102,7 @@ if [ ! -r $CA_DIR/keys/dh1024.pem ]; then
openvpn --genkey --secret $CA_DIR/keys/ta.key ## Build a TLS key
fi
do_server() {
function do_server {
NAME=$1
# Generate server certificate
$CA_DIR/pkitool --server $NAME
@ -162,7 +162,7 @@ EOF
/etc/init.d/openvpn restart
}
do_client() {
function do_client {
NAME=$1
# Generate a client certificate
$CA_DIR/pkitool $NAME

View File

@ -50,7 +50,7 @@ PIP_TAR_URL=https://pypi.python.org/packages/source/p/pip/pip-$INSTALL_PIP_VERSI
GetDistro
echo "Distro: $DISTRO"
function get_versions() {
function get_versions {
PIP=$(which pip 2>/dev/null || which pip-python 2>/dev/null || true)
if [[ -n $PIP ]]; then
PIP_VERSION=$($PIP --version | awk '{ print $2}')
@ -61,7 +61,7 @@ function get_versions() {
}
function install_get_pip() {
function install_get_pip {
if [[ ! -r $FILES/get-pip.py ]]; then
(cd $FILES; \
curl -O $PIP_GET_PIP_URL; \
@ -70,7 +70,7 @@ function install_get_pip() {
sudo -E python $FILES/get-pip.py
}
function install_pip_tarball() {
function install_pip_tarball {
(cd $FILES; \
curl -O $PIP_TAR_URL; \
tar xvfz pip-$INSTALL_PIP_VERSION.tar.gz 1>/dev/null; \

View File

@ -5,7 +5,7 @@ CONFIGURATION=$2
ADAPTER=$3
RC=$4
function usage() {
function usage {
echo "Usage: $0 - Build a configuration"
echo ""
echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"

View File

@ -9,7 +9,7 @@ CONFIGURATION=$2
ADAPTER=$3
RC=$4
function usage() {
function usage {
echo "Usage: $0 - Build a test configuration"
echo ""
echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"

View File

@ -8,7 +8,7 @@ CONFIGURATION=$2
ADAPTER=$3
RC=$4
function usage() {
function usage {
echo "Usage: $0 - Build a test configuration"
echo ""
echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"

View File

@ -4,7 +4,7 @@ EXECUTOR_NUMBER=$1
ADAPTER=$2
RC=$3
function usage() {
function usage {
echo "Usage: $0 - Run a test"
echo ""
echo "$0 [EXECUTOR_NUMBER] [ADAPTER] [RC (optional)]"

View File

@ -16,7 +16,7 @@ TOP_DIR=`cd $TOOLS_DIR/..; pwd`
cd $TOP_DIR
# Echo usage
usage() {
function usage {
echo "Cache OpenStack dependencies on a uec image to speed up performance."
echo ""
echo "Usage: $0 [full path to raw uec base image]"

View File

@ -42,7 +42,7 @@ source xenrc
#
GUEST_NAME="$1"
function _print_interface_config() {
function _print_interface_config {
local device_nr
local ip_address
local netmask
@ -68,7 +68,7 @@ function _print_interface_config() {
echo " post-up ethtool -K $device tx off"
}
function print_interfaces_config() {
function print_interfaces_config {
echo "auto lo"
echo "iface lo inet loopback"

View File

@ -166,7 +166,7 @@ TNAME="jeos_template_for_devstack"
SNAME_TEMPLATE="jeos_snapshot_for_devstack"
SNAME_FIRST_BOOT="before_first_boot"
function wait_for_VM_to_halt() {
function wait_for_VM_to_halt {
set +x
echo "Waiting for the VM to halt. Progress in-VM can be checked with vncviewer:"
mgmt_ip=$(echo $XENAPI_CONNECTION_URL | tr -d -c '1234567890.')
@ -318,7 +318,7 @@ xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME_FIRST_BOOT"
#
xe vm-start vm="$GUEST_NAME"
function ssh_no_check() {
function ssh_no_check {
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"
}
@ -349,7 +349,7 @@ DOMID=$(get_domid "$GUEST_NAME")
xenstore-write /local/domain/$DOMID/authorized_keys/$DOMZERO_USER "$(cat /root/dom0key.pub)"
xenstore-chmod -u /local/domain/$DOMID/authorized_keys/$DOMZERO_USER r$DOMID
function run_on_appliance() {
function run_on_appliance {
ssh \
-i /root/dom0key \
-o UserKnownHostsFile=/dev/null \

View File

@ -21,7 +21,7 @@ STACK_USER="$3"
DOMZERO_USER="$4"
function setup_domzero_user() {
function setup_domzero_user {
local username
username="$1"