Merge "Convert all HTML doc to RST"
diff --git a/functions-common b/functions-common
index 333f31d..e6f425f 100644
--- a/functions-common
+++ b/functions-common
@@ -1251,7 +1251,7 @@
if is_service_enabled $service; then
if [[ "$USE_SCREEN" = "True" ]]; then
- screen_service "$service" "$command" "$group"
+ screen_process "$service" "$command" "$group"
else
# Spawn directly without screen
_run_process "$service" "$command" "$group" &
@@ -1259,14 +1259,14 @@
fi
}
-# Helper to launch a service in a named screen
+# Helper to launch a process in a named screen
# Uses globals ``CURRENT_LOG_TIME``, ``SCREEN_NAME``, ``SCREEN_LOGDIR``,
# ``SERVICE_DIR``, ``USE_SCREEN``
-# screen_service service "command-line" [group]
+# screen_process name "command-line" [group]
# Run a command in a shell in a screen window, if an optional group
# is provided, use sg to set the group of the command.
-function screen_service {
- local service=$1
+function screen_process {
+ local name=$1
local command="$2"
local group=$3
@@ -1274,38 +1274,36 @@
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
USE_SCREEN=$(trueorfalse True $USE_SCREEN)
- if is_service_enabled $service; then
- # Append the service to the screen rc file
- screen_rc "$service" "$command"
+ # Append the process to the screen rc file
+ screen_rc "$name" "$command"
- screen -S $SCREEN_NAME -X screen -t $service
+ screen -S $SCREEN_NAME -X screen -t $name
- if [[ -n ${SCREEN_LOGDIR} ]]; then
- screen -S $SCREEN_NAME -p $service -X logfile ${SCREEN_LOGDIR}/screen-${service}.${CURRENT_LOG_TIME}.log
- screen -S $SCREEN_NAME -p $service -X log on
- ln -sf ${SCREEN_LOGDIR}/screen-${service}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${service}.log
- fi
-
- # sleep to allow bash to be ready to be send the command - we are
- # creating a new window in screen and then sends characters, so if
- # bash isn't running by the time we send the command, nothing happens
- sleep 3
-
- NL=`echo -ne '\015'`
- # This fun command does the following:
- # - the passed server command is backgrounded
- # - the pid of the background process is saved in the usual place
- # - the server process is brought back to the foreground
- # - if the server process exits prematurely the fg command errors
- # and a message is written to stdout and the service failure file
- #
- # The pid saved can be used in stop_process() as a process group
- # id to kill off all child processes
- if [[ -n "$group" ]]; then
- command="sg $group '$command'"
- fi
- screen -S $SCREEN_NAME -p $service -X stuff "$command & echo \$! >$SERVICE_DIR/$SCREEN_NAME/${service}.pid; fg || echo \"$service failed to start\" | tee \"$SERVICE_DIR/$SCREEN_NAME/${service}.failure\"$NL"
+ if [[ -n ${SCREEN_LOGDIR} ]]; then
+ screen -S $SCREEN_NAME -p $name -X logfile ${SCREEN_LOGDIR}/screen-${name}.${CURRENT_LOG_TIME}.log
+ screen -S $SCREEN_NAME -p $name -X log on
+ ln -sf ${SCREEN_LOGDIR}/screen-${name}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${name}.log
fi
+
+ # sleep to allow bash to be ready to be send the command - we are
+ # creating a new window in screen and then sends characters, so if
+ # bash isn't running by the time we send the command, nothing happens
+ sleep 3
+
+ NL=`echo -ne '\015'`
+ # This fun command does the following:
+ # - the passed server command is backgrounded
+ # - the pid of the background process is saved in the usual place
+ # - the server process is brought back to the foreground
+ # - if the server process exits prematurely the fg command errors
+ # and a message is written to stdout and the process failure file
+ #
+ # The pid saved can be used in stop_process() as a process group
+ # id to kill off all child processes
+ if [[ -n "$group" ]]; then
+ command="sg $group '$command'"
+ fi
+ screen -S $SCREEN_NAME -p $name -X stuff "$command & echo \$! >$SERVICE_DIR/$SCREEN_NAME/${name}.pid; fg || echo \"$name failed to start\" | tee \"$SERVICE_DIR/$SCREEN_NAME/${name}.failure\"$NL"
}
# Screen rc file builder
@@ -1412,12 +1410,12 @@
# Tail a log file in a screen if USE_SCREEN is true.
function tail_log {
- local service=$1
+ local name=$1
local logfile=$2
USE_SCREEN=$(trueorfalse True $USE_SCREEN)
if [[ "$USE_SCREEN" = "True" ]]; then
- screen_service "$service" "sudo tail -f $logfile"
+ screen_process "$name" "sudo tail -f $logfile"
fi
}
@@ -1476,7 +1474,7 @@
screen_rc "$1" "$2"
if [[ "$USE_SCREEN" = "True" ]]; then
- screen_service "$1" "$2"
+ screen_process "$1" "$2"
else
# Spawn directly without screen
old_run_process "$1" "$2" >$SERVICE_DIR/$SCREEN_NAME/$1.pid
diff --git a/lib/tempest b/lib/tempest
index d677c7e..1716bc7 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -28,6 +28,7 @@
# - ``DEFAULT_INSTANCE_TYPE``
# - ``DEFAULT_INSTANCE_USER``
# - ``CINDER_MULTI_LVM_BACKEND``
+# - ``CINDER_ENABLED_BACKENDS``
#
# ``stack.sh`` calls the entry points in this order:
#
@@ -64,8 +65,10 @@
# Cinder/Volume variables
TEMPEST_VOLUME_DRIVER=${TEMPEST_VOLUME_DRIVER:-default}
-TEMPEST_VOLUME_VENDOR=${TEMPEST_VOLUME_VENDOR:-"Open Source"}
-TEMPEST_STORAGE_PROTOCOL=${TEMPEST_STORAGE_PROTOCOL:-iSCSI}
+TEMPEST_DEFAULT_VOLUME_VENDOR="Open Source"
+TEMPEST_VOLUME_VENDOR=${TEMPEST_VOLUME_VENDOR:-$TEMPEST_DEFAULT_VOLUME_VENDOR}
+TEMPEST_DEFAULT_STORAGE_PROTOCOL="iSCSI"
+TEMPEST_STORAGE_PROTOCOL=${TEMPEST_STORAGE_PROTOCOL:-$TEMPEST_DEFAULT_STORAGE_PROTOCOL}
# Neutron/Network variables
IPV6_ENABLED=$(trueorfalse True $IPV6_ENABLED)
@@ -362,15 +365,25 @@
if ! is_service_enabled c-bak; then
iniset $TEMPEST_CONFIG volume-feature-enabled backup False
fi
- CINDER_MULTI_LVM_BACKEND=$(trueorfalse False $CINDER_MULTI_LVM_BACKEND)
- if [ $CINDER_MULTI_LVM_BACKEND == "True" ]; then
+
+ # Using CINDER_ENABLED_BACKENDS
+ if [[ -n "$CINDER_ENABLED_BACKENDS" ]] && [[ $CINDER_ENABLED_BACKENDS =~ .*,.* ]]; then
iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
- iniset $TEMPEST_CONFIG volume backend1_name "LVM_iSCSI"
- iniset $TEMPEST_CONFIG volume backend2_name "LVM_iSCSI_2"
+ local i=1
+ local be
+ for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
+ local be_name=${be##*:}
+ iniset $TEMPEST_CONFIG volume "backend${i}_name" "$be_name"
+ i=$(( i + 1 ))
+ done
fi
- if [ $TEMPEST_VOLUME_DRIVER != "default" ]; then
+ if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
+ "$TEMPEST_VOLUME_VENDOR" != "$TEMPEST_DEFAULT_VOLUME_VENDOR" ]; then
iniset $TEMPEST_CONFIG volume vendor_name "$TEMPEST_VOLUME_VENDOR"
+ fi
+ if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
+ $TEMPEST_STORAGE_PROTOCOL != $TEMPEST_DEFAULT_STORAGE_PROTOCOL ]; then
iniset $TEMPEST_CONFIG volume storage_protocol $TEMPEST_STORAGE_PROTOCOL
fi
diff --git a/run_tests.sh b/run_tests.sh
index b1aef4f..bf90332 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -43,7 +43,7 @@
echo "Running bash8..."
-./tools/bash8.py -v $FILES
+tox -ebashate
pass_fail $? 0 bash8
diff --git a/stackrc b/stackrc
index 3899525..6cec8e8 100644
--- a/stackrc
+++ b/stackrc
@@ -514,7 +514,7 @@
if [[ "$ENABLED_SERVICES" =~ 'h-api' ]]; then
case "$VIRT_DRIVER" in
libvirt|baremetal|ironic)
- HEAT_CFN_IMAGE_URL=${HEAT_CFN_IMAGE_URL:-"http://dl.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"}
+ HEAT_CFN_IMAGE_URL=${HEAT_CFN_IMAGE_URL:-"https://download.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"}
IMAGE_URLS+=",$HEAT_CFN_IMAGE_URL"
;;
*)
@@ -539,7 +539,7 @@
PRECACHE_IMAGES=$(trueorfalse False $PRECACHE_IMAGES)
if [[ "$PRECACHE_IMAGES" == "True" ]]; then
# staging in update for nodepool
- IMAGE_URL="http://dl.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"
+ IMAGE_URL="https://download.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"
if ! [[ "$IMAGE_URLS" =~ "$IMAGE_URL" ]]; then
IMAGE_URLS+=",$IMAGE_URL"
fi
diff --git a/tools/bash8.py b/tools/bash8.py
deleted file mode 100755
index 3abf87b..0000000
--- a/tools/bash8.py
+++ /dev/null
@@ -1,215 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# bash8 - a pep8 equivalent for bash scripts
-#
-# this program attempts to be an automated style checker for bash scripts
-# to fill the same part of code review that pep8 does in most OpenStack
-# projects. It starts from humble beginnings, and will evolve over time.
-#
-# Currently Supported checks
-#
-# Errors
-# Basic white space errors, for consistent indenting
-# - E001: check that lines do not end with trailing whitespace
-# - E002: ensure that indents are only spaces, and not hard tabs
-# - E003: ensure all indents are a multiple of 4 spaces
-# - E004: file did not end with a newline
-#
-# Structure errors
-#
-# A set of rules that help keep things consistent in control blocks.
-# These are ignored on long lines that have a continuation, because
-# unrolling that is kind of "interesting"
-#
-# - E010: *do* not on the same line as *for*
-# - E011: *then* not on the same line as *if*
-# - E012: heredoc didn't end before EOF
-
-import argparse
-import fileinput
-import re
-import sys
-
-ERRORS = 0
-IGNORE = None
-
-
-def register_ignores(ignores):
- global IGNORE
- if ignores:
- IGNORE = '^(' + '|'.join(ignores.split(',')) + ')'
-
-
-def should_ignore(error):
- return IGNORE and re.search(IGNORE, error)
-
-
-def print_error(error, line,
- filename=None, filelineno=None):
- if not filename:
- filename = fileinput.filename()
- if not filelineno:
- filelineno = fileinput.filelineno()
- global ERRORS
- ERRORS = ERRORS + 1
- print("%s: '%s'" % (error, line.rstrip('\n')))
- print(" - %s: L%s" % (filename, filelineno))
-
-
-def not_continuation(line):
- return not re.search('\\\\$', line)
-
-
-def check_for_do(line):
- if not_continuation(line):
- match = re.match('^\s*(for|while|until)\s', line)
- if match:
- operator = match.group(1).strip()
- if not re.search(';\s*do(\b|$)', line):
- print_error('E010: Do not on same line as %s' % operator,
- line)
-
-
-def check_if_then(line):
- if not_continuation(line):
- if re.search('^\s*if \[', line):
- if not re.search(';\s*then(\b|$)', line):
- print_error('E011: Then non on same line as if', line)
-
-
-def check_no_trailing_whitespace(line):
- if re.search('[ \t]+$', line):
- print_error('E001: Trailing Whitespace', line)
-
-
-def check_indents(line):
- m = re.search('^(?P<indent>[ \t]+)', line)
- if m:
- if re.search('\t', m.group('indent')):
- print_error('E002: Tab 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)
- if m:
- return m.group('token')
- else:
- return False
-
-
-def end_of_multiline(line, token):
- if token:
- return re.search("^%s\s*$" % token, line) is not None
- return False
-
-
-def check_files(files, verbose):
- in_multiline = False
- multiline_start = 0
- multiline_line = ""
- logical_line = ""
- token = False
- prev_file = None
- prev_line = ""
- prev_lineno = 0
-
- for line in fileinput.input(files):
- if fileinput.isfirstline():
- # if in_multiline when the new file starts then we didn't
- # find the end of a heredoc in the last file.
- if in_multiline:
- print_error('E012: heredoc did not end before EOF',
- multiline_line,
- filename=prev_file, filelineno=multiline_start)
- in_multiline = False
-
- # last line of a previous file should always end with a
- # newline
- if prev_file and not prev_line.endswith('\n'):
- print_error('E004: file did not end with a newline',
- prev_line,
- filename=prev_file, filelineno=prev_lineno)
-
- prev_file = fileinput.filename()
-
- if verbose:
- print "Running bash8 on %s" % fileinput.filename()
-
- # NOTE(sdague): multiline processing of heredocs is interesting
- if not in_multiline:
- logical_line = line
- token = starts_multiline(line)
- if token:
- in_multiline = True
- multiline_start = fileinput.filelineno()
- multiline_line = line
- continue
- else:
- logical_line = logical_line + line
- if not end_of_multiline(line, token):
- continue
- else:
- in_multiline = False
-
- check_no_trailing_whitespace(logical_line)
- 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()
-
-def get_options():
- parser = argparse.ArgumentParser(
- description='A bash script style checker')
- parser.add_argument('files', metavar='file', nargs='+',
- help='files to scan for errors')
- parser.add_argument('-i', '--ignore', help='Rules to ignore')
- parser.add_argument('-v', '--verbose', action='store_true', default=False)
- return parser.parse_args()
-
-
-def main():
- opts = get_options()
- register_ignores(opts.ignore)
- check_files(opts.files, opts.verbose)
-
- if ERRORS > 0:
- print("%d bash8 error(s) found" % ERRORS)
- return 1
- else:
- return 0
-
-
-if __name__ == "__main__":
- sys.exit(main())