e263c82e |
#!/bin/bash
# |
d093121f |
# lib/tempest |
6d04fd7b |
# Install and configure Tempest |
d093121f |
# Dependencies: |
6a5aa7c6 |
#
# - ``functions`` file
# - ``lib/nova`` service is running
# - Global vars that are assumed to be defined:
# - ``DEST``, ``FILES``
# - ``ADMIN_PASSWORD``
# - ``DEFAULT_IMAGE_NAME`` |
befe0925 |
# - ``DEFAULT_IMAGE_FILE_NAME`` |
6a5aa7c6 |
# - ``S3_SERVICE_PORT``
# - ``SERVICE_HOST``
# - ``BASE_SQL_CONN`` ``lib/database`` declares
# - ``PUBLIC_NETWORK_NAME``
# - ``VIRT_DRIVER``
# - ``LIBVIRT_TYPE`` |
c2c89e4b |
# - ``KEYSTONE_SERVICE_URI``, ``KEYSTONE_SERVICE_URI_V3`` from lib/keystone |
6a5aa7c6 |
# |
2aa35174 |
# Optional Dependencies: |
6a5aa7c6 |
# |
f54f60a6 |
# - ``ALT_*`` |
6a5aa7c6 |
# - ``LIVE_MIGRATION_AVAILABLE``
# - ``USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION``
# - ``DEFAULT_INSTANCE_TYPE``
# - ``DEFAULT_INSTANCE_USER`` |
09fb7baf |
# - ``CINDER_ENABLED_BACKENDS`` |
89ee5852 |
# - ``NOVA_ALLOW_DUPLICATE_NETWORKS`` |
6a5aa7c6 |
# |
d093121f |
# ``stack.sh`` calls the entry points in this order:
# |
6a5aa7c6 |
# - install_tempest
# - configure_tempest |
d093121f |
# Save trace setting |
523f4880 |
_XTRACE_TEMPEST=$(set +o | grep xtrace) |
d093121f |
set +o xtrace
|
6d04fd7b |
|
d093121f |
# Defaults
# --------
# Set up default directories
TEMPEST_DIR=$DEST/tempest |
dc4dc7f0 |
TEMPEST_CONFIG_DIR=${TEMPEST_CONFIG_DIR:-$TEMPEST_DIR/etc}
TEMPEST_CONFIG=$TEMPEST_CONFIG_DIR/tempest.conf |
14ccba0e |
TEMPEST_STATE_PATH=${TEMPEST_STATE_PATH:=$DATA_DIR/tempest} |
2aa35174 |
|
1bde9b4b |
# This is the timeout that tempest will wait for a VM to change state,
# spawn, delete, etc.
# The default is set to 196 seconds.
BUILD_TIMEOUT=${BUILD_TIMEOUT:-196} |
d093121f |
|
c9b245bb |
# This must be False on stable branches, as master tempest
# deps do not match stable branch deps. Set this to True to |
dc97cb71 |
# have tempest installed in DevStack by default. |
cb3ceced |
INSTALL_TEMPEST=${INSTALL_TEMPEST:-"True"} |
c9b245bb |
|
440464cc |
# This variable is passed directly to pip install inside the common tox venv
# that is created
TEMPEST_PLUGINS=${TEMPEST_PLUGINS:-0}
|
dc4dc7f0 |
# Cinder/Volume variables
TEMPEST_VOLUME_DRIVER=${TEMPEST_VOLUME_DRIVER:-default} |
01456487 |
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} |
cc6b4435 |
|
71ef61ac |
# Neutron/Network variables |
53753293 |
IPV6_ENABLED=$(trueorfalse True IPV6_ENABLED)
IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True IPV6_SUBNET_ATTRIBUTES_ENABLED) |
71ef61ac |
|
df8f43b4 |
# Do we want to make a configuration where Tempest has admin on
# the cloud. We don't always want to so that we can ensure Tempest
# would work on a public cloud.
TEMPEST_HAS_ADMIN=$(trueorfalse True TEMPEST_HAS_ADMIN)
# Credential provider configuration option variables
TEMPEST_ALLOW_TENANT_ISOLATION=${TEMPEST_ALLOW_TENANT_ISOLATION:-$TEMPEST_HAS_ADMIN} |
403fbb1d |
TEMPEST_USE_TEST_ACCOUNTS=$(trueorfalse False TEMPEST_USE_TEST_ACCOUNTS) |
df8f43b4 |
# The number of workers tempest is expected to be run with. This is used for
# generating a accounts.yaml for running with test-accounts. This is also the
# same variable that devstack-gate uses to specify the number of workers that
# it will run tempest with
TEMPEST_CONCURRENCY=${TEMPEST_CONCURRENCY:-$(nproc)}
|
dc97cb71 |
|
cc6b4435 |
# Functions
# --------- |
d093121f |
|
33e8ee20 |
# remove_disabled_extension - removes disabled extensions from the list of extensions
# to test for a given service
function remove_disabled_extensions {
local extensions_list=$1
shift
local disabled_exts=$* |
8606c98c |
remove_disabled_services "$extensions_list" "$disabled_exts" |
33e8ee20 |
}
|
d093121f |
# configure_tempest() - Set config files, create data dirs, etc |
aee18c74 |
function configure_tempest { |
c9b245bb |
if [[ "$INSTALL_TEMPEST" == "True" ]]; then
setup_develop $TEMPEST_DIR
else
# install testr since its used to process tempest logs |
60996b1b |
pip_install_gr testrepository |
c9b245bb |
fi |
d5ac7852 |
|
65c0846e |
local image_lines
local images
local num_images
local image_uuid
local image_uuid_alt
local password
local line
local flavors |
3b80bde8 |
local available_flavors |
65c0846e |
local flavors_ref
local flavor_lines |
a5c774ea |
local public_network_id |
31c94ab5 |
local public_router_id |
5544c4a7 |
local ssh_connect_method="floating" |
2aa35174 |
|
6d04fd7b |
# Save IFS |
2aa35174 |
ifs=$IFS
# Glance should already contain images to be used in tempest
# testing. Here we simply look for images stored in Glance
# and set the appropriate variables for use in the tempest config
# We ignore ramdisk and kernel images, look for the default image |
65c0846e |
# ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the
# first image returned and set ``image_uuid_alt`` to the second, |
2aa35174 |
# if there is more than one returned...
# ... Also ensure we only take active images, so we don't get snapshots in process |
c24e23b4 |
declare -a images
|
c411fcfc |
if is_service_enabled glance; then
while read -r IMAGE_NAME IMAGE_UUID; do
if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
image_uuid="$IMAGE_UUID"
image_uuid_alt="$IMAGE_UUID" |
c24e23b4 |
fi |
c411fcfc |
images+=($IMAGE_UUID) |
a747cd25 |
done < <(openstack image list --property status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }') |
c411fcfc |
case "${#images[*]}" in
0)
echo "Found no valid images to use!"
exit 1
;;
1)
if [ -z "$image_uuid" ]; then
image_uuid=${images[0]}
image_uuid_alt=${images[0]}
fi
;;
*)
if [ -z "$image_uuid" ]; then
image_uuid=${images[0]}
image_uuid_alt=${images[1]}
fi
;;
esac
fi |
2aa35174 |
|
93c10571 |
# (Re)create ``tempest.conf``
# Create every time because the image UUIDS are going to change |
8421c2b9 |
sudo install -d -o $STACK_USER $TEMPEST_CONFIG_DIR |
93c10571 |
rm -f $TEMPEST_CONFIG |
2aa35174 |
|
7ed812c6 |
local password=${ADMIN_PASSWORD:-secret} |
2aa35174 |
|
dc97cb71 |
# See ``lib/keystone`` where these users and tenants are set up |
0f765358 |
local admin_username=${ADMIN_USERNAME:-admin} |
76392b5b |
local admin_project_name=${ADMIN_TENANT_NAME:-admin} |
0f765358 |
local admin_domain_name=${ADMIN_DOMAIN_NAME:-Default}
local alt_username=${ALT_USERNAME:-alt_demo} |
76392b5b |
local alt_project_name=${ALT_TENANT_NAME:-alt_demo}
local admin_project_id
admin_project_id=$(openstack project list | awk "/ admin / { print \$2 }") |
2aa35174 |
|
c411fcfc |
if is_service_enabled nova; then |
dc97cb71 |
# If ``DEFAULT_INSTANCE_TYPE`` is not declared, use the new behavior
# Tempest creates its own instance types |
0b4c83a0 |
available_flavors=$(nova flavor-list) |
c411fcfc |
if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then |
82fa946d |
openstack flavor create --id 42 --ram 64 --disk 0 --vcpus 1 m1.nano |
ba0f1d36 |
fi |
c411fcfc |
flavor_ref=42
if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then |
82fa946d |
openstack flavor create --id 84 --ram 128 --disk 0 --vcpus 1 m1.micro |
ba0f1d36 |
fi |
c411fcfc |
flavor_ref_alt=84
else |
dc97cb71 |
# Check Nova for existing flavors, if ``DEFAULT_INSTANCE_TYPE`` is set use it. |
c411fcfc |
IFS=$'\r\n'
flavors="" |
0b4c83a0 |
for line in $available_flavors; do |
c411fcfc |
f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
flavors="$flavors $f"
done
|
0b4c83a0 |
for line in $available_flavors; do |
c411fcfc |
flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
done
IFS=" "
flavors=($flavors)
num_flavors=${#flavors[*]}
echo "Found $num_flavors flavors"
if [[ $num_flavors -eq 0 ]]; then
echo "Found no valid flavors to use!"
exit 1 |
63a71a23 |
fi |
c411fcfc |
flavor_ref=${flavors[0]}
flavor_ref_alt=$flavor_ref
|
dc97cb71 |
# Ensure ``flavor_ref`` and ``flavor_ref_alt`` have different values.
# Some resize instance in tempest tests depends on this. |
c411fcfc |
for f in ${flavors[@]:1}; do |
3345a6d3 |
if [[ "$f" != "$flavor_ref" ]]; then |
c411fcfc |
flavor_ref_alt=$f
break
fi
done
fi |
2aa35174 |
fi
|
a2ec7fdb |
iniset $TEMPEST_CONFIG network project_network_cidr $FIXED_RANGE
|
386ae8c1 |
ssh_connect_method=${TEMPEST_SSH_CONNECT_METHOD:-$ssh_connect_method}
|
53f59d80 |
# the public network (for floating ip access) is only available
# if the extension is enabled. |
8e14240d |
# If NEUTRON_CREATE_INITIAL_NETWORKS is not true, there is no network created
# and the public_network_id should not be set.
if [[ "$NEUTRON_CREATE_INITIAL_NETWORKS" == "True" ]] && is_networking_extension_supported 'external-net'; then |
d038b60e |
public_network_id=$(openstack network show -f value -c id $PUBLIC_NETWORK_NAME) |
a5c774ea |
fi
|
5a252d9a |
iniset $TEMPEST_CONFIG DEFAULT use_syslog $SYSLOG |
dc97cb71 |
|
859cc680 |
# Oslo |
23d6d506 |
iniset $TEMPEST_CONFIG oslo_concurrency lock_path $TEMPEST_STATE_PATH |
14ccba0e |
mkdir -p $TEMPEST_STATE_PATH |
dc4dc7f0 |
iniset $TEMPEST_CONFIG DEFAULT use_stderr False
iniset $TEMPEST_CONFIG DEFAULT log_file tempest.log
iniset $TEMPEST_CONFIG DEFAULT debug True |
859cc680 |
|
2aa35174 |
# Timeouts |
dc4dc7f0 |
iniset $TEMPEST_CONFIG compute build_timeout $BUILD_TIMEOUT
iniset $TEMPEST_CONFIG volume build_timeout $BUILD_TIMEOUT |
2aa35174 |
|
97d3d202 |
# Identity |
c2c89e4b |
iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_URI/v2.0/" |
b74e01c3 |
iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_URI_V3" |
b51a8862 |
iniset $TEMPEST_CONFIG identity user_lockout_failure_attempts $KEYSTONE_LOCKOUT_FAILURE_ATTEMPTS
iniset $TEMPEST_CONFIG identity user_lockout_duration $KEYSTONE_LOCKOUT_DURATION
iniset $TEMPEST_CONFIG identity user_unique_last_password_count $KEYSTONE_UNIQUE_LAST_PASSWORD_COUNT |
5cda4911 |
# Use domain scoped tokens for admin v3 tests, v3 dynamic credentials of v3 account generation
iniset $TEMPEST_CONFIG identity admin_domain_scope True |
7ced150f |
if [[ "$TEMPEST_HAS_ADMIN" == "True" ]]; then |
0f765358 |
iniset $TEMPEST_CONFIG auth admin_username $admin_username |
fbe0a627 |
iniset $TEMPEST_CONFIG auth admin_password "$password" |
2d9959c5 |
iniset $TEMPEST_CONFIG auth admin_project_name $admin_project_name |
0f765358 |
iniset $TEMPEST_CONFIG auth admin_domain_name $admin_domain_name |
7ced150f |
fi |
75bf9722 |
if [ "$ENABLE_IDENTITY_V2" == "True" ]; then
# Run Identity API v2 tests ONLY if needed
iniset $TEMPEST_CONFIG identity-feature-enabled api_v2 True
else
# Skip Identity API v2 tests by default |
75c1dfe3 |
iniset $TEMPEST_CONFIG identity-feature-enabled api_v2 False |
3fd71d68 |
fi |
dc6e5502 |
iniset $TEMPEST_CONFIG identity auth_version ${TEMPEST_AUTH_VERSION:-v3} |
11b8649e |
if [[ "$TEMPEST_AUTH_VERSION" != "v2" ]]; then
# we're going to disable v2 admin unless we're using v2 by default. |
bb443112 |
iniset $TEMPEST_CONFIG identity-feature-enabled api_v2_admin False
fi |
3fd71d68 |
|
f3b2f4c8 |
if is_service_enabled tls-proxy; then |
e1d013f9 |
iniset $TEMPEST_CONFIG identity ca_certificates_file $SSL_BUNDLE_FILE
fi |
97d3d202 |
|
0578e42f |
# Identity Features |
b51a8862 |
if [[ "$KEYSTONE_SECURITY_COMPLIANCE_ENABLED" = True ]]; then
iniset $TEMPEST_CONFIG identity-feature-enabled security_compliance True
fi |
0578e42f |
|
1d141daa |
# When LDAP is enabled domain specific drivers are also enabled and the users
# and groups identity tests must adapt to this scenario
if is_service_enabled ldap; then
iniset $TEMPEST_CONFIG identity-feature-enabled domain_specific_drivers True
fi
|
1ab9a2d1 |
# TODO(felipemonteiro): Remove this once Tempest no longer supports Pike
# as this is supported in Queens and beyond.
iniset $TEMPEST_CONFIG identity-feature-enabled project_tags True
|
931f82dc |
# In Queens and later, application credentials are enabled by default
# so remove this once Tempest no longer supports Pike.
iniset $TEMPEST_CONFIG identity-feature-enabled application_credentials True
|
c3771456 |
# Image |
dc97cb71 |
# We want to be able to override this variable in the gate to avoid
# doing an external HTTP fetch for this test. |
c3771456 |
if [[ ! -z "$TEMPEST_HTTP_IMAGE" ]]; then |
dc4dc7f0 |
iniset $TEMPEST_CONFIG image http_image $TEMPEST_HTTP_IMAGE |
c3771456 |
fi |
2dd761b1 |
if [ "$VIRT_DRIVER" = "xenserver" ]; then
iniset $TEMPEST_CONFIG image disk_formats "ami,ari,aki,vhd,raw,iso"
fi |
c3771456 |
|
f100e1cf |
# Image Features |
22c695f0 |
if [ "$GLANCE_V1_ENABLED" != "True" ]; then
iniset $TEMPEST_CONFIG image-feature-enabled api_v1 False
fi |
f100e1cf |
|
97d3d202 |
# Compute |
dc4dc7f0 |
iniset $TEMPEST_CONFIG compute image_ref $image_uuid
iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid_alt
iniset $TEMPEST_CONFIG compute flavor_ref $flavor_ref
iniset $TEMPEST_CONFIG compute flavor_ref_alt $flavor_ref_alt |
563a7e75 |
iniset $TEMPEST_CONFIG validation connect_method $ssh_connect_method |
4c813ac0 |
if ! is_service_enabled n-cell && ! is_service_enabled neutron; then |
f5b550ee |
iniset $TEMPEST_CONFIG compute fixed_network_name $PRIVATE_NETWORK_NAME
fi |
97d3d202 |
|
8349aff5 |
# Set the service catalog entry for Tempest to run on. Typically
# used to try different compute API version targets. The tempest
# default if 'compute', which is typically valid, so only set this
# if you want to change it.
if [[ -n "$TEMPEST_COMPUTE_TYPE" ]]; then
iniset $TEMPEST_CONFIG compute catalog_type $TEMPEST_COMPUTE_TYPE
fi
|
de19bf9b |
# Compute Features |
642b07b9 |
# Set the microversion range for compute tests.
# This is used to run the Nova microversions tests.
# Setting [None, latest] range of microversion which allow Tempest to run all microversions tests.
# NOTE- To avoid microversion tests failure on stable branch, we need to change "tempest_compute_max_microversion"
# for stable branch on each release which should be changed from "latest" to max supported version of that release.
local tempest_compute_min_microversion=${TEMPEST_COMPUTE_MIN_MICROVERSION:-None}
local tempest_compute_max_microversion=${TEMPEST_COMPUTE_MAX_MICROVERSION:-"latest"}
# Reset microversions to None where v2.0 is running which does not support microversion.
# Both "None" means no microversion testing.
if [[ "$TEMPEST_COMPUTE_TYPE" == "compute_legacy" ]]; then
tempest_compute_min_microversion=None
tempest_compute_max_microversion=None
fi
if [ "$tempest_compute_min_microversion" == "None" ]; then |
f5a50a0f |
inicomment $TEMPEST_CONFIG compute min_microversion |
642b07b9 |
else |
f5a50a0f |
iniset $TEMPEST_CONFIG compute min_microversion $tempest_compute_min_microversion |
642b07b9 |
fi
if [ "$tempest_compute_max_microversion" == "None" ]; then |
f5a50a0f |
inicomment $TEMPEST_CONFIG compute max_microversion |
642b07b9 |
else |
f5a50a0f |
iniset $TEMPEST_CONFIG compute max_microversion $tempest_compute_max_microversion |
642b07b9 |
fi
|
6d3670a6 |
iniset $TEMPEST_CONFIG compute-feature-enabled personality ${ENABLE_FILE_INJECTION:-False} |
de19bf9b |
iniset $TEMPEST_CONFIG compute-feature-enabled resize True |
270f93e5 |
iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
iniset $TEMPEST_CONFIG compute-feature-enabled block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False} |
8a92b7f1 |
iniset $TEMPEST_CONFIG compute-feature-enabled live_migrate_back_and_forth ${LIVE_MIGRATE_BACK_AND_FORTH:-False} |
e57a3322 |
iniset $TEMPEST_CONFIG compute-feature-enabled attach_encrypted_volume ${ATTACH_ENCRYPTED_VOLUME_AVAILABLE:-True} |
09b431d7 |
if is_service_enabled n-cell; then
# Cells doesn't support shelving/unshelving
iniset $TEMPEST_CONFIG compute-feature-enabled shelve False |
c94403d8 |
# Cells doesn't support hot-plugging virtual interfaces.
iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False |
2bebf2d8 |
# Cells v1 doesn't support the rescue/unrescue tests in Tempest
iniset $TEMPEST_CONFIG compute-feature-enabled rescue False |
6cd616a9 |
if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
# Cells supports resize but does not currently work with devstack
# because of the custom flavors created for Tempest runs which are
# not in the cells database.
# TODO(mriedem): work on adding a nova-manage command to sync
# flavors into the cells database.
iniset $TEMPEST_CONFIG compute-feature-enabled resize False
fi |
09b431d7 |
fi |
de19bf9b |
|
ffe691ec |
if [[ $ENABLE_VOLUME_MULTIATTACH == "True" ]]; then
iniset $TEMPEST_CONFIG compute-feature-enabled volume_multiattach True
fi
|
6645cf7a |
if is_service_enabled n-novnc; then |
10db2b8e |
iniset $TEMPEST_CONFIG compute-feature-enabled vnc_console True
fi
|
ea21eb4f |
# Network |
f5a50a0f |
iniset $TEMPEST_CONFIG network project_networks_reachable false |
dc4dc7f0 |
iniset $TEMPEST_CONFIG network public_network_id "$public_network_id"
iniset $TEMPEST_CONFIG network public_router_id "$public_router_id"
iniset $TEMPEST_CONFIG network default_network "$FIXED_RANGE" |
ccf60f75 |
iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED" |
bb2908b7 |
iniset $TEMPEST_CONFIG network-feature-enabled ipv6_subnet_attributes "$IPV6_SUBNET_ATTRIBUTES_ENABLED" |
c9c9d31d |
iniset $TEMPEST_CONFIG network-feature-enabled port_security $NEUTRON_PORT_SECURITY |
33e8ee20 |
|
24d866ef |
# Scenario |
2b3ac6dc |
if [ "$VIRT_DRIVER" = "xenserver" ]; then
SCENARIO_IMAGE_DIR=${SCENARIO_IMAGE_DIR:-$FILES}
SCENARIO_IMAGE_FILE="cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.vhd.tgz"
iniset $TEMPEST_CONFIG scenario img_disk_format vhd
iniset $TEMPEST_CONFIG scenario img_container_format ovf
else |
6fc332d8 |
SCENARIO_IMAGE_DIR=${SCENARIO_IMAGE_DIR:-$FILES} |
befe0925 |
SCENARIO_IMAGE_FILE=$DEFAULT_IMAGE_FILE_NAME |
2b3ac6dc |
fi |
d2cb234b |
iniset $TEMPEST_CONFIG scenario img_dir $SCENARIO_IMAGE_DIR |
2b3ac6dc |
iniset $TEMPEST_CONFIG scenario img_file $SCENARIO_IMAGE_FILE |
24d866ef |
|
7938d83d |
# If using provider networking, use the physical network for validation rather than private
TEMPEST_SSH_NETWORK_NAME=$PRIVATE_NETWORK_NAME
if is_provider_network; then
TEMPEST_SSH_NETWORK_NAME=$PHYSICAL_NETWORK
fi |
994db617 |
# Validation |
ef1e88ec |
iniset $TEMPEST_CONFIG validation run_validation ${TEMPEST_RUN_VALIDATION:-True} |
fbe0a627 |
iniset $TEMPEST_CONFIG validation ip_version_for_ssh 4
iniset $TEMPEST_CONFIG validation ssh_timeout $BUILD_TIMEOUT
iniset $TEMPEST_CONFIG validation image_ssh_user ${DEFAULT_INSTANCE_USER:-cirros} |
7938d83d |
iniset $TEMPEST_CONFIG validation network_for_ssh $TEMPEST_SSH_NETWORK_NAME |
994db617 |
|
97e1bd03 |
# Volume |
7a8d850d |
# Set the service catalog entry for Tempest to run on. Typically
# used to try different Volume API version targets. The tempest
# default it to 'volumev3'(v3 APIs endpoint) , so only set this
# if you want to change it.
if [[ -n "$TEMPEST_VOLUME_TYPE" ]]; then
iniset $TEMPEST_CONFIG volume catalog_type $TEMPEST_VOLUME_TYPE
fi |
3eb7c97a |
# Only turn on TEMPEST_VOLUME_MANAGE_SNAPSHOT by default for "lvm" backends
if [[ "$CINDER_ENABLED_BACKENDS" == *"lvm"* ]]; then
TEMPEST_VOLUME_MANAGE_SNAPSHOT=${TEMPEST_VOLUME_MANAGE_SNAPSHOT:-True}
fi
iniset $TEMPEST_CONFIG volume-feature-enabled manage_snapshot $(trueorfalse False TEMPEST_VOLUME_MANAGE_SNAPSHOT) |
d5919d08 |
# Only turn on TEMPEST_VOLUME_MANAGE_VOLUME by default for "lvm" backends
if [[ "$CINDER_ENABLED_BACKENDS" == *"lvm"* ]]; then
TEMPEST_VOLUME_MANAGE_VOLUME=${TEMPEST_VOLUME_MANAGE_VOLUME:-True}
fi
iniset $TEMPEST_CONFIG volume-feature-enabled manage_volume $(trueorfalse False TEMPEST_VOLUME_MANAGE_VOLUME) |
17cdecc6 |
# Only turn on TEMPEST_EXTEND_ATTACHED_VOLUME by default for "lvm" backends
# in Cinder and the libvirt driver in Nova.
if [[ "$CINDER_ENABLED_BACKENDS" == *"lvm"* ]] && [ "$VIRT_DRIVER" = "libvirt" ]; then
TEMPEST_EXTEND_ATTACHED_VOLUME=${TEMPEST_EXTEND_ATTACHED_VOLUME:-True}
fi
iniset $TEMPEST_CONFIG volume-feature-enabled extend_attached_volume $(trueorfalse False TEMPEST_EXTEND_ATTACHED_VOLUME) |
0c0c09af |
local tempest_volume_min_microversion=${TEMPEST_VOLUME_MIN_MICROVERSION:-None}
local tempest_volume_max_microversion=${TEMPEST_VOLUME_MAX_MICROVERSION:-"latest"} |
7a8d850d |
# Reset microversions to None where v2 is running which does not support microversion.
# Both "None" means no microversion testing.
if [[ "$TEMPEST_VOLUME_TYPE" == "volumev2" ]]; then
tempest_volume_min_microversion=None
tempest_volume_max_microversion=None
fi |
0c0c09af |
if [ "$tempest_volume_min_microversion" == "None" ]; then
inicomment $TEMPEST_CONFIG volume min_microversion
else
iniset $TEMPEST_CONFIG volume min_microversion $tempest_volume_min_microversion
fi
if [ "$tempest_volume_max_microversion" == "None" ]; then
inicomment $TEMPEST_CONFIG volume max_microversion
else
iniset $TEMPEST_CONFIG volume max_microversion $tempest_volume_max_microversion
fi |
d1d6667c |
|
3d60f4dd |
if ! is_service_enabled c-bak; then
iniset $TEMPEST_CONFIG volume-feature-enabled backup False |
3632ab1b |
fi |
09fb7baf |
|
dc97cb71 |
# Using ``CINDER_ENABLED_BACKENDS`` |
3ac1ea85 |
# Cinder uses a comma separated list with "type:backend_name":
# CINDER_ENABLED_BACKENDS = ceph:cephBE1,lvm:lvmBE2,foo:my_foo |
09fb7baf |
if [[ -n "$CINDER_ENABLED_BACKENDS" ]] && [[ $CINDER_ENABLED_BACKENDS =~ .*,.* ]]; then |
3ac1ea85 |
# We have at least 2 backends |
db1c3847 |
iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True" |
3ac1ea85 |
local add_comma_seperator=0
local backends_list='' |
09fb7baf |
local be |
3ac1ea85 |
# Tempest uses a comma separated list of backend_names:
# backend_names = BACKEND_1,BACKEND_2 |
09fb7baf |
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do |
3ac1ea85 |
if [ "$add_comma_seperator" -eq "1" ]; then
backends_list+=,${be##*:}
else
# first element in the list
backends_list+=${be##*:}
add_comma_seperator=1
fi |
09fb7baf |
done |
3ac1ea85 |
iniset $TEMPEST_CONFIG volume "backend_names" "$backends_list" |
dc4dc7f0 |
fi
|
01456487 |
if [ $TEMPEST_VOLUME_DRIVER != "default" -o \ |
1c0628f8 |
"$TEMPEST_VOLUME_VENDOR" != "$TEMPEST_DEFAULT_VOLUME_VENDOR" ]; then |
2f23d757 |
iniset $TEMPEST_CONFIG volume vendor_name "$TEMPEST_VOLUME_VENDOR" |
01456487 |
fi
if [ $TEMPEST_VOLUME_DRIVER != "default" -o \ |
82a7d939 |
"$TEMPEST_STORAGE_PROTOCOL" != "$TEMPEST_DEFAULT_STORAGE_PROTOCOL" ]; then
iniset $TEMPEST_CONFIG volume storage_protocol "$TEMPEST_STORAGE_PROTOCOL" |
97e1bd03 |
fi
|
43bd667b |
# Baremetal
if [ "$VIRT_DRIVER" = "ironic" ] ; then |
fdfe7a01 |
iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
iniset $TEMPEST_CONFIG compute-feature-enabled console_output False
iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False
iniset $TEMPEST_CONFIG compute-feature-enabled live_migration False
iniset $TEMPEST_CONFIG compute-feature-enabled pause False
iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
iniset $TEMPEST_CONFIG compute-feature-enabled resize False
iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False |
cf21b710 |
iniset $TEMPEST_CONFIG compute-feature-enabled suspend False |
43bd667b |
fi
|
92575baa |
# Libvirt
if [ "$VIRT_DRIVER" = "libvirt" ]; then
# Libvirt-LXC
if [ "$LIBVIRT_TYPE" = "lxc" ]; then
iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
iniset $TEMPEST_CONFIG compute-feature-enabled resize False
iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
iniset $TEMPEST_CONFIG compute-feature-enabled suspend False |
e9a9fbef |
elif ! is_service_enabled n-cell; then
# cells v1 does not support swapping volumes
iniset $TEMPEST_CONFIG compute-feature-enabled swap_volume True |
92575baa |
fi |
7b47c473 |
fi
|
dc97cb71 |
# ``service_available`` |
346edcc5 |
#
# this tempest service list needs to be all the services that
# tempest supports, otherwise we can have an erroneous set of
# defaults (something defaulting true in Tempest, but not listed here). |
0f765358 |
local service
local tempest_services="key,glance,nova,neutron,cinder,swift,heat,ceilometer,horizon,sahara,ironic,trove"
for service in ${tempest_services//,/ }; do |
b56d81d5 |
if is_service_enabled $service ; then |
dc4dc7f0 |
iniset $TEMPEST_CONFIG service_available $service "True" |
b56d81d5 |
else |
dc4dc7f0 |
iniset $TEMPEST_CONFIG service_available $service "False" |
b56d81d5 |
fi
done
|
cf94edcb |
if [ "$VIRT_DRIVER" = "libvirt" ] && [ "$LIBVIRT_TYPE" = "lxc" ]; then
# libvirt-lxc does not support boot from volume or attaching volumes
# so basically anything with cinder is out of the question.
iniset $TEMPEST_CONFIG service_available cinder "False"
fi
|
e8f3f7aa |
# Run tempest configuration utilities. This must be done last during configuration to
# ensure as complete a config as possible already exists
# NOTE(mtreinish): Respect constraints on tempest verify-config venv
local tmp_cfg_file
tmp_cfg_file=$(mktemp)
cd $TEMPEST_DIR
if [[ "$OFFLINE" != "True" ]]; then |
440464cc |
tox -revenv-tempest --notest |
e8f3f7aa |
fi |
34c1679f |
# The requirements might be on a different branch, while tempest needs master requirements. |
6465219e |
(cd $REQUIREMENTS_DIR && git show origin/master:upper-constraints.txt) > u-c-m.txt |
34c1679f |
tox -evenv-tempest -- pip install -c u-c-m.txt -r requirements.txt |
e8f3f7aa |
# Auth: |
3cdff78f |
iniset $TEMPEST_CONFIG auth tempest_roles "member" |
e8f3f7aa |
if [[ $TEMPEST_USE_TEST_ACCOUNTS == "True" ]]; then
if [[ $TEMPEST_HAS_ADMIN == "True" ]]; then |
440464cc |
tox -evenv-tempest -- tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_project_name -r $TEMPEST_CONCURRENCY --with-admin etc/accounts.yaml |
e8f3f7aa |
else |
440464cc |
tox -evenv-tempest -- tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_project_name -r $TEMPEST_CONCURRENCY etc/accounts.yaml |
e8f3f7aa |
fi
iniset $TEMPEST_CONFIG auth use_dynamic_credentials False
iniset $TEMPEST_CONFIG auth test_accounts_file "etc/accounts.yaml"
elif [[ $TEMPEST_HAS_ADMIN == "False" ]]; then
iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-False}
else
iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
fi
# API Extensions
# Run ``verify_tempest_config -ur`` to retrieve enabled extensions on API endpoints
# NOTE(mtreinish): This must be done after auth settings are added to the tempest config
tox -evenv -- tempest verify-config -uro $tmp_cfg_file |
7b229359 |
|
e8f3f7aa |
# Neutron API Extensions |
894ccc90 |
# disable metering if we didn't enable the service
if ! is_service_enabled q-metering; then
DISABLE_NETWORK_API_EXTENSIONS+=", metering"
fi
|
787412ce |
# disable l3_agent_scheduler if we didn't enable L3 agent
if ! is_service_enabled q-l3; then
DISABLE_NETWORK_API_EXTENSIONS+=", l3_agent_scheduler"
fi
|
e8f3f7aa |
local network_api_extensions=${NETWORK_API_EXTENSIONS:-"all"}
if [[ ! -z "$DISABLE_NETWORK_API_EXTENSIONS" ]]; then
# Enabled extensions are either the ones explicitly specified or those available on the API endpoint
network_api_extensions=${NETWORK_API_EXTENSIONS:-$(iniget $tmp_cfg_file network-feature-enabled api_extensions | tr -d " ")}
# Remove disabled extensions
network_api_extensions=$(remove_disabled_extensions $network_api_extensions $DISABLE_NETWORK_API_EXTENSIONS)
fi
iniset $TEMPEST_CONFIG network-feature-enabled api_extensions $network_api_extensions
# Swift API Extensions
local object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
if [[ ! -z "$DISABLE_OBJECT_STORAGE_API_EXTENSIONS" ]]; then
# Enabled extensions are either the ones explicitly specified or those available on the API endpoint
object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-$(iniget $tmp_cfg_file object-storage-feature-enabled discoverable_apis | tr -d " ")}
# Remove disabled extensions
object_storage_api_extensions=$(remove_disabled_extensions $object_storage_api_extensions $DISABLE_STORAGE_API_EXTENSIONS)
fi
iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis $object_storage_api_extensions
# Cinder API Extensions
local volume_api_extensions=${VOLUME_API_EXTENSIONS:-"all"}
if [[ ! -z "$DISABLE_VOLUME_API_EXTENSIONS" ]]; then
# Enabled extensions are either the ones explicitly specified or those available on the API endpoint
volume_api_extensions=${VOLUME_API_EXTENSIONS:-$(iniget $tmp_cfg_file volume-feature-enabled api_extensions | tr -d " ")}
# Remove disabled extensions
volume_api_extensions=$(remove_disabled_extensions $volume_api_extensions $DISABLE_VOLUME_API_EXTENSIONS)
fi
iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions $volume_api_extensions
|
2aa35174 |
# Restore IFS
IFS=$ifs |
d093121f |
}
# install_tempest() - Collect source and prepare |
aee18c74 |
function install_tempest { |
d093121f |
git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH |
730faa26 |
pip_install 'tox!=2.8.0' |
83e166b7 |
pushd $TEMPEST_DIR |
583c5206 |
tox -r --notest -efull |
1e31e685 |
# NOTE(mtreinish) Respect constraints in the tempest full venv, things that
# are using a tox job other than full will not be respecting constraints but
# running pip install -U on tempest requirements |
440464cc |
$TEMPEST_DIR/.tox/tempest/bin/pip install -c $REQUIREMENTS_DIR/upper-constraints.txt -r requirements.txt
PROJECT_VENV["tempest"]=${TEMPEST_DIR}/.tox/tempest |
7e603d1b |
popd
}
# install_tempest_plugins() - Install any specified plugins into the tempest venv
function install_tempest_plugins {
pushd $TEMPEST_DIR |
440464cc |
if [[ $TEMPEST_PLUGINS != 0 ]] ; then |
dc5d88bc |
tox -evenv-tempest -- pip install -c $REQUIREMENTS_DIR/upper-constraints.txt $TEMPEST_PLUGINS |
b6558673 |
echo "Checking installed Tempest plugins:"
tox -evenv-tempest -- tempest list-plugins |
b31640af |
fi |
83e166b7 |
popd |
d093121f |
}
# Restore xtrace |
523f4880 |
$_XTRACE_TEMPEST |
584d90ec |
|
6a5aa7c6 |
# Tell emacs to use shell-script-mode
## Local variables:
## mode: shell-script
## End: |