blob: 6bb6109e13dd137e9fee8ac56564037b948a9609 [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``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010031#
Sean Dagued0931212012-10-04 16:06:44 -040032# ``stack.sh`` calls the entry points in this order:
33#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010034# - install_tempest
35# - configure_tempest
36# - init_tempest
Sean Dagued0931212012-10-04 16:06:44 -040037
38# Save trace setting
39XTRACE=$(set +o | grep xtrace)
40set +o xtrace
41
Dean Troyer6d04fd72012-12-21 11:03:37 -060042
Sean Dagued0931212012-10-04 16:06:44 -040043# Defaults
44# --------
45
Sean Dagued0931212012-10-04 16:06:44 -040046# Set up default directories
47TEMPEST_DIR=$DEST/tempest
john-griffithdc4dc7f2014-01-22 18:09:32 -070048TEMPEST_CONFIG_DIR=${TEMPEST_CONFIG_DIR:-$TEMPEST_DIR/etc}
49TEMPEST_CONFIG=$TEMPEST_CONFIG_DIR/tempest.conf
Matthew Treinish14ccba02013-07-29 16:15:53 -040050TEMPEST_STATE_PATH=${TEMPEST_STATE_PATH:=$DATA_DIR/tempest}
Attila Fazekas2aa35172012-12-05 20:03:40 +010051
Dean Troyer6d04fd72012-12-21 11:03:37 -060052NOVA_SOURCE_DIR=$DEST/nova
53
Attila Fazekasbae02332013-05-09 09:24:49 +020054BUILD_INTERVAL=1
Attila Fazekas8111ef02013-10-18 16:21:26 +020055BUILD_TIMEOUT=196
Sean Dagued0931212012-10-04 16:06:44 -040056
Dean Troyer6d04fd72012-12-21 11:03:37 -060057
Attila Fazekas2d4c8da2014-03-19 10:42:01 +010058BOTO_MATERIALS_PATH="$FILES/images/s3-materials/cirros-${CIRROS_VERSION}"
Attila Fazekas1d29d8b2013-01-07 15:51:32 +010059
john-griffithdc4dc7f2014-01-22 18:09:32 -070060# Cinder/Volume variables
61TEMPEST_VOLUME_DRIVER=${TEMPEST_VOLUME_DRIVER:-default}
62TEMPEST_VOLUME_VENDOR=${TEMPEST_VOLUME_VENDOR:-"Open Source"}
63TEMPEST_STORAGE_PROTOCOL=${TEMPEST_STORAGE_PROTOCOL:-iSCSI}
Dean Troyercc6b4432013-04-08 15:38:03 -050064
armando-migliaccio71ef61a2014-02-19 22:19:24 -080065# Neutron/Network variables
66IPV6_ENABLED=$(trueorfalse True $IPV6_ENABLED)
sridhargaddamfe733ae2014-06-03 09:03:45 +053067IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True $IPV6_SUBNET_ATTRIBUTES_ENABLED)
armando-migliaccio71ef61a2014-02-19 22:19:24 -080068
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 Fazekas65c08462012-12-07 14:20:51 +010080 local password
81 local line
82 local flavors
Clark Boylan3b80bde2013-11-20 17:51:50 -080083 local available_flavors
Attila Fazekas65c08462012-12-07 14:20:51 +010084 local flavors_ref
85 local flavor_lines
Maru Newbya5c774e2012-12-10 10:40:01 +000086 local public_network_id
Maru Newby31c94ab2012-12-19 03:59:20 +000087 local public_router_id
Maru Newbya5c774e2012-12-10 10:40:01 +000088 local tenant_networks_reachable
Attila Fazekas1d29d8b2013-01-07 15:51:32 +010089 local boto_instance_type="m1.tiny"
Attila Fazekas386ae8c2013-10-21 09:27:18 +020090 local ssh_connect_method="fixed"
Attila Fazekas2aa35172012-12-05 20:03:40 +010091
Dean Troyer6d04fd72012-12-21 11:03:37 -060092 # Save IFS
Attila Fazekas2aa35172012-12-05 20:03:40 +010093 ifs=$IFS
94
95 # Glance should already contain images to be used in tempest
96 # testing. Here we simply look for images stored in Glance
97 # and set the appropriate variables for use in the tempest config
98 # We ignore ramdisk and kernel images, look for the default image
Attila Fazekas65c08462012-12-07 14:20:51 +010099 # ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the
100 # first image returned and set ``image_uuid_alt`` to the second,
Attila Fazekas2aa35172012-12-05 20:03:40 +0100101 # if there is more than one returned...
102 # ... Also ensure we only take active images, so we don't get snapshots in process
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500103 declare -a images
104
105 while read -r IMAGE_NAME IMAGE_UUID; do
106 if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
107 image_uuid="$IMAGE_UUID"
108 image_uuid_alt="$IMAGE_UUID"
Attila Fazekas2aa35172012-12-05 20:03:40 +0100109 fi
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500110 images+=($IMAGE_UUID)
111 done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
112
113 case "${#images[*]}" in
114 0)
115 echo "Found no valid images to use!"
116 exit 1
117 ;;
118 1)
119 if [ -z "$image_uuid" ]; then
120 image_uuid=${images[0]}
121 image_uuid_alt=${images[0]}
122 fi
123 ;;
124 *)
125 if [ -z "$image_uuid" ]; then
126 image_uuid=${images[0]}
127 image_uuid_alt=${images[1]}
128 fi
129 ;;
130 esac
Attila Fazekas2aa35172012-12-05 20:03:40 +0100131
132 # Create tempest.conf from tempest.conf.sample
133 # copy every time, because the image UUIDS are going to change
Ian Wienand5f90fc02014-02-24 15:40:42 +1100134 if [[ ! -d $TEMPEST_CONFIG_DIR ]]; then
135 sudo mkdir -p $TEMPEST_CONFIG_DIR
136 fi
137 sudo chown $STACK_USER $TEMPEST_CONFIG_DIR
138 cp $TEMPEST_DIR/etc/tempest.conf.sample $TEMPEST_CONFIG
139 chmod 644 $TEMPEST_CONFIG
Attila Fazekas2aa35172012-12-05 20:03:40 +0100140
Attila Fazekas65c08462012-12-07 14:20:51 +0100141 password=${ADMIN_PASSWORD:-secrete}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100142
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000143 # See files/keystone_data.sh and stack.sh where admin, demo and alt_demo
144 # user and tenant are set up...
145 ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
146 ADMIN_TENANT_NAME=${ADMIN_TENANT_NAME:-admin}
Andrea Frittoli03523252014-04-08 13:43:56 +0100147 ADMIN_DOMAIN_NAME=${ADMIN_DOMAIN_NAME:-Default}
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000148 TEMPEST_USERNAME=${TEMPEST_USERNAME:-demo}
149 TEMPEST_TENANT_NAME=${TEMPEST_TENANT_NAME:-demo}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100150 ALT_USERNAME=${ALT_USERNAME:-alt_demo}
151 ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
152
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100153 # If the ``DEFAULT_INSTANCE_TYPE`` not declared, use the new behavior
154 # Tempest creates instane types for himself
155 if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
Clark Boylan3b80bde2013-11-20 17:51:50 -0800156 available_flavors=$(nova flavor-list)
157 if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200158 if is_arch "ppc64"; then
159 # qemu needs at least 128MB of memory to boot on ppc64
160 nova flavor-create m1.nano 42 128 0 1
161 else
162 nova flavor-create m1.nano 42 64 0 1
163 fi
Clark Boylan3b80bde2013-11-20 17:51:50 -0800164 fi
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100165 flavor_ref=42
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100166 boto_instance_type=m1.nano
Clark Boylan3b80bde2013-11-20 17:51:50 -0800167 if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200168 if is_arch "ppc64"; then
169 nova flavor-create m1.micro 84 256 0 1
170 else
171 nova flavor-create m1.micro 84 128 0 1
172 fi
Clark Boylan3b80bde2013-11-20 17:51:50 -0800173 fi
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100174 flavor_ref_alt=84
175 else
176 # Check Nova for existing flavors and, if set, look for the
177 # ``DEFAULT_INSTANCE_TYPE`` and use that.
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100178 boto_instance_type=$DEFAULT_INSTANCE_TYPE
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100179 flavor_lines=`nova flavor-list`
180 IFS=$'\r\n'
181 flavors=""
Dean Troyerceaa38b2012-12-12 17:09:57 -0600182 for line in $flavor_lines; do
183 f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
184 flavors="$flavors $f"
185 done
Attila Fazekas2aa35172012-12-05 20:03:40 +0100186
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100187 for line in $flavor_lines; do
188 flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
189 done
190
191 IFS=" "
192 flavors=($flavors)
193 num_flavors=${#flavors[*]}
194 echo "Found $num_flavors flavors"
195 if [[ $num_flavors -eq 0 ]]; then
196 echo "Found no valid flavors to use!"
197 exit 1
198 fi
199 flavor_ref=${flavors[0]}
200 flavor_ref_alt=$flavor_ref
Adalberto Medeiros63a71a22013-06-06 08:46:04 -0400201
202 # ensure flavor_ref and flavor_ref_alt have different values
203 # some resize instance in tempest tests depends on this.
204 for f in ${flavors[@]:1}; do
205 if [[ $f -ne $flavor_ref ]]; then
206 flavor_ref_alt=$f
207 break
208 fi
209 done
Attila Fazekas2aa35172012-12-05 20:03:40 +0100210 fi
211
Maru Newbya5c774e2012-12-10 10:40:01 +0000212 if [ "$Q_USE_NAMESPACE" != "False" ]; then
213 tenant_networks_reachable=false
Attila Fazekasf9e77392013-12-03 06:17:16 +0100214 if ! is_service_enabled n-net; then
215 ssh_connect_method="floating"
216 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000217 else
218 tenant_networks_reachable=true
219 fi
220
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200221 ssh_connect_method=${TEMPEST_SSH_CONNECT_METHOD:-$ssh_connect_method}
222
Tomoe Sugiharaafbc6312013-11-14 20:02:47 +0000223 if [ "$Q_L3_ENABLED" = "True" ]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400224 public_network_id=$(neutron net-list | grep $PUBLIC_NETWORK_NAME | \
Maru Newbya5c774e2012-12-10 10:40:01 +0000225 awk '{print $2}')
Maru Newby31c94ab2012-12-19 03:59:20 +0000226 if [ "$Q_USE_NAMESPACE" == "False" ]; then
227 # If namespaces are disabled, devstack will create a single
228 # public router that tempest should be configured to use.
Mark McClainb05c8762013-07-06 23:29:39 -0400229 public_router_id=$(neutron router-list | awk "/ $Q_ROUTER_NAME / \
Sean Dague101b4242013-10-22 08:47:11 -0400230 { print \$2 }")
Maru Newby31c94ab2012-12-19 03:59:20 +0000231 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000232 fi
233
Matthew Treinish859cc682013-07-26 15:22:44 -0400234 # Oslo
john-griffithdc4dc7f2014-01-22 18:09:32 -0700235 iniset $TEMPEST_CONFIG DEFAULT lock_path $TEMPEST_STATE_PATH
Matthew Treinish14ccba02013-07-29 16:15:53 -0400236 mkdir -p $TEMPEST_STATE_PATH
john-griffithdc4dc7f2014-01-22 18:09:32 -0700237 iniset $TEMPEST_CONFIG DEFAULT use_stderr False
238 iniset $TEMPEST_CONFIG DEFAULT log_file tempest.log
239 iniset $TEMPEST_CONFIG DEFAULT debug True
Matthew Treinish859cc682013-07-26 15:22:44 -0400240
Attila Fazekas2aa35172012-12-05 20:03:40 +0100241 # Timeouts
john-griffithdc4dc7f2014-01-22 18:09:32 -0700242 iniset $TEMPEST_CONFIG compute build_timeout $BUILD_TIMEOUT
243 iniset $TEMPEST_CONFIG volume build_timeout $BUILD_TIMEOUT
244 iniset $TEMPEST_CONFIG boto build_timeout $BUILD_TIMEOUT
john-griffithdc4dc7f2014-01-22 18:09:32 -0700245 iniset $TEMPEST_CONFIG boto http_socket_timeout 5
Attila Fazekas2aa35172012-12-05 20:03:40 +0100246
Attila Fazekas97d3d202013-01-19 19:20:49 +0100247 # Identity
john-griffithdc4dc7f2014-01-22 18:09:32 -0700248 iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v2.0/"
Matthew Treinish6c9430e2014-02-06 17:06:00 +0000249 iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v3/"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000250 iniset $TEMPEST_CONFIG identity username $TEMPEST_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700251 iniset $TEMPEST_CONFIG identity password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000252 iniset $TEMPEST_CONFIG identity tenant_name $TEMPEST_TENANT_NAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700253 iniset $TEMPEST_CONFIG identity alt_username $ALT_USERNAME
254 iniset $TEMPEST_CONFIG identity alt_password "$password"
255 iniset $TEMPEST_CONFIG identity alt_tenant_name $ALT_TENANT_NAME
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000256 iniset $TEMPEST_CONFIG identity admin_username $ADMIN_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700257 iniset $TEMPEST_CONFIG identity admin_password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000258 iniset $TEMPEST_CONFIG identity admin_tenant_name $ADMIN_TENANT_NAME
Andrea Frittoli03523252014-04-08 13:43:56 +0100259 iniset $TEMPEST_CONFIG identity admin_domain_name $ADMIN_DOMAIN_NAME
Andrea Frittoli07f1d0e2014-03-06 23:23:01 +0000260 iniset $TEMPEST_CONFIG identity auth_version ${TEMPEST_AUTH_VERSION:-v2}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100261
Sean Daguec3771452013-06-13 14:23:37 -0400262 # Image
263 # for the gate we want to be able to override this variable so we aren't
264 # doing an HTTP fetch over the wide internet for this test
265 if [[ ! -z "$TEMPEST_HTTP_IMAGE" ]]; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700266 iniset $TEMPEST_CONFIG image http_image $TEMPEST_HTTP_IMAGE
Sean Daguec3771452013-06-13 14:23:37 -0400267 fi
268
Attila Fazekas97d3d202013-01-19 19:20:49 +0100269 # Compute
john-griffithdc4dc7f2014-01-22 18:09:32 -0700270 iniset $TEMPEST_CONFIG compute allow_tenant_isolation ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
271 iniset $TEMPEST_CONFIG compute ssh_user ${DEFAULT_INSTANCE_USER:-cirros} # DEPRECATED
272 iniset $TEMPEST_CONFIG compute network_for_ssh $PRIVATE_NETWORK_NAME
273 iniset $TEMPEST_CONFIG compute ip_version_for_ssh 4
274 iniset $TEMPEST_CONFIG compute ssh_timeout $BUILD_TIMEOUT
275 iniset $TEMPEST_CONFIG compute image_ref $image_uuid
276 iniset $TEMPEST_CONFIG compute image_ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
277 iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid_alt
278 iniset $TEMPEST_CONFIG compute image_alt_ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
279 iniset $TEMPEST_CONFIG compute flavor_ref $flavor_ref
280 iniset $TEMPEST_CONFIG compute flavor_ref_alt $flavor_ref_alt
john-griffithdc4dc7f2014-01-22 18:09:32 -0700281 iniset $TEMPEST_CONFIG compute ssh_connect_method $ssh_connect_method
Attila Fazekas97d3d202013-01-19 19:20:49 +0100282
Sean Daguede19bf92014-03-20 16:54:58 -0400283 # Compute Features
284 iniset $TEMPEST_CONFIG compute-feature-enabled resize True
Matthew Treinish270f93e2014-03-20 21:18:42 +0000285 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
286 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
287 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 -0400288
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200289 # Compute admin
Sean Daguee530ba32014-03-07 05:58:18 -0500290 iniset $TEMPEST_CONFIG "compute-admin" username $ADMIN_USERNAME
291 iniset $TEMPEST_CONFIG "compute-admin" password "$password"
292 iniset $TEMPEST_CONFIG "compute-admin" tenant_name $ADMIN_TENANT_NAME
Attila Fazekas2aa35172012-12-05 20:03:40 +0100293
armando-migliaccio71ef61a2014-02-19 22:19:24 -0800294 # Network
john-griffithdc4dc7f2014-01-22 18:09:32 -0700295 iniset $TEMPEST_CONFIG network api_version 2.0
296 iniset $TEMPEST_CONFIG network tenant_networks_reachable "$tenant_networks_reachable"
297 iniset $TEMPEST_CONFIG network public_network_id "$public_network_id"
298 iniset $TEMPEST_CONFIG network public_router_id "$public_router_id"
299 iniset $TEMPEST_CONFIG network default_network "$FIXED_RANGE"
Matthew Treinishccf60f72014-03-03 22:48:31 -0500300 iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED"
Sean M. Collinsbb2908b2014-05-15 10:24:31 -0400301 iniset $TEMPEST_CONFIG network-feature-enabled ipv6_subnet_attributes "$IPV6_SUBNET_ATTRIBUTES_ENABLED"
Attila Fazekas2aa35172012-12-05 20:03:40 +0100302
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200303 # boto
john-griffithdc4dc7f2014-01-22 18:09:32 -0700304 iniset $TEMPEST_CONFIG boto ec2_url "http://$SERVICE_HOST:8773/services/Cloud"
305 iniset $TEMPEST_CONFIG boto s3_url "http://$SERVICE_HOST:${S3_SERVICE_PORT:-3333}"
306 iniset $TEMPEST_CONFIG boto s3_materials_path "$BOTO_MATERIALS_PATH"
Attila Fazekas2d4c8da2014-03-19 10:42:01 +0100307 iniset $TEMPEST_CONFIG boto ari_manifest cirros-${CIRROS_VERSION}-x86_64-initrd.manifest.xml
308 iniset $TEMPEST_CONFIG boto ami_manifest cirros-${CIRROS_VERSION}-x86_64-blank.img.manifest.xml
309 iniset $TEMPEST_CONFIG boto aki_manifest cirros-${CIRROS_VERSION}-x86_64-vmlinuz.manifest.xml
john-griffithdc4dc7f2014-01-22 18:09:32 -0700310 iniset $TEMPEST_CONFIG boto instance_type "$boto_instance_type"
311 iniset $TEMPEST_CONFIG boto http_socket_timeout 30
312 iniset $TEMPEST_CONFIG boto ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100313
Sean Dague669c4fc2014-04-03 11:28:01 -0400314 # Orchestration Tests
315 if is_service_enabled heat; then
316 if [[ ! -z "$HEAT_CFN_IMAGE_URL" ]]; then
317 iniset $TEMPEST_CONFIG orchestration image_ref $(basename "$HEAT_CFN_IMAGE_URL" ".qcow2")
318 fi
Attila Fazekas51557a52014-06-13 16:09:37 +0200319 # build a specialized heat flavor
Sean Dague669c4fc2014-04-03 11:28:01 -0400320 available_flavors=$(nova flavor-list)
321 if [[ ! ( $available_flavors =~ 'm1.heat' ) ]]; then
Attila Fazekas51557a52014-06-13 16:09:37 +0200322 nova flavor-create m1.heat 451 512 0 1
Sean Dague669c4fc2014-04-03 11:28:01 -0400323 fi
324 iniset $TEMPEST_CONFIG orchestration instance_type "m1.heat"
325 iniset $TEMPEST_CONFIG orchestration build_timeout 900
Steve Bakerd5cccad2013-07-19 10:34:24 +1200326 fi
327
William Marshall24d866e2013-07-02 12:26:31 -0500328 # Scenario
Attila Fazekas2d4c8da2014-03-19 10:42:01 +0100329 iniset $TEMPEST_CONFIG scenario img_dir "$FILES/images/cirros-${CIRROS_VERSION}-x86_64-uec"
330 iniset $TEMPEST_CONFIG scenario ami_img_file "cirros-${CIRROS_VERSION}-x86_64-blank.img"
331 iniset $TEMPEST_CONFIG scenario ari_img_file "cirros-${CIRROS_VERSION}-x86_64-initrd"
332 iniset $TEMPEST_CONFIG scenario aki_img_file "cirros-${CIRROS_VERSION}-x86_64-vmlinuz"
William Marshall24d866e2013-07-02 12:26:31 -0500333
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400334 # Large Ops Number
john-griffithdc4dc7f2014-01-22 18:09:32 -0700335 iniset $TEMPEST_CONFIG scenario large_ops_number ${TEMPEST_LARGE_OPS_NUMBER:-0}
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400336
Vadim Rovachev2541d612014-05-29 18:48:10 +0400337 # Telemetry
338 # Ceilometer API optimization happened in juno that allows to run more tests in tempest.
339 # Once Tempest retires support for icehouse this flag can be removed.
340 iniset $TEMPEST_CONFIG telemetry too_slow_to_test "False"
341
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200342 # Volume
Giulio Fidente3d60f4d2014-02-20 16:43:49 +0100343 if ! is_service_enabled c-bak; then
344 iniset $TEMPEST_CONFIG volume-feature-enabled backup False
Giulio Fidente3632ab12013-09-10 02:51:26 +0200345 fi
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200346 CINDER_MULTI_LVM_BACKEND=$(trueorfalse False $CINDER_MULTI_LVM_BACKEND)
Ian Wienandc42ed252013-06-17 13:23:44 +1000347 if [ $CINDER_MULTI_LVM_BACKEND == "True" ]; then
Matthew Treinishdb1c3842014-02-04 20:58:00 +0000348 iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
john-griffithdc4dc7f2014-01-22 18:09:32 -0700349 iniset $TEMPEST_CONFIG volume backend1_name "LVM_iSCSI"
350 iniset $TEMPEST_CONFIG volume backend2_name "LVM_iSCSI_2"
351 fi
352
353 if [ $TEMPEST_VOLUME_DRIVER != "default" ]; then
354 iniset $TEMPEST_CONFIG volume vendor_name $TEMPEST_VOLUME_VENDOR
355 iniset $TEMPEST_CONFIG volume storage_protocol $TEMPEST_STORAGE_PROTOCOL
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200356 fi
357
Julie Pichonfea70f82013-07-29 11:22:08 +0100358 # Dashboard
john-griffithdc4dc7f2014-01-22 18:09:32 -0700359 iniset $TEMPEST_CONFIG dashboard dashboard_url "http://$SERVICE_HOST/"
360 iniset $TEMPEST_CONFIG dashboard login_url "http://$SERVICE_HOST/auth/login/"
Julie Pichonfea70f82013-07-29 11:22:08 +0100361
Ian Wienand7fa19022013-06-25 14:11:48 +1000362 # cli
john-griffithdc4dc7f2014-01-22 18:09:32 -0700363 iniset $TEMPEST_CONFIG cli cli_dir $NOVA_BIN_DIR
Ian Wienand7fa19022013-06-25 14:11:48 +1000364
armando-migliaccio1692bda2013-12-13 10:15:34 -0800365 # Networking
john-griffithdc4dc7f2014-01-22 18:09:32 -0700366 iniset $TEMPEST_CONFIG network-feature-enabled api_extensions "${NETWORK_API_EXTENSIONS:-all}"
armando-migliaccio1692bda2013-12-13 10:15:34 -0800367
Adam Gandelman43bd6672014-04-03 11:13:13 -0700368 # Baremetal
369 if [ "$VIRT_DRIVER" = "ironic" ] ; then
370 iniset $TEMPEST_CONFIG baremetal driver_enabled True
371 fi
372
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400373 # service_available
Dean Troyer4237f592014-01-29 16:22:11 -0600374 for service in ${TEMPEST_SERVICES//,/ }; do
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400375 if is_service_enabled $service ; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700376 iniset $TEMPEST_CONFIG service_available $service "True"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400377 else
john-griffithdc4dc7f2014-01-22 18:09:32 -0700378 iniset $TEMPEST_CONFIG service_available $service "False"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400379 fi
380 done
381
Attila Fazekas2aa35172012-12-05 20:03:40 +0100382 # Restore IFS
383 IFS=$ifs
Sean Dagued0931212012-10-04 16:06:44 -0400384}
385
Dean Troyer42a59c22014-03-03 14:31:29 -0600386# create_tempest_accounts() - Set up common required tempest accounts
387
388# Project User Roles
389# ------------------------------------------------------------------
390# alt_demo alt_demo Member
391
392# Migrated from keystone_data.sh
393function create_tempest_accounts {
394 if is_service_enabled tempest; then
395 # Tempest has some tests that validate various authorization checks
396 # between two regular users in separate tenants
397 openstack project create \
398 alt_demo
399 openstack user create \
400 --project alt_demo \
401 --password "$ADMIN_PASSWORD" \
402 alt_demo
403 openstack role add \
404 --project alt_demo \
405 --user alt_demo \
406 Member
407 fi
408}
409
Sean Dagued0931212012-10-04 16:06:44 -0400410# install_tempest() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100411function install_tempest {
Sean Dagued0931212012-10-04 16:06:44 -0400412 git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
Attila Fazekas522cfe02014-04-11 11:14:07 +0200413 pip_install "tox<1.7"
Sean Dagued0931212012-10-04 16:06:44 -0400414}
415
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100416# init_tempest() - Initialize ec2 images
Ian Wienandaee18c72014-02-21 15:35:08 +1100417function init_tempest {
Attila Fazekas2d4c8da2014-03-19 10:42:01 +0100418 local base_image_name=cirros-${CIRROS_VERSION}-x86_64
419 # /opt/stack/devstack/files/images/cirros-${CIRROS_VERSION}-x86_64-uec
Attila Fazekas3c529222013-01-21 06:50:33 +0100420 local image_dir="$FILES/images/${base_image_name}-uec"
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100421 local kernel="$image_dir/${base_image_name}-vmlinuz"
422 local ramdisk="$image_dir/${base_image_name}-initrd"
423 local disk_image="$image_dir/${base_image_name}-blank.img"
424 # if the cirros uec downloaded and the system is uec capable
425 if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a "$VIRT_DRIVER" != "openvz" \
Sean Dague101b4242013-10-22 08:47:11 -0400426 -a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then
427 echo "Prepare aki/ari/ami Images"
428 ( #new namespace
429 # tenant:demo ; user: demo
430 source $TOP_DIR/accrc/demo/demo
Davanum Srinivas60663272014-04-08 13:47:17 -0400431 euca-bundle-image -r x86_64 -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH"
432 euca-bundle-image -r x86_64 -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH"
433 euca-bundle-image -r x86_64 -i "$disk_image" -d "$BOTO_MATERIALS_PATH"
Sean Dague101b4242013-10-22 08:47:11 -0400434 ) 2>&1 </dev/null | cat
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100435 else
436 echo "Boto materials are not prepared"
437 fi
438}
439
Sean Dagued0931212012-10-04 16:06:44 -0400440# Restore xtrace
441$XTRACE
Sean Dague584d90e2013-03-29 14:34:53 -0400442
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100443# Tell emacs to use shell-script-mode
444## Local variables:
445## mode: shell-script
446## End: