Change-Id: I5e83531c32968bc734abb0f9a8d03e2f9500a074
| ... | ... |
@@ -4,21 +4,21 @@ |
| 4 | 4 |
# ``functions`` file |
| 5 | 5 |
# ``lib/nova`` service is runing |
| 6 | 6 |
# <list other global vars that are assumed to be defined> |
| 7 |
-# - DEST |
|
| 8 |
-# - ADMIN_PASSWORD |
|
| 9 |
-# - OS_USERNAME |
|
| 10 |
-# - DEFAULT_IMAGE_NAME |
|
| 11 |
-# - S3_SERVICE_PORT |
|
| 12 |
-# - SERVICE_HOST |
|
| 13 |
-# - BASE_SQL_CONN ``lib/database`` declares |
|
| 7 |
+# - ``DEST`` |
|
| 8 |
+# - ``ADMIN_PASSWORD`` |
|
| 9 |
+# - ``DEFAULT_IMAGE_NAME`` |
|
| 10 |
+# - ``S3_SERVICE_PORT`` |
|
| 11 |
+# - ``SERVICE_HOST`` |
|
| 12 |
+# - ``BASE_SQL_CONN`` ``lib/database`` declares |
|
| 14 | 13 |
# Optional Dependencies: |
| 15 |
-# IDENTITY_* |
|
| 14 |
+# IDENTITY_USE_SSL, IDENTITY_HOST, IDENTITY_PORT, IDENTITY_PATH |
|
| 16 | 15 |
# ALT_* (similar vars exists in keystone_data.sh) |
| 17 |
-# IMAGE_* |
|
| 18 |
-# LIVE_MIGRATION_AVAILABLE |
|
| 19 |
-# DEFAULT_INSTANCE_TYPE |
|
| 20 |
-# DEFAULT_INSTANCE_USER |
|
| 21 |
-# USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION |
|
| 16 |
+# ``OS_USERNAME`` |
|
| 17 |
+# ``IMAGE_PORT``, ``IMAGE_HOST`` |
|
| 18 |
+# ``LIVE_MIGRATION_AVAILABLE`` |
|
| 19 |
+# ``USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION`` |
|
| 20 |
+# ``DEFAULT_INSTANCE_TYPE`` |
|
| 21 |
+# ``DEFAULT_INSTANCE_USER`` |
|
| 22 | 22 |
# ``stack.sh`` calls the entry points in this order: |
| 23 | 23 |
# |
| 24 | 24 |
# install_tempest |
| ... | ... |
@@ -52,12 +52,17 @@ BUILD_TIMEOUT=400 |
| 52 | 52 |
|
| 53 | 53 |
# configure_tempest() - Set config files, create data dirs, etc |
| 54 | 54 |
function configure_tempest() {
|
| 55 |
- local IMAGE_LINES |
|
| 56 |
- local IMAGES |
|
| 57 |
- local NUM_IMAGES |
|
| 58 |
- local IMAGE_UUID |
|
| 59 |
- local IMAGE_UUID_ALT |
|
| 55 |
+ local image_lines |
|
| 56 |
+ local images |
|
| 57 |
+ local num_images |
|
| 58 |
+ local image_uuid |
|
| 59 |
+ local image_uuid_alt |
|
| 60 | 60 |
local errexit |
| 61 |
+ local password |
|
| 62 |
+ local line |
|
| 63 |
+ local flavors |
|
| 64 |
+ local flavors_ref |
|
| 65 |
+ local flavor_lines |
|
| 61 | 66 |
|
| 62 | 67 |
#TODO(afazekas): |
| 63 | 68 |
# sudo python setup.py deploy |
| ... | ... |
@@ -74,33 +79,33 @@ function configure_tempest() {
|
| 74 | 74 |
# testing. Here we simply look for images stored in Glance |
| 75 | 75 |
# and set the appropriate variables for use in the tempest config |
| 76 | 76 |
# We ignore ramdisk and kernel images, look for the default image |
| 77 |
- # DEFAULT_IMAGE_NAME. If not found, we set the IMAGE_UUID to the |
|
| 78 |
- # first image returned and set IMAGE_UUID_ALT to the second, |
|
| 77 |
+ # ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the |
|
| 78 |
+ # first image returned and set ``image_uuid_alt`` to the second, |
|
| 79 | 79 |
# if there is more than one returned... |
| 80 | 80 |
# ... Also ensure we only take active images, so we don't get snapshots in process |
| 81 |
- IMAGE_LINES=`glance image-list` |
|
| 81 |
+ image_lines=`glance image-list` |
|
| 82 | 82 |
IFS=$'\n\r' |
| 83 |
- IMAGES="" |
|
| 84 |
- for line in $IMAGE_LINES; do |
|
| 83 |
+ images="" |
|
| 84 |
+ for line in $image_lines; do |
|
| 85 | 85 |
if [ -z $DEFAULT_IMAGE_NAME ]; then |
| 86 |
- IMAGES="$IMAGES `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | cut -d' ' -f2`" |
|
| 86 |
+ images="$images `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | cut -d' ' -f2`" |
|
| 87 | 87 |
else |
| 88 |
- IMAGES="$IMAGES `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | grep "$DEFAULT_IMAGE_NAME" | cut -d' ' -f2`" |
|
| 88 |
+ images="$images `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | grep "$DEFAULT_IMAGE_NAME" | cut -d' ' -f2`" |
|
| 89 | 89 |
fi |
| 90 | 90 |
done |
| 91 | 91 |
# Create array of image UUIDs... |
| 92 | 92 |
IFS=" " |
| 93 |
- IMAGES=($IMAGES) |
|
| 94 |
- NUM_IMAGES=${#IMAGES[*]}
|
|
| 95 |
- echo "Found $NUM_IMAGES images" |
|
| 96 |
- if [[ $NUM_IMAGES -eq 0 ]]; then |
|
| 93 |
+ images=($images) |
|
| 94 |
+ num_images=${#images[*]}
|
|
| 95 |
+ echo "Found $num_images images" |
|
| 96 |
+ if [[ $num_images -eq 0 ]]; then |
|
| 97 | 97 |
echo "Found no valid images to use!" |
| 98 | 98 |
exit 1 |
| 99 | 99 |
fi |
| 100 |
- IMAGE_UUID=${IMAGES[0]}
|
|
| 101 |
- IMAGE_UUID_ALT=$IMAGE_UUID |
|
| 102 |
- if [[ $NUM_IMAGES -gt 1 ]]; then |
|
| 103 |
- IMAGE_UUID_ALT=${IMAGES[1]}
|
|
| 100 |
+ image_uuid=${images[0]}
|
|
| 101 |
+ image_uuid_alt=$image_uuid |
|
| 102 |
+ if [[ $num_images -gt 1 ]]; then |
|
| 103 |
+ image_uuid_alt=${images[1]}
|
|
| 104 | 104 |
fi |
| 105 | 105 |
|
| 106 | 106 |
# Create tempest.conf from tempest.conf.sample |
| ... | ... |
@@ -114,7 +119,7 @@ function configure_tempest() {
|
| 114 | 114 |
# from the Tempest configuration file entirely... |
| 115 | 115 |
IDENTITY_PATH=${IDENTITY_PATH:-tokens}
|
| 116 | 116 |
|
| 117 |
- PASSWORD=${ADMIN_PASSWORD:-secrete}
|
|
| 117 |
+ password=${ADMIN_PASSWORD:-secrete}
|
|
| 118 | 118 |
|
| 119 | 119 |
# See files/keystone_data.sh where alt_demo user |
| 120 | 120 |
# and tenant are set up... |
| ... | ... |
@@ -122,30 +127,30 @@ function configure_tempest() {
|
| 122 | 122 |
ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
|
| 123 | 123 |
|
| 124 | 124 |
# Check Nova for existing flavors and, if set, look for the |
| 125 |
- # DEFAULT_INSTANCE_TYPE and use that. Otherwise, just use the first flavor. |
|
| 126 |
- FLAVOR_LINES=`nova flavor-list` |
|
| 127 |
- IFS="$(echo -e "\n\r")" |
|
| 128 |
- FLAVORS="" |
|
| 129 |
- for line in $FLAVOR_LINES; do |
|
| 125 |
+ # ``DEFAULT_INSTANCE_TYPE`` and use that. Otherwise, just use the first flavor. |
|
| 126 |
+ flavor_lines=`nova flavor-list` |
|
| 127 |
+ IFS=$'\r\n' |
|
| 128 |
+ flavors="" |
|
| 129 |
+ for line in $flavor_lines; do |
|
| 130 | 130 |
if [ -z $DEFAULT_INSTANCE_TYPE ]; then |
| 131 |
- FLAVORS="$FLAVORS `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`" |
|
| 131 |
+ flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`" |
|
| 132 | 132 |
else |
| 133 |
- FLAVORS="$FLAVORS `echo $line | grep -v "^\(|\s*ID\|+--\)" | grep "$DEFAULT_INSTANCE_TYPE" | cut -d' ' -f2`" |
|
| 133 |
+ flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | grep "$DEFAULT_INSTANCE_TYPE" | cut -d' ' -f2`" |
|
| 134 | 134 |
fi |
| 135 | 135 |
done |
| 136 | 136 |
|
| 137 | 137 |
IFS=" " |
| 138 |
- FLAVORS=($FLAVORS) |
|
| 139 |
- NUM_FLAVORS=${#FLAVORS[*]}
|
|
| 140 |
- echo "Found $NUM_FLAVORS flavors" |
|
| 141 |
- if [[ $NUM_FLAVORS -eq 0 ]]; then |
|
| 138 |
+ flavors=($flavors) |
|
| 139 |
+ num_flavors=${#flavors[*]}
|
|
| 140 |
+ echo "Found $num_flavors flavors" |
|
| 141 |
+ if [[ $num_flavors -eq 0 ]]; then |
|
| 142 | 142 |
echo "Found no valid flavors to use!" |
| 143 | 143 |
exit 1 |
| 144 | 144 |
fi |
| 145 |
- FLAVOR_REF=${FLAVORS[0]}
|
|
| 146 |
- FLAVOR_REF_ALT=$FLAVOR_REF |
|
| 147 |
- if [[ $NUM_FLAVORS -gt 1 ]]; then |
|
| 148 |
- FLAVOR_REF_ALT=${FLAVORS[1]}
|
|
| 145 |
+ flavor_ref=${flavors[0]}
|
|
| 146 |
+ flavor_ref_alt=$flavor_ref |
|
| 147 |
+ if [[ $num_flavors -gt 1 ]]; then |
|
| 148 |
+ flavor_ref_alt=${flavors[1]}
|
|
| 149 | 149 |
fi |
| 150 | 150 |
|
| 151 | 151 |
# Timeouts |
| ... | ... |
@@ -162,9 +167,9 @@ function configure_tempest() {
|
| 162 | 162 |
iniset $TEMPEST_CONF identity port $IDENTITY_PORT |
| 163 | 163 |
iniset $TEMPEST_CONF identity path $IDENTITY_PATH |
| 164 | 164 |
|
| 165 |
- iniset $TEMPEST_CONF compute password "$PASSWORD" |
|
| 165 |
+ iniset $TEMPEST_CONF compute password "$password" |
|
| 166 | 166 |
iniset $TEMPEST_CONF compute alt_username $ALT_USERNAME |
| 167 |
- iniset $TEMPEST_CONF compute alt_password "$PASSWORD" |
|
| 167 |
+ iniset $TEMPEST_CONF compute alt_password "$password" |
|
| 168 | 168 |
iniset $TEMPEST_CONF compute alt_tenant_name $ALT_TENANT_NAME |
| 169 | 169 |
iniset $TEMPEST_CONF compute resize_available False |
| 170 | 170 |
iniset $TEMPEST_CONF compute change_password_available False |
| ... | ... |
@@ -175,10 +180,10 @@ function configure_tempest() {
|
| 175 | 175 |
iniset $TEMPEST_CONF compute network_for_ssh private |
| 176 | 176 |
iniset $TEMPEST_CONF compute ip_version_for_ssh 4 |
| 177 | 177 |
iniset $TEMPEST_CONF compute ssh_timeout 4 |
| 178 |
- iniset $TEMPEST_CONF compute image_ref $IMAGE_UUID |
|
| 179 |
- iniset $TEMPEST_CONF compute image_ref_alt $IMAGE_UUID_ALT |
|
| 180 |
- iniset $TEMPEST_CONF compute flavor_ref $FLAVOR_REF |
|
| 181 |
- iniset $TEMPEST_CONF compute flavor_ref_alt $FLAVOR_REF_ALT |
|
| 178 |
+ iniset $TEMPEST_CONF compute image_ref $image_uuid |
|
| 179 |
+ iniset $TEMPEST_CONF compute image_ref_alt $image_uuid_alt |
|
| 180 |
+ iniset $TEMPEST_CONF compute flavor_ref $flavor_ref |
|
| 181 |
+ iniset $TEMPEST_CONF compute flavor_ref_alt $flavor_ref_alt |
|
| 182 | 182 |
iniset $TEMPEST_CONF compute source_dir $NOVA_SOURCE_DIR |
| 183 | 183 |
iniset $TEMPEST_CONF compute live_migration_available ${LIVE_MIGRATION_AVAILABLE:-False}
|
| 184 | 184 |
iniset $TEMPEST_CONF compute use_block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
|
| ... | ... |
@@ -192,13 +197,13 @@ function configure_tempest() {
|
| 192 | 192 |
# image |
| 193 | 193 |
iniset $TEMPEST_CONF image host ${IMAGE_HOST:-127.0.0.1}
|
| 194 | 194 |
iniset $TEMPEST_CONF image port ${IMAGE_PORT:-9292}
|
| 195 |
- iniset $TEMPEST_CONF image password "$PASSWORD" |
|
| 195 |
+ iniset $TEMPEST_CONF image password "$password" |
|
| 196 | 196 |
|
| 197 | 197 |
# identity-admin |
| 198 |
- iniset $TEMPEST_CONF "identity-admin" password "$PASSWORD" |
|
| 198 |
+ iniset $TEMPEST_CONF "identity-admin" password "$password" |
|
| 199 | 199 |
|
| 200 | 200 |
# compute admin |
| 201 |
- iniset $TEMPEST_CONF "compute-admin" password "$PASSWORD" |
|
| 201 |
+ iniset $TEMPEST_CONF "compute-admin" password "$password" |
|
| 202 | 202 |
|
| 203 | 203 |
# network |
| 204 | 204 |
iniset $TEMPEST_CONF network api_version 2.0 |