blob: 0b5f33267263abf69ef508ec8722004a9f157647 [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``
31# - ``HEAT_CREATE_TEST_IMAGE``
32#
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
48TEMPEST_DIR=$DEST/tempest
john-griffithdc4dc7f2014-01-22 18:09:32 -070049TEMPEST_CONFIG_DIR=${TEMPEST_CONFIG_DIR:-$TEMPEST_DIR/etc}
50TEMPEST_CONFIG=$TEMPEST_CONFIG_DIR/tempest.conf
Matthew Treinish14ccba02013-07-29 16:15:53 -040051TEMPEST_STATE_PATH=${TEMPEST_STATE_PATH:=$DATA_DIR/tempest}
Attila Fazekas2aa35172012-12-05 20:03:40 +010052
Dean Troyer6d04fd72012-12-21 11:03:37 -060053NOVA_SOURCE_DIR=$DEST/nova
54
Attila Fazekasbae02332013-05-09 09:24:49 +020055BUILD_INTERVAL=1
Attila Fazekas8111ef02013-10-18 16:21:26 +020056BUILD_TIMEOUT=196
Sean Dagued0931212012-10-04 16:06:44 -040057
Dean Troyer6d04fd72012-12-21 11:03:37 -060058
Scott Mosercde655a2013-02-20 12:33:39 -050059BOTO_MATERIALS_PATH="$FILES/images/s3-materials/cirros-0.3.1"
Attila Fazekas1d29d8b2013-01-07 15:51:32 +010060
john-griffithdc4dc7f2014-01-22 18:09:32 -070061# Cinder/Volume variables
62TEMPEST_VOLUME_DRIVER=${TEMPEST_VOLUME_DRIVER:-default}
63TEMPEST_VOLUME_VENDOR=${TEMPEST_VOLUME_VENDOR:-"Open Source"}
64TEMPEST_STORAGE_PROTOCOL=${TEMPEST_STORAGE_PROTOCOL:-iSCSI}
Dean Troyercc6b4432013-04-08 15:38:03 -050065
armando-migliaccio71ef61a2014-02-19 22:19:24 -080066# Neutron/Network variables
67IPV6_ENABLED=$(trueorfalse True $IPV6_ENABLED)
68
Dean Troyercc6b4432013-04-08 15:38:03 -050069# Functions
70# ---------
Sean Dagued0931212012-10-04 16:06:44 -040071
Sean Dagued0931212012-10-04 16:06:44 -040072# configure_tempest() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +110073function configure_tempest {
Matthew Treinish95fb0d42013-01-28 16:24:14 -050074 setup_develop $TEMPEST_DIR
Attila Fazekas65c08462012-12-07 14:20:51 +010075 local image_lines
76 local images
77 local num_images
78 local image_uuid
79 local image_uuid_alt
Attila Fazekas2aa35172012-12-05 20:03:40 +010080 local errexit
Attila Fazekas65c08462012-12-07 14:20:51 +010081 local password
82 local line
83 local flavors
Clark Boylan3b80bde2013-11-20 17:51:50 -080084 local available_flavors
Attila Fazekas65c08462012-12-07 14:20:51 +010085 local flavors_ref
86 local flavor_lines
Maru Newbya5c774e2012-12-10 10:40:01 +000087 local public_network_id
Maru Newby31c94ab2012-12-19 03:59:20 +000088 local public_router_id
Maru Newbya5c774e2012-12-10 10:40:01 +000089 local tenant_networks_reachable
Attila Fazekas1d29d8b2013-01-07 15:51:32 +010090 local boto_instance_type="m1.tiny"
Attila Fazekas386ae8c2013-10-21 09:27:18 +020091 local ssh_connect_method="fixed"
Attila Fazekas2aa35172012-12-05 20:03:40 +010092
Dean Troyer6d04fd72012-12-21 11:03:37 -060093 # TODO(afazekas):
Sean Dagued0931212012-10-04 16:06:44 -040094 # sudo python setup.py deploy
Attila Fazekas2aa35172012-12-05 20:03:40 +010095
96 # This function exits on an error so that errors don't compound and you see
Joe Gordon46400262013-06-30 04:32:27 -070097 # only the first error that occurred.
Attila Fazekas2aa35172012-12-05 20:03:40 +010098 errexit=$(set +o | grep errexit)
99 set -o errexit
100
Dean Troyer6d04fd72012-12-21 11:03:37 -0600101 # Save IFS
Attila Fazekas2aa35172012-12-05 20:03:40 +0100102 ifs=$IFS
103
104 # Glance should already contain images to be used in tempest
105 # testing. Here we simply look for images stored in Glance
106 # and set the appropriate variables for use in the tempest config
107 # We ignore ramdisk and kernel images, look for the default image
Attila Fazekas65c08462012-12-07 14:20:51 +0100108 # ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the
109 # first image returned and set ``image_uuid_alt`` to the second,
Attila Fazekas2aa35172012-12-05 20:03:40 +0100110 # if there is more than one returned...
111 # ... Also ensure we only take active images, so we don't get snapshots in process
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500112 declare -a images
113
114 while read -r IMAGE_NAME IMAGE_UUID; do
115 if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
116 image_uuid="$IMAGE_UUID"
117 image_uuid_alt="$IMAGE_UUID"
Attila Fazekas2aa35172012-12-05 20:03:40 +0100118 fi
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500119 images+=($IMAGE_UUID)
120 done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
121
122 case "${#images[*]}" in
123 0)
124 echo "Found no valid images to use!"
125 exit 1
126 ;;
127 1)
128 if [ -z "$image_uuid" ]; then
129 image_uuid=${images[0]}
130 image_uuid_alt=${images[0]}
131 fi
132 ;;
133 *)
134 if [ -z "$image_uuid" ]; then
135 image_uuid=${images[0]}
136 image_uuid_alt=${images[1]}
137 fi
138 ;;
139 esac
Attila Fazekas2aa35172012-12-05 20:03:40 +0100140
141 # Create tempest.conf from tempest.conf.sample
142 # copy every time, because the image UUIDS are going to change
Ian Wienand5f90fc02014-02-24 15:40:42 +1100143 if [[ ! -d $TEMPEST_CONFIG_DIR ]]; then
144 sudo mkdir -p $TEMPEST_CONFIG_DIR
145 fi
146 sudo chown $STACK_USER $TEMPEST_CONFIG_DIR
147 cp $TEMPEST_DIR/etc/tempest.conf.sample $TEMPEST_CONFIG
148 chmod 644 $TEMPEST_CONFIG
Attila Fazekas2aa35172012-12-05 20:03:40 +0100149
Attila Fazekas65c08462012-12-07 14:20:51 +0100150 password=${ADMIN_PASSWORD:-secrete}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100151
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000152 # See files/keystone_data.sh and stack.sh where admin, demo and alt_demo
153 # user and tenant are set up...
154 ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
155 ADMIN_TENANT_NAME=${ADMIN_TENANT_NAME:-admin}
156 TEMPEST_USERNAME=${TEMPEST_USERNAME:-demo}
157 TEMPEST_TENANT_NAME=${TEMPEST_TENANT_NAME:-demo}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100158 ALT_USERNAME=${ALT_USERNAME:-alt_demo}
159 ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
160
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100161 # If the ``DEFAULT_INSTANCE_TYPE`` not declared, use the new behavior
162 # Tempest creates instane types for himself
163 if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
Clark Boylan3b80bde2013-11-20 17:51:50 -0800164 available_flavors=$(nova flavor-list)
165 if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200166 if is_arch "ppc64"; then
167 # qemu needs at least 128MB of memory to boot on ppc64
168 nova flavor-create m1.nano 42 128 0 1
169 else
170 nova flavor-create m1.nano 42 64 0 1
171 fi
Clark Boylan3b80bde2013-11-20 17:51:50 -0800172 fi
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100173 flavor_ref=42
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100174 boto_instance_type=m1.nano
Clark Boylan3b80bde2013-11-20 17:51:50 -0800175 if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200176 if is_arch "ppc64"; then
177 nova flavor-create m1.micro 84 256 0 1
178 else
179 nova flavor-create m1.micro 84 128 0 1
180 fi
Clark Boylan3b80bde2013-11-20 17:51:50 -0800181 fi
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100182 flavor_ref_alt=84
183 else
184 # Check Nova for existing flavors and, if set, look for the
185 # ``DEFAULT_INSTANCE_TYPE`` and use that.
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100186 boto_instance_type=$DEFAULT_INSTANCE_TYPE
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100187 flavor_lines=`nova flavor-list`
188 IFS=$'\r\n'
189 flavors=""
Dean Troyerceaa38b2012-12-12 17:09:57 -0600190 for line in $flavor_lines; do
191 f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
192 flavors="$flavors $f"
193 done
Attila Fazekas2aa35172012-12-05 20:03:40 +0100194
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100195 for line in $flavor_lines; do
196 flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
197 done
198
199 IFS=" "
200 flavors=($flavors)
201 num_flavors=${#flavors[*]}
202 echo "Found $num_flavors flavors"
203 if [[ $num_flavors -eq 0 ]]; then
204 echo "Found no valid flavors to use!"
205 exit 1
206 fi
207 flavor_ref=${flavors[0]}
208 flavor_ref_alt=$flavor_ref
Adalberto Medeiros63a71a22013-06-06 08:46:04 -0400209
210 # ensure flavor_ref and flavor_ref_alt have different values
211 # some resize instance in tempest tests depends on this.
212 for f in ${flavors[@]:1}; do
213 if [[ $f -ne $flavor_ref ]]; then
214 flavor_ref_alt=$f
215 break
216 fi
217 done
Attila Fazekas2aa35172012-12-05 20:03:40 +0100218 fi
219
Maru Newbya5c774e2012-12-10 10:40:01 +0000220 if [ "$Q_USE_NAMESPACE" != "False" ]; then
221 tenant_networks_reachable=false
Attila Fazekasf9e77392013-12-03 06:17:16 +0100222 if ! is_service_enabled n-net; then
223 ssh_connect_method="floating"
224 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000225 else
226 tenant_networks_reachable=true
227 fi
228
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200229 ssh_connect_method=${TEMPEST_SSH_CONNECT_METHOD:-$ssh_connect_method}
230
Tomoe Sugiharaafbc6312013-11-14 20:02:47 +0000231 if [ "$Q_L3_ENABLED" = "True" ]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400232 public_network_id=$(neutron net-list | grep $PUBLIC_NETWORK_NAME | \
Maru Newbya5c774e2012-12-10 10:40:01 +0000233 awk '{print $2}')
Maru Newby31c94ab2012-12-19 03:59:20 +0000234 if [ "$Q_USE_NAMESPACE" == "False" ]; then
235 # If namespaces are disabled, devstack will create a single
236 # public router that tempest should be configured to use.
Mark McClainb05c8762013-07-06 23:29:39 -0400237 public_router_id=$(neutron router-list | awk "/ $Q_ROUTER_NAME / \
Sean Dague101b4242013-10-22 08:47:11 -0400238 { print \$2 }")
Maru Newby31c94ab2012-12-19 03:59:20 +0000239 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000240 fi
241
Matthew Treinish859cc682013-07-26 15:22:44 -0400242 # Oslo
john-griffithdc4dc7f2014-01-22 18:09:32 -0700243 iniset $TEMPEST_CONFIG DEFAULT lock_path $TEMPEST_STATE_PATH
Matthew Treinish14ccba02013-07-29 16:15:53 -0400244 mkdir -p $TEMPEST_STATE_PATH
john-griffithdc4dc7f2014-01-22 18:09:32 -0700245 iniset $TEMPEST_CONFIG DEFAULT use_stderr False
246 iniset $TEMPEST_CONFIG DEFAULT log_file tempest.log
247 iniset $TEMPEST_CONFIG DEFAULT debug True
Matthew Treinish859cc682013-07-26 15:22:44 -0400248
Attila Fazekas2aa35172012-12-05 20:03:40 +0100249 # Timeouts
john-griffithdc4dc7f2014-01-22 18:09:32 -0700250 iniset $TEMPEST_CONFIG compute build_timeout $BUILD_TIMEOUT
251 iniset $TEMPEST_CONFIG volume build_timeout $BUILD_TIMEOUT
252 iniset $TEMPEST_CONFIG boto build_timeout $BUILD_TIMEOUT
253 iniset $TEMPEST_CONFIG compute build_interval $BUILD_INTERVAL
254 iniset $TEMPEST_CONFIG volume build_interval $BUILD_INTERVAL
255 iniset $TEMPEST_CONFIG boto build_interval $BUILD_INTERVAL
256 iniset $TEMPEST_CONFIG boto http_socket_timeout 5
Attila Fazekas2aa35172012-12-05 20:03:40 +0100257
Attila Fazekas97d3d202013-01-19 19:20:49 +0100258 # Identity
john-griffithdc4dc7f2014-01-22 18:09:32 -0700259 iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v2.0/"
Matthew Treinish6c9430e2014-02-06 17:06:00 +0000260 iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v3/"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000261 iniset $TEMPEST_CONFIG identity username $TEMPEST_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700262 iniset $TEMPEST_CONFIG identity password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000263 iniset $TEMPEST_CONFIG identity tenant_name $TEMPEST_TENANT_NAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700264 iniset $TEMPEST_CONFIG identity alt_username $ALT_USERNAME
265 iniset $TEMPEST_CONFIG identity alt_password "$password"
266 iniset $TEMPEST_CONFIG identity alt_tenant_name $ALT_TENANT_NAME
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000267 iniset $TEMPEST_CONFIG identity admin_username $ADMIN_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700268 iniset $TEMPEST_CONFIG identity admin_password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000269 iniset $TEMPEST_CONFIG identity admin_tenant_name $ADMIN_TENANT_NAME
Andrea Frittoli07f1d0e2014-03-06 23:23:01 +0000270 iniset $TEMPEST_CONFIG identity auth_version ${TEMPEST_AUTH_VERSION:-v2}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100271
Sean Daguec3771452013-06-13 14:23:37 -0400272 # Image
273 # for the gate we want to be able to override this variable so we aren't
274 # doing an HTTP fetch over the wide internet for this test
275 if [[ ! -z "$TEMPEST_HTTP_IMAGE" ]]; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700276 iniset $TEMPEST_CONFIG image http_image $TEMPEST_HTTP_IMAGE
Sean Daguec3771452013-06-13 14:23:37 -0400277 fi
278
Attila Fazekas97d3d202013-01-19 19:20:49 +0100279 # Compute
john-griffithdc4dc7f2014-01-22 18:09:32 -0700280 iniset $TEMPEST_CONFIG compute allow_tenant_isolation ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
281 iniset $TEMPEST_CONFIG compute ssh_user ${DEFAULT_INSTANCE_USER:-cirros} # DEPRECATED
282 iniset $TEMPEST_CONFIG compute network_for_ssh $PRIVATE_NETWORK_NAME
283 iniset $TEMPEST_CONFIG compute ip_version_for_ssh 4
284 iniset $TEMPEST_CONFIG compute ssh_timeout $BUILD_TIMEOUT
285 iniset $TEMPEST_CONFIG compute image_ref $image_uuid
286 iniset $TEMPEST_CONFIG compute image_ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
287 iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid_alt
288 iniset $TEMPEST_CONFIG compute image_alt_ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
289 iniset $TEMPEST_CONFIG compute flavor_ref $flavor_ref
290 iniset $TEMPEST_CONFIG compute flavor_ref_alt $flavor_ref_alt
john-griffithdc4dc7f2014-01-22 18:09:32 -0700291 iniset $TEMPEST_CONFIG compute ssh_connect_method $ssh_connect_method
Attila Fazekas97d3d202013-01-19 19:20:49 +0100292
Sean Daguede19bf92014-03-20 16:54:58 -0400293 # Compute Features
294 iniset $TEMPEST_CONFIG compute-feature-enabled resize True
Matthew Treinish270f93e2014-03-20 21:18:42 +0000295 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
296 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
297 iniset $TEMPEST_CONFIG compute-feature-enabled block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
Sean Daguede19bf92014-03-20 16:54:58 -0400298
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200299 # Compute admin
Sean Daguee530ba32014-03-07 05:58:18 -0500300 iniset $TEMPEST_CONFIG "compute-admin" username $ADMIN_USERNAME
301 iniset $TEMPEST_CONFIG "compute-admin" password "$password"
302 iniset $TEMPEST_CONFIG "compute-admin" tenant_name $ADMIN_TENANT_NAME
Attila Fazekas2aa35172012-12-05 20:03:40 +0100303
armando-migliaccio71ef61a2014-02-19 22:19:24 -0800304 # Network
john-griffithdc4dc7f2014-01-22 18:09:32 -0700305 iniset $TEMPEST_CONFIG network api_version 2.0
306 iniset $TEMPEST_CONFIG network tenant_networks_reachable "$tenant_networks_reachable"
307 iniset $TEMPEST_CONFIG network public_network_id "$public_network_id"
308 iniset $TEMPEST_CONFIG network public_router_id "$public_router_id"
309 iniset $TEMPEST_CONFIG network default_network "$FIXED_RANGE"
Matthew Treinishccf60f72014-03-03 22:48:31 -0500310 iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED"
Attila Fazekas2aa35172012-12-05 20:03:40 +0100311
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200312 # boto
john-griffithdc4dc7f2014-01-22 18:09:32 -0700313 iniset $TEMPEST_CONFIG boto ec2_url "http://$SERVICE_HOST:8773/services/Cloud"
314 iniset $TEMPEST_CONFIG boto s3_url "http://$SERVICE_HOST:${S3_SERVICE_PORT:-3333}"
315 iniset $TEMPEST_CONFIG boto s3_materials_path "$BOTO_MATERIALS_PATH"
Attila Fazekas7eb99342014-02-06 10:33:40 +0100316 iniset $TEMPEST_CONFIG boto ari_manifest cirros-0.3.1-x86_64-initrd.manifest.xml
317 iniset $TEMPEST_CONFIG boto ami_manifest cirros-0.3.1-x86_64-blank.img.manifest.xml
318 iniset $TEMPEST_CONFIG boto aki_manifest cirros-0.3.1-x86_64-vmlinuz.manifest.xml
john-griffithdc4dc7f2014-01-22 18:09:32 -0700319 iniset $TEMPEST_CONFIG boto instance_type "$boto_instance_type"
320 iniset $TEMPEST_CONFIG boto http_socket_timeout 30
321 iniset $TEMPEST_CONFIG boto ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100322
Steve Bakerd5cccad2013-07-19 10:34:24 +1200323 # Orchestration test image
Sean Daguead13ba22014-04-03 10:43:33 -0400324 if [[ ! -z "$HEAT_CFN_IMAGE_URL" ]]; then
325 iniset $TEMPEST_CONFIG orchestration image_ref $(basename "$HEAT_CFN_IMAGE_URL" ".qcow2")
Steve Bakerd5cccad2013-07-19 10:34:24 +1200326 fi
327
William Marshall24d866e2013-07-02 12:26:31 -0500328 # Scenario
john-griffithdc4dc7f2014-01-22 18:09:32 -0700329 iniset $TEMPEST_CONFIG scenario img_dir "$FILES/images/cirros-0.3.1-x86_64-uec"
William Marshall24d866e2013-07-02 12:26:31 -0500330
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400331 # Large Ops Number
john-griffithdc4dc7f2014-01-22 18:09:32 -0700332 iniset $TEMPEST_CONFIG scenario large_ops_number ${TEMPEST_LARGE_OPS_NUMBER:-0}
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400333
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200334 # Volume
Giulio Fidente3d60f4d2014-02-20 16:43:49 +0100335 if ! is_service_enabled c-bak; then
336 iniset $TEMPEST_CONFIG volume-feature-enabled backup False
Giulio Fidente3632ab12013-09-10 02:51:26 +0200337 fi
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200338 CINDER_MULTI_LVM_BACKEND=$(trueorfalse False $CINDER_MULTI_LVM_BACKEND)
Ian Wienandc42ed252013-06-17 13:23:44 +1000339 if [ $CINDER_MULTI_LVM_BACKEND == "True" ]; then
Matthew Treinishdb1c3842014-02-04 20:58:00 +0000340 iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
john-griffithdc4dc7f2014-01-22 18:09:32 -0700341 iniset $TEMPEST_CONFIG volume backend1_name "LVM_iSCSI"
342 iniset $TEMPEST_CONFIG volume backend2_name "LVM_iSCSI_2"
343 fi
344
345 if [ $TEMPEST_VOLUME_DRIVER != "default" ]; then
346 iniset $TEMPEST_CONFIG volume vendor_name $TEMPEST_VOLUME_VENDOR
347 iniset $TEMPEST_CONFIG volume storage_protocol $TEMPEST_STORAGE_PROTOCOL
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200348 fi
349
Julie Pichonfea70f82013-07-29 11:22:08 +0100350 # Dashboard
john-griffithdc4dc7f2014-01-22 18:09:32 -0700351 iniset $TEMPEST_CONFIG dashboard dashboard_url "http://$SERVICE_HOST/"
352 iniset $TEMPEST_CONFIG dashboard login_url "http://$SERVICE_HOST/auth/login/"
Julie Pichonfea70f82013-07-29 11:22:08 +0100353
Ian Wienand7fa19022013-06-25 14:11:48 +1000354 # cli
john-griffithdc4dc7f2014-01-22 18:09:32 -0700355 iniset $TEMPEST_CONFIG cli cli_dir $NOVA_BIN_DIR
Ian Wienand7fa19022013-06-25 14:11:48 +1000356
armando-migliaccio1692bda2013-12-13 10:15:34 -0800357 # Networking
john-griffithdc4dc7f2014-01-22 18:09:32 -0700358 iniset $TEMPEST_CONFIG network-feature-enabled api_extensions "${NETWORK_API_EXTENSIONS:-all}"
armando-migliaccio1692bda2013-12-13 10:15:34 -0800359
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400360 # service_available
Dean Troyer4237f592014-01-29 16:22:11 -0600361 for service in ${TEMPEST_SERVICES//,/ }; do
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400362 if is_service_enabled $service ; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700363 iniset $TEMPEST_CONFIG service_available $service "True"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400364 else
john-griffithdc4dc7f2014-01-22 18:09:32 -0700365 iniset $TEMPEST_CONFIG service_available $service "False"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400366 fi
367 done
368
Attila Fazekas2aa35172012-12-05 20:03:40 +0100369 # Restore IFS
370 IFS=$ifs
371 #Restore errexit
372 $errexit
Sean Dagued0931212012-10-04 16:06:44 -0400373}
374
Dean Troyer42a59c22014-03-03 14:31:29 -0600375# create_tempest_accounts() - Set up common required tempest accounts
376
377# Project User Roles
378# ------------------------------------------------------------------
379# alt_demo alt_demo Member
380
381# Migrated from keystone_data.sh
382function create_tempest_accounts {
383 if is_service_enabled tempest; then
384 # Tempest has some tests that validate various authorization checks
385 # between two regular users in separate tenants
386 openstack project create \
387 alt_demo
388 openstack user create \
389 --project alt_demo \
390 --password "$ADMIN_PASSWORD" \
391 alt_demo
392 openstack role add \
393 --project alt_demo \
394 --user alt_demo \
395 Member
396 fi
397}
398
Sean Dagued0931212012-10-04 16:06:44 -0400399# install_tempest() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100400function install_tempest {
Sean Dagued0931212012-10-04 16:06:44 -0400401 git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
Sean Dagued0931212012-10-04 16:06:44 -0400402}
403
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100404# init_tempest() - Initialize ec2 images
Ian Wienandaee18c72014-02-21 15:35:08 +1100405function init_tempest {
Scott Mosercde655a2013-02-20 12:33:39 -0500406 local base_image_name=cirros-0.3.1-x86_64
407 # /opt/stack/devstack/files/images/cirros-0.3.1-x86_64-uec
Attila Fazekas3c529222013-01-21 06:50:33 +0100408 local image_dir="$FILES/images/${base_image_name}-uec"
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100409 local kernel="$image_dir/${base_image_name}-vmlinuz"
410 local ramdisk="$image_dir/${base_image_name}-initrd"
411 local disk_image="$image_dir/${base_image_name}-blank.img"
412 # if the cirros uec downloaded and the system is uec capable
413 if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a "$VIRT_DRIVER" != "openvz" \
Sean Dague101b4242013-10-22 08:47:11 -0400414 -a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then
415 echo "Prepare aki/ari/ami Images"
416 ( #new namespace
417 # tenant:demo ; user: demo
418 source $TOP_DIR/accrc/demo/demo
419 euca-bundle-image -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH"
420 euca-bundle-image -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH"
421 euca-bundle-image -i "$disk_image" -d "$BOTO_MATERIALS_PATH"
422 ) 2>&1 </dev/null | cat
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100423 else
424 echo "Boto materials are not prepared"
425 fi
426}
427
Sean Dagued0931212012-10-04 16:06:44 -0400428# Restore xtrace
429$XTRACE
Sean Dague584d90e2013-03-29 14:34:53 -0400430
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100431# Tell emacs to use shell-script-mode
432## Local variables:
433## mode: shell-script
434## End: