blob: 6c8f3389ed01681c5d8c1acb93346507299eb505 [file] [log] [blame]
Sean Dagued0931212012-10-04 16:06:44 -04001# lib/tempest
Dean Troyer6d04fd72012-12-21 11:03:37 -06002# Install and configure Tempest
Sean Dagued0931212012-10-04 16:06:44 -04003
4# Dependencies:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +01005#
6# - ``functions`` file
7# - ``lib/nova`` service is running
8# - Global vars that are assumed to be defined:
9# - ``DEST``, ``FILES``
10# - ``ADMIN_PASSWORD``
11# - ``DEFAULT_IMAGE_NAME``
12# - ``S3_SERVICE_PORT``
13# - ``SERVICE_HOST``
14# - ``BASE_SQL_CONN`` ``lib/database`` declares
15# - ``PUBLIC_NETWORK_NAME``
16# - ``Q_USE_NAMESPACE``
17# - ``Q_ROUTER_NAME``
Tomoe Sugiharaafbc6312013-11-14 20:02:47 +000018# - ``Q_L3_ENABLED``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010019# - ``VIRT_DRIVER``
20# - ``LIBVIRT_TYPE``
21# - ``KEYSTONE_SERVICE_PROTOCOL``, ``KEYSTONE_SERVICE_HOST`` from lib/keystone
22#
Attila Fazekas2aa35172012-12-05 20:03:40 +010023# Optional Dependencies:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010024#
25# - ``ALT_*`` (similar vars exists in keystone_data.sh)
26# - ``LIVE_MIGRATION_AVAILABLE``
27# - ``USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION``
28# - ``DEFAULT_INSTANCE_TYPE``
29# - ``DEFAULT_INSTANCE_USER``
30# - ``CINDER_MULTI_LVM_BACKEND``
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +000031# - ``CINDER_ENABLED_BACKENDS``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010032#
Sean Dagued0931212012-10-04 16:06:44 -040033# ``stack.sh`` calls the entry points in this order:
34#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010035# - install_tempest
36# - configure_tempest
37# - init_tempest
Sean Dagued0931212012-10-04 16:06:44 -040038
39# Save trace setting
40XTRACE=$(set +o | grep xtrace)
41set +o xtrace
42
Dean Troyer6d04fd72012-12-21 11:03:37 -060043
Sean Dagued0931212012-10-04 16:06:44 -040044# Defaults
45# --------
46
Sean Dagued0931212012-10-04 16:06:44 -040047# Set up default directories
Sean Dague91b22902014-11-18 07:13:35 -050048GITDIR["tempest-lib"]=$DEST/tempest-lib
Sean Dague5cb19062014-11-01 01:37:45 +010049
Sean Dagued0931212012-10-04 16:06:44 -040050TEMPEST_DIR=$DEST/tempest
john-griffithdc4dc7f2014-01-22 18:09:32 -070051TEMPEST_CONFIG_DIR=${TEMPEST_CONFIG_DIR:-$TEMPEST_DIR/etc}
52TEMPEST_CONFIG=$TEMPEST_CONFIG_DIR/tempest.conf
Matthew Treinish14ccba02013-07-29 16:15:53 -040053TEMPEST_STATE_PATH=${TEMPEST_STATE_PATH:=$DATA_DIR/tempest}
Attila Fazekas2aa35172012-12-05 20:03:40 +010054
Dean Troyer6d04fd72012-12-21 11:03:37 -060055NOVA_SOURCE_DIR=$DEST/nova
56
Attila Fazekasbae02332013-05-09 09:24:49 +020057BUILD_INTERVAL=1
Arx Cruz1bde9b42014-07-18 11:34:33 -030058
59# This is the timeout that tempest will wait for a VM to change state,
60# spawn, delete, etc.
61# The default is set to 196 seconds.
62BUILD_TIMEOUT=${BUILD_TIMEOUT:-196}
Sean Dagued0931212012-10-04 16:06:44 -040063
Dean Troyer6d04fd72012-12-21 11:03:37 -060064
Attila Fazekas2d4c8da2014-03-19 10:42:01 +010065BOTO_MATERIALS_PATH="$FILES/images/s3-materials/cirros-${CIRROS_VERSION}"
Rob Crittenden90c20202014-11-17 01:16:22 -050066BOTO_CONF=$TEMPEST_DIR/boto.cfg
Attila Fazekas1d29d8b2013-01-07 15:51:32 +010067
john-griffithdc4dc7f2014-01-22 18:09:32 -070068# Cinder/Volume variables
69TEMPEST_VOLUME_DRIVER=${TEMPEST_VOLUME_DRIVER:-default}
Eric Harney01456482014-10-14 18:53:53 -040070TEMPEST_DEFAULT_VOLUME_VENDOR="Open Source"
71TEMPEST_VOLUME_VENDOR=${TEMPEST_VOLUME_VENDOR:-$TEMPEST_DEFAULT_VOLUME_VENDOR}
72TEMPEST_DEFAULT_STORAGE_PROTOCOL="iSCSI"
73TEMPEST_STORAGE_PROTOCOL=${TEMPEST_STORAGE_PROTOCOL:-$TEMPEST_DEFAULT_STORAGE_PROTOCOL}
Dean Troyercc6b4432013-04-08 15:38:03 -050074
armando-migliaccio71ef61a2014-02-19 22:19:24 -080075# Neutron/Network variables
76IPV6_ENABLED=$(trueorfalse True $IPV6_ENABLED)
sridhargaddamfe733ae2014-06-03 09:03:45 +053077IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True $IPV6_SUBNET_ATTRIBUTES_ENABLED)
armando-migliaccio71ef61a2014-02-19 22:19:24 -080078
Dean Troyercc6b4432013-04-08 15:38:03 -050079# Functions
80# ---------
Sean Dagued0931212012-10-04 16:06:44 -040081
Salvatore33e8ee22014-10-05 01:36:34 +020082# remove_disabled_extension - removes disabled extensions from the list of extensions
83# to test for a given service
84function remove_disabled_extensions {
85 local extensions_list=$1
86 shift
87 local disabled_exts=$*
88 for ext_to_remove in ${disabled_exts//,/ } ; do
89 extensions_list=${extensions_list/$ext_to_remove","}
90 done
91 echo $extensions_list
92}
93
Sean Dagued0931212012-10-04 16:06:44 -040094# configure_tempest() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +110095function configure_tempest {
Matthew Treinish95fb0d42013-01-28 16:24:14 -050096 setup_develop $TEMPEST_DIR
Attila Fazekas65c08462012-12-07 14:20:51 +010097 local image_lines
98 local images
99 local num_images
100 local image_uuid
101 local image_uuid_alt
Attila Fazekas65c08462012-12-07 14:20:51 +0100102 local password
103 local line
104 local flavors
Clark Boylan3b80bde2013-11-20 17:51:50 -0800105 local available_flavors
Attila Fazekas65c08462012-12-07 14:20:51 +0100106 local flavors_ref
107 local flavor_lines
Maru Newbya5c774e2012-12-10 10:40:01 +0000108 local public_network_id
Maru Newby31c94ab2012-12-19 03:59:20 +0000109 local public_router_id
Maru Newbya5c774e2012-12-10 10:40:01 +0000110 local tenant_networks_reachable
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100111 local boto_instance_type="m1.tiny"
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200112 local ssh_connect_method="fixed"
Attila Fazekas2aa35172012-12-05 20:03:40 +0100113
Dean Troyer6d04fd72012-12-21 11:03:37 -0600114 # Save IFS
Attila Fazekas2aa35172012-12-05 20:03:40 +0100115 ifs=$IFS
116
117 # Glance should already contain images to be used in tempest
118 # testing. Here we simply look for images stored in Glance
119 # and set the appropriate variables for use in the tempest config
120 # We ignore ramdisk and kernel images, look for the default image
Attila Fazekas65c08462012-12-07 14:20:51 +0100121 # ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the
122 # first image returned and set ``image_uuid_alt`` to the second,
Attila Fazekas2aa35172012-12-05 20:03:40 +0100123 # if there is more than one returned...
124 # ... Also ensure we only take active images, so we don't get snapshots in process
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500125 declare -a images
126
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200127 if is_service_enabled glance; then
128 while read -r IMAGE_NAME IMAGE_UUID; do
129 if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
130 image_uuid="$IMAGE_UUID"
131 image_uuid_alt="$IMAGE_UUID"
132 fi
133 images+=($IMAGE_UUID)
134 # TODO(stevemar): update this command to use openstackclient's `openstack image list`
135 # when it supports listing by status.
136 done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500137
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200138 case "${#images[*]}" in
139 0)
140 echo "Found no valid images to use!"
141 exit 1
142 ;;
143 1)
144 if [ -z "$image_uuid" ]; then
145 image_uuid=${images[0]}
146 image_uuid_alt=${images[0]}
147 fi
148 ;;
149 *)
150 if [ -z "$image_uuid" ]; then
151 image_uuid=${images[0]}
152 image_uuid_alt=${images[1]}
153 fi
154 ;;
155 esac
156 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100157
158 # Create tempest.conf from tempest.conf.sample
159 # copy every time, because the image UUIDS are going to change
Ian Wienand5f90fc02014-02-24 15:40:42 +1100160 if [[ ! -d $TEMPEST_CONFIG_DIR ]]; then
161 sudo mkdir -p $TEMPEST_CONFIG_DIR
162 fi
163 sudo chown $STACK_USER $TEMPEST_CONFIG_DIR
164 cp $TEMPEST_DIR/etc/tempest.conf.sample $TEMPEST_CONFIG
165 chmod 644 $TEMPEST_CONFIG
Attila Fazekas2aa35172012-12-05 20:03:40 +0100166
Attila Fazekas65c08462012-12-07 14:20:51 +0100167 password=${ADMIN_PASSWORD:-secrete}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100168
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000169 # See files/keystone_data.sh and stack.sh where admin, demo and alt_demo
170 # user and tenant are set up...
171 ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
172 ADMIN_TENANT_NAME=${ADMIN_TENANT_NAME:-admin}
Andrea Frittoli03523252014-04-08 13:43:56 +0100173 ADMIN_DOMAIN_NAME=${ADMIN_DOMAIN_NAME:-Default}
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000174 TEMPEST_USERNAME=${TEMPEST_USERNAME:-demo}
175 TEMPEST_TENANT_NAME=${TEMPEST_TENANT_NAME:-demo}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100176 ALT_USERNAME=${ALT_USERNAME:-alt_demo}
177 ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
Harshada Mangesh Kakad49126232014-05-23 09:16:52 +0000178 ADMIN_TENANT_ID=$(openstack project list | awk "/ admin / { print \$2 }")
Attila Fazekas2aa35172012-12-05 20:03:40 +0100179
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200180 if is_service_enabled nova; then
181 # If the ``DEFAULT_INSTANCE_TYPE`` not declared, use the new behavior
182 # Tempest creates instane types for himself
183 if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
184 available_flavors=$(nova flavor-list)
185 if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
186 if is_arch "ppc64"; then
187 # qemu needs at least 128MB of memory to boot on ppc64
188 nova flavor-create m1.nano 42 128 0 1
189 else
190 nova flavor-create m1.nano 42 64 0 1
191 fi
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200192 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200193 flavor_ref=42
194 boto_instance_type=m1.nano
195 if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
196 if is_arch "ppc64"; then
197 nova flavor-create m1.micro 84 256 0 1
198 else
199 nova flavor-create m1.micro 84 128 0 1
200 fi
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200201 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200202 flavor_ref_alt=84
203 else
204 # Check Nova for existing flavors and, if set, look for the
205 # ``DEFAULT_INSTANCE_TYPE`` and use that.
206 boto_instance_type=$DEFAULT_INSTANCE_TYPE
207 flavor_lines=`nova flavor-list`
208 IFS=$'\r\n'
209 flavors=""
210 for line in $flavor_lines; do
211 f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
212 flavors="$flavors $f"
213 done
Attila Fazekas2aa35172012-12-05 20:03:40 +0100214
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200215 for line in $flavor_lines; do
216 flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
217 done
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100218
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200219 IFS=" "
220 flavors=($flavors)
221 num_flavors=${#flavors[*]}
222 echo "Found $num_flavors flavors"
223 if [[ $num_flavors -eq 0 ]]; then
224 echo "Found no valid flavors to use!"
225 exit 1
Adalberto Medeiros63a71a22013-06-06 08:46:04 -0400226 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200227 flavor_ref=${flavors[0]}
228 flavor_ref_alt=$flavor_ref
229
230 # ensure flavor_ref and flavor_ref_alt have different values
231 # some resize instance in tempest tests depends on this.
232 for f in ${flavors[@]:1}; do
233 if [[ $f -ne $flavor_ref ]]; then
234 flavor_ref_alt=$f
235 break
236 fi
237 done
238 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100239 fi
240
Maru Newbya5c774e2012-12-10 10:40:01 +0000241 if [ "$Q_USE_NAMESPACE" != "False" ]; then
242 tenant_networks_reachable=false
Attila Fazekasf9e77392013-12-03 06:17:16 +0100243 if ! is_service_enabled n-net; then
244 ssh_connect_method="floating"
245 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000246 else
247 tenant_networks_reachable=true
248 fi
249
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200250 ssh_connect_method=${TEMPEST_SSH_CONNECT_METHOD:-$ssh_connect_method}
251
Tomoe Sugiharaafbc6312013-11-14 20:02:47 +0000252 if [ "$Q_L3_ENABLED" = "True" ]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400253 public_network_id=$(neutron net-list | grep $PUBLIC_NETWORK_NAME | \
Maru Newbya5c774e2012-12-10 10:40:01 +0000254 awk '{print $2}')
Maru Newby31c94ab2012-12-19 03:59:20 +0000255 if [ "$Q_USE_NAMESPACE" == "False" ]; then
256 # If namespaces are disabled, devstack will create a single
257 # public router that tempest should be configured to use.
Mark McClainb05c8762013-07-06 23:29:39 -0400258 public_router_id=$(neutron router-list | awk "/ $Q_ROUTER_NAME / \
Sean Dague101b4242013-10-22 08:47:11 -0400259 { print \$2 }")
Maru Newby31c94ab2012-12-19 03:59:20 +0000260 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000261 fi
262
Masayuki Igawa5a252d92014-11-21 21:55:09 +0900263 iniset $TEMPEST_CONFIG DEFAULT use_syslog $SYSLOG
Matthew Treinish859cc682013-07-26 15:22:44 -0400264 # Oslo
john-griffithdc4dc7f2014-01-22 18:09:32 -0700265 iniset $TEMPEST_CONFIG DEFAULT lock_path $TEMPEST_STATE_PATH
Matthew Treinish14ccba02013-07-29 16:15:53 -0400266 mkdir -p $TEMPEST_STATE_PATH
john-griffithdc4dc7f2014-01-22 18:09:32 -0700267 iniset $TEMPEST_CONFIG DEFAULT use_stderr False
268 iniset $TEMPEST_CONFIG DEFAULT log_file tempest.log
269 iniset $TEMPEST_CONFIG DEFAULT debug True
Matthew Treinish859cc682013-07-26 15:22:44 -0400270
Attila Fazekas2aa35172012-12-05 20:03:40 +0100271 # Timeouts
john-griffithdc4dc7f2014-01-22 18:09:32 -0700272 iniset $TEMPEST_CONFIG compute build_timeout $BUILD_TIMEOUT
273 iniset $TEMPEST_CONFIG volume build_timeout $BUILD_TIMEOUT
274 iniset $TEMPEST_CONFIG boto build_timeout $BUILD_TIMEOUT
john-griffithdc4dc7f2014-01-22 18:09:32 -0700275 iniset $TEMPEST_CONFIG boto http_socket_timeout 5
Attila Fazekas2aa35172012-12-05 20:03:40 +0100276
Attila Fazekas97d3d202013-01-19 19:20:49 +0100277 # Identity
john-griffithdc4dc7f2014-01-22 18:09:32 -0700278 iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v2.0/"
Matthew Treinish6c9430e2014-02-06 17:06:00 +0000279 iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v3/"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000280 iniset $TEMPEST_CONFIG identity username $TEMPEST_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700281 iniset $TEMPEST_CONFIG identity password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000282 iniset $TEMPEST_CONFIG identity tenant_name $TEMPEST_TENANT_NAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700283 iniset $TEMPEST_CONFIG identity alt_username $ALT_USERNAME
284 iniset $TEMPEST_CONFIG identity alt_password "$password"
285 iniset $TEMPEST_CONFIG identity alt_tenant_name $ALT_TENANT_NAME
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000286 iniset $TEMPEST_CONFIG identity admin_username $ADMIN_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700287 iniset $TEMPEST_CONFIG identity admin_password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000288 iniset $TEMPEST_CONFIG identity admin_tenant_name $ADMIN_TENANT_NAME
Harshada Mangesh Kakad49126232014-05-23 09:16:52 +0000289 iniset $TEMPEST_CONFIG identity admin_tenant_id $ADMIN_TENANT_ID
Andrea Frittoli03523252014-04-08 13:43:56 +0100290 iniset $TEMPEST_CONFIG identity admin_domain_name $ADMIN_DOMAIN_NAME
Andrea Frittoli07f1d0e2014-03-06 23:23:01 +0000291 iniset $TEMPEST_CONFIG identity auth_version ${TEMPEST_AUTH_VERSION:-v2}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100292
Sean Daguec3771452013-06-13 14:23:37 -0400293 # Image
294 # for the gate we want to be able to override this variable so we aren't
295 # doing an HTTP fetch over the wide internet for this test
296 if [[ ! -z "$TEMPEST_HTTP_IMAGE" ]]; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700297 iniset $TEMPEST_CONFIG image http_image $TEMPEST_HTTP_IMAGE
Sean Daguec3771452013-06-13 14:23:37 -0400298 fi
299
Attila Fazekas97d3d202013-01-19 19:20:49 +0100300 # Compute
john-griffithdc4dc7f2014-01-22 18:09:32 -0700301 iniset $TEMPEST_CONFIG compute allow_tenant_isolation ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
302 iniset $TEMPEST_CONFIG compute ssh_user ${DEFAULT_INSTANCE_USER:-cirros} # DEPRECATED
303 iniset $TEMPEST_CONFIG compute network_for_ssh $PRIVATE_NETWORK_NAME
304 iniset $TEMPEST_CONFIG compute ip_version_for_ssh 4
305 iniset $TEMPEST_CONFIG compute ssh_timeout $BUILD_TIMEOUT
306 iniset $TEMPEST_CONFIG compute image_ref $image_uuid
307 iniset $TEMPEST_CONFIG compute image_ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
308 iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid_alt
Kirill Shileev608f8842014-10-03 22:48:58 +0400309 iniset $TEMPEST_CONFIG compute image_alt_ssh_user ${ALT_INSTANCE_USER:-cirros}
john-griffithdc4dc7f2014-01-22 18:09:32 -0700310 iniset $TEMPEST_CONFIG compute flavor_ref $flavor_ref
311 iniset $TEMPEST_CONFIG compute flavor_ref_alt $flavor_ref_alt
john-griffithdc4dc7f2014-01-22 18:09:32 -0700312 iniset $TEMPEST_CONFIG compute ssh_connect_method $ssh_connect_method
Attila Fazekas97d3d202013-01-19 19:20:49 +0100313
Sean Daguede19bf92014-03-20 16:54:58 -0400314 # Compute Features
Salvatore33e8ee22014-10-05 01:36:34 +0200315 # Run verify_tempest_config -ur to retrieve enabled extensions on API endpoints
316 # NOTE(mtreinish): This must be done after auth settings are added to the tempest config
317 local tmp_cfg_file=$(mktemp)
318 $TEMPEST_DIR/tempest/cmd/verify_tempest_config.py -uro $tmp_cfg_file
319
320 local compute_api_extensions=${COMPUTE_API_EXTENSIONS:-"all"}
321 if [[ ! -z "$DISABLE_COMPUTE_API_EXTENSIONS" ]]; then
322 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
323 compute_api_extensions=${COMPUTE_API_EXTENSIONS:-$(iniget $tmp_cfg_file compute-feature-enabled api_extensions | tr -d " ")}
324 # Remove disabled extensions
325 compute_api_extensions=$(remove_disabled_extensions $compute_api_extensions $DISABLE_COMPUTE_API_EXTENSIONS)
326 fi
327
Sean Daguede19bf92014-03-20 16:54:58 -0400328 iniset $TEMPEST_CONFIG compute-feature-enabled resize True
Matthew Treinish270f93e2014-03-20 21:18:42 +0000329 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
330 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
331 iniset $TEMPEST_CONFIG compute-feature-enabled block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
Salvatore33e8ee22014-10-05 01:36:34 +0200332 iniset $TEMPEST_CONFIG compute-feature-enabled api_extensions $compute_api_extensions
Sean Daguede19bf92014-03-20 16:54:58 -0400333
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200334 # Compute admin
Sean Daguee530ba32014-03-07 05:58:18 -0500335 iniset $TEMPEST_CONFIG "compute-admin" username $ADMIN_USERNAME
336 iniset $TEMPEST_CONFIG "compute-admin" password "$password"
337 iniset $TEMPEST_CONFIG "compute-admin" tenant_name $ADMIN_TENANT_NAME
Attila Fazekas2aa35172012-12-05 20:03:40 +0100338
armando-migliaccio71ef61a2014-02-19 22:19:24 -0800339 # Network
john-griffithdc4dc7f2014-01-22 18:09:32 -0700340 iniset $TEMPEST_CONFIG network api_version 2.0
341 iniset $TEMPEST_CONFIG network tenant_networks_reachable "$tenant_networks_reachable"
342 iniset $TEMPEST_CONFIG network public_network_id "$public_network_id"
343 iniset $TEMPEST_CONFIG network public_router_id "$public_router_id"
344 iniset $TEMPEST_CONFIG network default_network "$FIXED_RANGE"
Matthew Treinishccf60f72014-03-03 22:48:31 -0500345 iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED"
Sean M. Collinsbb2908b2014-05-15 10:24:31 -0400346 iniset $TEMPEST_CONFIG network-feature-enabled ipv6_subnet_attributes "$IPV6_SUBNET_ATTRIBUTES_ENABLED"
Salvatore33e8ee22014-10-05 01:36:34 +0200347
348 local network_api_extensions=${NETWORK_API_EXTENSIONS:-"all"}
349 if [[ ! -z "$DISABLE_NETWORK_API_EXTENSIONS" ]]; then
350 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
351 network_api_extensions=${NETWORK_API_EXTENSIONS:-$(iniget $tmp_cfg_file network-feature-enabled api_extensions | tr -d " ")}
352 # Remove disabled extensions
353 network_api_extensions=$(remove_disabled_extensions $network_api_extensions $DISABLE_NETWORK_API_EXTENSIONS)
354 fi
355 iniset $TEMPEST_CONFIG network-feature-enabled api_extensions $network_api_extensions
Attila Fazekas2aa35172012-12-05 20:03:40 +0100356
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200357 # boto
Rob Crittenden18d47782014-03-19 17:47:42 -0400358 iniset $TEMPEST_CONFIG boto ec2_url "$EC2_SERVICE_PROTOCOL://$SERVICE_HOST:8773/services/Cloud"
john-griffithdc4dc7f2014-01-22 18:09:32 -0700359 iniset $TEMPEST_CONFIG boto s3_url "http://$SERVICE_HOST:${S3_SERVICE_PORT:-3333}"
360 iniset $TEMPEST_CONFIG boto s3_materials_path "$BOTO_MATERIALS_PATH"
Adalberto Medeiros53971532014-07-10 16:55:49 -0300361 iniset $TEMPEST_CONFIG boto ari_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initrd.manifest.xml
362 iniset $TEMPEST_CONFIG boto ami_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-blank.img.manifest.xml
363 iniset $TEMPEST_CONFIG boto aki_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-vmlinuz.manifest.xml
john-griffithdc4dc7f2014-01-22 18:09:32 -0700364 iniset $TEMPEST_CONFIG boto instance_type "$boto_instance_type"
365 iniset $TEMPEST_CONFIG boto http_socket_timeout 30
366 iniset $TEMPEST_CONFIG boto ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100367
Sean Dague669c4fc2014-04-03 11:28:01 -0400368 # Orchestration Tests
369 if is_service_enabled heat; then
370 if [[ ! -z "$HEAT_CFN_IMAGE_URL" ]]; then
371 iniset $TEMPEST_CONFIG orchestration image_ref $(basename "$HEAT_CFN_IMAGE_URL" ".qcow2")
372 fi
Attila Fazekas51557a52014-06-13 16:09:37 +0200373 # build a specialized heat flavor
Sean Dague669c4fc2014-04-03 11:28:01 -0400374 available_flavors=$(nova flavor-list)
375 if [[ ! ( $available_flavors =~ 'm1.heat' ) ]]; then
Attila Fazekas51557a52014-06-13 16:09:37 +0200376 nova flavor-create m1.heat 451 512 0 1
Sean Dague669c4fc2014-04-03 11:28:01 -0400377 fi
378 iniset $TEMPEST_CONFIG orchestration instance_type "m1.heat"
379 iniset $TEMPEST_CONFIG orchestration build_timeout 900
Steve Bakerd5cccad2013-07-19 10:34:24 +1200380 fi
381
William Marshall24d866e2013-07-02 12:26:31 -0500382 # Scenario
Adalberto Medeiros53971532014-07-10 16:55:49 -0300383 iniset $TEMPEST_CONFIG scenario img_dir "$FILES/images/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec"
384 iniset $TEMPEST_CONFIG scenario ami_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-blank.img"
385 iniset $TEMPEST_CONFIG scenario ari_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initrd"
386 iniset $TEMPEST_CONFIG scenario aki_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-vmlinuz"
William Marshall24d866e2013-07-02 12:26:31 -0500387
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400388 # Large Ops Number
john-griffithdc4dc7f2014-01-22 18:09:32 -0700389 iniset $TEMPEST_CONFIG scenario large_ops_number ${TEMPEST_LARGE_OPS_NUMBER:-0}
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400390
Vadim Rovachev2541d612014-05-29 18:48:10 +0400391 # Telemetry
392 # Ceilometer API optimization happened in juno that allows to run more tests in tempest.
393 # Once Tempest retires support for icehouse this flag can be removed.
394 iniset $TEMPEST_CONFIG telemetry too_slow_to_test "False"
395
Salvatore Orlando3046bc62014-08-21 12:11:10 -0700396 # Object storage
Salvatore33e8ee22014-10-05 01:36:34 +0200397 local object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
398 if [[ ! -z "$DISABLE_OBJECT_STORAGE_API_EXTENSIONS" ]]; then
399 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
400 object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-$(iniget $tmp_cfg_file object-storage-feature-enabled discoverable_apis | tr -d " ")}
401 # Remove disabled extensions
402 object_storage_api_extensions=$(remove_disabled_extensions $object_storage_api_extensions $DISABLE_STORAGE_API_EXTENSIONS)
403 fi
404 iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis $object_storage_api_extensions
Salvatore Orlando3046bc62014-08-21 12:11:10 -0700405
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200406 # Volume
Salvatore33e8ee22014-10-05 01:36:34 +0200407 local volume_api_extensions=${VOLUME_API_EXTENSIONS:-"all"}
408 if [[ ! -z "$DISABLE_VOLUME_API_EXTENSIONS" ]]; then
409 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
410 volume_api_extensions=${VOLUME_API_EXTENSIONS:-$(iniget $tmp_cfg_file volume-feature-enabled api_extensions | tr -d " ")}
411 # Remove disabled extensions
412 volume_api_extensions=$(remove_disabled_extensions $volume_api_extensions $DISABLE_VOLUME_API_EXTENSIONS)
413 fi
414 iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions $volume_api_extensions
415
Giulio Fidente3d60f4d2014-02-20 16:43:49 +0100416 if ! is_service_enabled c-bak; then
417 iniset $TEMPEST_CONFIG volume-feature-enabled backup False
Giulio Fidente3632ab12013-09-10 02:51:26 +0200418 fi
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000419
420 # Using CINDER_ENABLED_BACKENDS
421 if [[ -n "$CINDER_ENABLED_BACKENDS" ]] && [[ $CINDER_ENABLED_BACKENDS =~ .*,.* ]]; then
Matthew Treinishdb1c3842014-02-04 20:58:00 +0000422 iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000423 local i=1
424 local be
425 for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
426 local be_name=${be##*:}
427 iniset $TEMPEST_CONFIG volume "backend${i}_name" "$be_name"
428 i=$(( i + 1 ))
429 done
john-griffithdc4dc7f2014-01-22 18:09:32 -0700430 fi
431
Eric Harney01456482014-10-14 18:53:53 -0400432 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
Patrick East1c0628f2014-10-22 16:22:47 -0700433 "$TEMPEST_VOLUME_VENDOR" != "$TEMPEST_DEFAULT_VOLUME_VENDOR" ]; then
Ed Balduf2f23d752014-07-29 14:42:27 -0600434 iniset $TEMPEST_CONFIG volume vendor_name "$TEMPEST_VOLUME_VENDOR"
Eric Harney01456482014-10-14 18:53:53 -0400435 fi
436 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
JordanP82a7d932014-12-04 14:09:16 +0100437 "$TEMPEST_STORAGE_PROTOCOL" != "$TEMPEST_DEFAULT_STORAGE_PROTOCOL" ]; then
438 iniset $TEMPEST_CONFIG volume storage_protocol "$TEMPEST_STORAGE_PROTOCOL"
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200439 fi
440
Julie Pichonfea70f82013-07-29 11:22:08 +0100441 # Dashboard
john-griffithdc4dc7f2014-01-22 18:09:32 -0700442 iniset $TEMPEST_CONFIG dashboard dashboard_url "http://$SERVICE_HOST/"
443 iniset $TEMPEST_CONFIG dashboard login_url "http://$SERVICE_HOST/auth/login/"
Julie Pichonfea70f82013-07-29 11:22:08 +0100444
Ian Wienand7fa19022013-06-25 14:11:48 +1000445 # cli
john-griffithdc4dc7f2014-01-22 18:09:32 -0700446 iniset $TEMPEST_CONFIG cli cli_dir $NOVA_BIN_DIR
Ian Wienand7fa19022013-06-25 14:11:48 +1000447
Adam Gandelman43bd6672014-04-03 11:13:13 -0700448 # Baremetal
449 if [ "$VIRT_DRIVER" = "ironic" ] ; then
450 iniset $TEMPEST_CONFIG baremetal driver_enabled True
Adam Gandelmanfdfe7a02014-07-24 10:06:18 -0400451 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
452 iniset $TEMPEST_CONFIG compute-feature-enabled console_output False
453 iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False
454 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration False
455 iniset $TEMPEST_CONFIG compute-feature-enabled pause False
456 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
457 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
458 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
459 iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
David Shrewsburycf21b712014-08-13 07:03:58 -0400460 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
Adam Gandelman43bd6672014-04-03 11:13:13 -0700461 fi
462
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400463 # service_available
Dean Troyer4237f592014-01-29 16:22:11 -0600464 for service in ${TEMPEST_SERVICES//,/ }; do
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400465 if is_service_enabled $service ; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700466 iniset $TEMPEST_CONFIG service_available $service "True"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400467 else
john-griffithdc4dc7f2014-01-22 18:09:32 -0700468 iniset $TEMPEST_CONFIG service_available $service "False"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400469 fi
470 done
471
Rob Crittenden90c20202014-11-17 01:16:22 -0500472 if is_ssl_enabled_service "keystone" || is_service_enabled tls-proxy; then
473 # Use the BOTO_CONFIG environment variable to point to this file
474 iniset $BOTO_CONF Boto ca_certificates_file $SSL_BUNDLE_FILE
475 sudo chown $STACK_USER $BOTO_CONF
476 fi
477
Attila Fazekas2aa35172012-12-05 20:03:40 +0100478 # Restore IFS
479 IFS=$ifs
Sean Dagued0931212012-10-04 16:06:44 -0400480}
481
Dean Troyer42a59c22014-03-03 14:31:29 -0600482# create_tempest_accounts() - Set up common required tempest accounts
483
484# Project User Roles
485# ------------------------------------------------------------------
486# alt_demo alt_demo Member
487
488# Migrated from keystone_data.sh
489function create_tempest_accounts {
490 if is_service_enabled tempest; then
491 # Tempest has some tests that validate various authorization checks
492 # between two regular users in separate tenants
Bartosz Górski0abde392014-02-28 14:15:19 +0100493 get_or_create_project alt_demo
494 get_or_create_user alt_demo "$ADMIN_PASSWORD" alt_demo "alt_demo@example.com"
495 get_or_add_user_role Member alt_demo alt_demo
Dean Troyer42a59c22014-03-03 14:31:29 -0600496 fi
497}
498
Matthew Treinish34723862014-09-08 14:01:21 -0400499# install_tempest_lib() - Collect source, prepare, and install tempest-lib
500function install_tempest_lib {
Sean Dague91b22902014-11-18 07:13:35 -0500501 if use_library_from_git "tempest-lib"; then
502 git_clone_by_name "tempest-lib"
Sean Dague86b65dd2014-11-20 17:23:04 -0500503 setup_dev_lib "tempest-lib"
Sean Dague5cb19062014-11-01 01:37:45 +0100504 fi
Matthew Treinish34723862014-09-08 14:01:21 -0400505}
506
Sean Dagued0931212012-10-04 16:06:44 -0400507# install_tempest() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100508function install_tempest {
Matthew Treinish34723862014-09-08 14:01:21 -0400509 install_tempest_lib
Sean Dagued0931212012-10-04 16:06:44 -0400510 git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
Clark Boylan33dc8692014-08-19 22:37:10 -0700511 pip_install tox
Sean Dagued0931212012-10-04 16:06:44 -0400512}
513
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100514# init_tempest() - Initialize ec2 images
Ian Wienandaee18c72014-02-21 15:35:08 +1100515function init_tempest {
Adalberto Medeiros53971532014-07-10 16:55:49 -0300516 local base_image_name=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}
517 # /opt/stack/devstack/files/images/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec
Attila Fazekas3c529222013-01-21 06:50:33 +0100518 local image_dir="$FILES/images/${base_image_name}-uec"
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100519 local kernel="$image_dir/${base_image_name}-vmlinuz"
520 local ramdisk="$image_dir/${base_image_name}-initrd"
521 local disk_image="$image_dir/${base_image_name}-blank.img"
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200522 if is_service_enabled nova; then
523 # if the cirros uec downloaded and the system is uec capable
524 if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a "$VIRT_DRIVER" != "openvz" \
525 -a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then
526 echo "Prepare aki/ari/ami Images"
527 mkdir -p $BOTO_MATERIALS_PATH
528 ( #new namespace
529 # tenant:demo ; user: demo
530 source $TOP_DIR/accrc/demo/demo
531 euca-bundle-image -r ${CIRROS_ARCH} -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH"
532 euca-bundle-image -r ${CIRROS_ARCH} -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH"
533 euca-bundle-image -r ${CIRROS_ARCH} -i "$disk_image" -d "$BOTO_MATERIALS_PATH"
534 ) 2>&1 </dev/null | cat
535 else
536 echo "Boto materials are not prepared"
537 fi
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100538 fi
539}
540
Sean Dagued0931212012-10-04 16:06:44 -0400541# Restore xtrace
542$XTRACE
Sean Dague584d90e2013-03-29 14:34:53 -0400543
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100544# Tell emacs to use shell-script-mode
545## Local variables:
546## mode: shell-script
547## End: