Merge "Cinder: Set os_privileged_user credentials (for os-assisted-snapshots)"
diff --git a/functions-common b/functions-common
index 4d07c03..52d80fb 100644
--- a/functions-common
+++ b/functions-common
@@ -51,14 +51,16 @@
function trueorfalse {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
- local default=$1
- local literal=$2
- local testval=${!literal:-}
- [[ -z "$testval" ]] && { echo "$default"; return; }
- [[ "0 no No NO false False FALSE" =~ "$testval" ]] && { echo "False"; return; }
- [[ "1 yes Yes YES true True TRUE" =~ "$testval" ]] && { echo "True"; return; }
- echo "$default"
+ local default=$1
+ local testval=${!2:-}
+
+ case "$testval" in
+ "1" | [yY]es | "YES" | [tT]rue | "TRUE" ) echo "True" ;;
+ "0" | [nN]o | "NO" | [fF]alse | "FALSE" ) echo "False" ;;
+ * ) echo "$default" ;;
+ esac
+
$xtrace
}
@@ -1897,6 +1899,12 @@
echo $subnet
}
+# Return the current python as "python<major>.<minor>"
+function python_version {
+ local python_version=$(python -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
+ echo "python${python_version}"
+}
+
# Service wrapper to restart services
# restart_service service-name
function restart_service {
diff --git a/lib/glance b/lib/glance
index f543e54..4e1bd24 100644
--- a/lib/glance
+++ b/lib/glance
@@ -138,26 +138,12 @@
fi
# Store specific configs
- iniset $GLANCE_API_CONF DEFAULT filesystem_store_datadir $GLANCE_IMAGE_DIR/
-
- # NOTE(flaper87): Until Glance is fully migrated, set these configs in both
- # sections.
iniset $GLANCE_API_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
# Store the images in swift if enabled.
if is_service_enabled s-proxy; then
- iniset $GLANCE_API_CONF DEFAULT default_store swift
- iniset $GLANCE_API_CONF DEFAULT swift_store_auth_address $KEYSTONE_SERVICE_URI/v2.0/
- iniset $GLANCE_API_CONF DEFAULT swift_store_user $SERVICE_TENANT_NAME:glance-swift
- iniset $GLANCE_API_CONF DEFAULT swift_store_key $SERVICE_PASSWORD
- iniset $GLANCE_API_CONF DEFAULT swift_store_create_container_on_put True
-
- iniset $GLANCE_API_CONF DEFAULT known_stores "glance.store.filesystem.Store, glance.store.http.Store, glance.store.swift.Store"
-
- # NOTE(flaper87): Until Glance is fully migrated, set these configs in both
- # sections.
iniset $GLANCE_API_CONF glance_store default_store swift
iniset $GLANCE_API_CONF glance_store swift_store_auth_address $KEYSTONE_SERVICE_URI/v2.0/
iniset $GLANCE_API_CONF glance_store swift_store_user $SERVICE_TENANT_NAME:glance-swift
@@ -211,9 +197,6 @@
iniset $GLANCE_CACHE_CONF DEFAULT admin_password $SERVICE_PASSWORD
# Store specific confs
- # NOTE(flaper87): Until Glance is fully migrated, set these configs in both
- # sections.
- iniset $GLANCE_CACHE_CONF DEFAULT filesystem_store_datadir $GLANCE_IMAGE_DIR/
iniset $GLANCE_CACHE_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
cp -p $GLANCE_DIR/etc/policy.json $GLANCE_POLICY_JSON
diff --git a/lib/keystone b/lib/keystone
index 997bb14..0f369af 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -164,7 +164,7 @@
keystone_auth_port=$KEYSTONE_AUTH_PORT_INT
fi
if [[ ${USE_VENV} = True ]]; then
- venv_path="python-path=${PROJECT_VENV["keystone"]}/lib/python2.7/site-packages"
+ venv_path="python-path=${PROJECT_VENV["keystone"]}/lib/$(python_version)/site-packages"
fi
# copy proxy vhost and wsgi file
diff --git a/lib/nova b/lib/nova
index 6ac9da3..7d2145b 100644
--- a/lib/nova
+++ b/lib/nova
@@ -259,7 +259,7 @@
nova_keyfile="SSLCertificateKeyFile $NOVA_SSL_KEY"
fi
if [[ ${USE_VENV} = True ]]; then
- venv_path="python-path=${PROJECT_VENV["nova"]}/lib/python2.7/site-packages"
+ venv_path="python-path=${PROJECT_VENV["nova"]}/lib/$(python_version)/site-packages"
fi
# copy proxy vhost and wsgi helper files
diff --git a/lib/swift b/lib/swift
index 456dde4..820042d 100644
--- a/lib/swift
+++ b/lib/swift
@@ -439,7 +439,7 @@
if is_service_enabled swift3; then
cat <<EOF >>${SWIFT_CONFIG_PROXY_SERVER}
[filter:s3token]
-paste.filter_factory = keystoneclient.middleware.s3_token:filter_factory
+paste.filter_factory = keystonemiddleware.s3_token:filter_factory
auth_port = ${KEYSTONE_AUTH_PORT}
auth_host = ${KEYSTONE_AUTH_HOST}
auth_protocol = ${KEYSTONE_AUTH_PROTOCOL}
diff --git a/lib/tempest b/lib/tempest
index 6ce245a..1af5c7a 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -106,6 +106,10 @@
pip_install_gr testrepository
fi
+ # Used during configuration so make sure we have the correct
+ # version installed
+ pip_install_gr python-openstackclient
+
local image_lines
local images
local num_images
diff --git a/tests/test_truefalse.sh b/tests/test_truefalse.sh
index e57948a..ebd9650 100755
--- a/tests/test_truefalse.sh
+++ b/tests/test_truefalse.sh
@@ -8,27 +8,36 @@
source $TOP/functions
source $TOP/tests/unittest.sh
-function test_truefalse {
+function test_trueorfalse {
local one=1
local captrue=True
local lowtrue=true
- local abrevtrue=t
+ local uppertrue=TRUE
+ local capyes=Yes
+ local lowyes=yes
+ local upperyes=YES
+
+ for default in True False; do
+ for name in one captrue lowtrue uppertrue capyes lowyes upperyes; do
+ assert_equal "True" $(trueorfalse $default $name) "\$(trueorfalse $default $name)"
+ done
+ done
+
local zero=0
local capfalse=False
local lowfalse=false
- local abrevfalse=f
- for against in True False; do
- for name in one captrue lowtrue abrevtrue; do
- assert_equal "True" $(trueorfalse $against $name) "\$(trueorfalse $against $name)"
- done
- done
- for against in True False; do
- for name in zero capfalse lowfalse abrevfalse; do
- assert_equal "False" $(trueorfalse $against $name) "\$(trueorfalse $against $name)"
+ local upperfalse=FALSE
+ local capno=No
+ local lowno=no
+ local upperno=NO
+
+ for default in True False; do
+ for name in zero capfalse lowfalse upperfalse capno lowno upperno; do
+ assert_equal "False" $(trueorfalse $default $name) "\$(trueorfalse $default $name)"
done
done
}
-test_truefalse
+test_trueorfalse
report_results
diff --git a/tools/worlddump.py b/tools/worlddump.py
index cb32510..d846f10 100755
--- a/tools/worlddump.py
+++ b/tools/worlddump.py
@@ -18,6 +18,7 @@
import argparse
import datetime
+import fnmatch
import os
import os.path
import sys
@@ -41,12 +42,24 @@
print "WARN: %s" % msg
+def _dump_cmd(cmd):
+ print cmd
+ print "-" * len(cmd)
+ print
+ print os.popen(cmd).read()
+
+
+def _header(name):
+ print
+ print name
+ print "=" * len(name)
+ print
+
+
def disk_space():
# the df output
- print """
-File System Summary
-===================
-"""
+ _header("File System Summary")
+
dfraw = os.popen("df -Ph").read()
df = [s.split() for s in dfraw.splitlines()]
for fs in df:
@@ -63,22 +76,34 @@
def iptables_dump():
tables = ['filter', 'nat', 'mangle']
- print """
-IP Tables Dump
-===============
-"""
+ _header("IP Tables Dump")
+
for table in tables:
- print os.popen("sudo iptables --line-numbers -L -nv -t %s"
- % table).read()
+ _dump_cmd("sudo iptables --line-numbers -L -nv -t %s" % table)
+
+
+def network_dump():
+ _header("Network Dump")
+
+ _dump_cmd("brctl show")
+ _dump_cmd("arp -n")
+ _dump_cmd("ip addr")
+ _dump_cmd("ip link")
+ _dump_cmd("ip route")
def process_list():
- print """
-Process Listing
-===============
-"""
- psraw = os.popen("ps axo user,ppid,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,args").read()
- print psraw
+ _header("Process Listing")
+ _dump_cmd("ps axo "
+ "user,ppid,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,args")
+
+
+def compute_consoles():
+ _header("Compute consoles")
+ for root, dirnames, filenames in os.walk('/opt/stack'):
+ for filename in fnmatch.filter(filenames, 'console.log'):
+ fullpath = os.path.join(root, filename)
+ _dump_cmd("sudo cat %s" % fullpath)
def main():
@@ -90,7 +115,9 @@
os.dup2(f.fileno(), sys.stdout.fileno())
disk_space()
process_list()
+ network_dump()
iptables_dump()
+ compute_consoles()
if __name__ == '__main__':