Browse code

Allow installing tempest only with keystone

Modify the lib/tempest to not fail
if no nova or glance available.

* This allows performance test of keystone and neutron with
tempest (or tempest stress runner) without having system
noise from another components.
* Depending on not required components for tempest is bad practice,
tempest service decorators expected to allow tempest,
to run in more minimal system out-of-the-box.

Change-Id: Ifc40b1eb5c4b79d96a5fae919b88afecca642ca0
(cherry picked from commit c411fcfc9224894db55d82b8ce4fa4a2b68de89d)

Attila Fazekas authored on 2014/08/19 23:48:14
Showing 1 changed files
... ...
@@ -110,34 +110,36 @@ function configure_tempest {
110 110
     # ... Also ensure we only take active images, so we don't get snapshots in process
111 111
     declare -a images
112 112
 
113
-    while read -r IMAGE_NAME IMAGE_UUID; do
114
-        if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
115
-            image_uuid="$IMAGE_UUID"
116
-            image_uuid_alt="$IMAGE_UUID"
117
-        fi
118
-        images+=($IMAGE_UUID)
119
-    # TODO(stevemar): update this command to use openstackclient's `openstack image list`
120
-    # when it supports listing by status.
121
-    done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
122
-
123
-    case "${#images[*]}" in
124
-        0)
125
-            echo "Found no valid images to use!"
126
-            exit 1
127
-            ;;
128
-        1)
129
-            if [ -z "$image_uuid" ]; then
130
-                image_uuid=${images[0]}
131
-                image_uuid_alt=${images[0]}
132
-            fi
133
-            ;;
134
-        *)
135
-            if [ -z "$image_uuid" ]; then
136
-                image_uuid=${images[0]}
137
-                image_uuid_alt=${images[1]}
113
+    if is_service_enabled glance; then
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"
138 118
             fi
139
-            ;;
140
-    esac
119
+            images+=($IMAGE_UUID)
120
+        # TODO(stevemar): update this command to use openstackclient's `openstack image list`
121
+        # when it supports listing by status.
122
+        done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
123
+
124
+        case "${#images[*]}" in
125
+            0)
126
+                echo "Found no valid images to use!"
127
+                exit 1
128
+                ;;
129
+            1)
130
+                if [ -z "$image_uuid" ]; then
131
+                    image_uuid=${images[0]}
132
+                    image_uuid_alt=${images[0]}
133
+                fi
134
+                ;;
135
+            *)
136
+                if [ -z "$image_uuid" ]; then
137
+                    image_uuid=${images[0]}
138
+                    image_uuid_alt=${images[1]}
139
+                fi
140
+                ;;
141
+        esac
142
+    fi
141 143
 
142 144
     # Create tempest.conf from tempest.conf.sample
143 145
     # copy every time, because the image UUIDS are going to change
... ...
@@ -161,63 +163,65 @@ function configure_tempest {
161 161
     ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
162 162
     ADMIN_TENANT_ID=$(openstack project list | awk "/ admin / { print \$2 }")
163 163
 
164
-    # If the ``DEFAULT_INSTANCE_TYPE`` not declared, use the new behavior
165
-    # Tempest creates instane types for himself
166
-    if  [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
167
-        available_flavors=$(nova flavor-list)
168
-        if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
169
-            if is_arch "ppc64"; then
170
-                # qemu needs at least 128MB of memory to boot on ppc64
171
-                nova flavor-create m1.nano 42 128 0 1
172
-            else
173
-                nova flavor-create m1.nano 42 64 0 1
164
+    if is_service_enabled nova; then
165
+        # If the ``DEFAULT_INSTANCE_TYPE`` not declared, use the new behavior
166
+        # Tempest creates instane types for himself
167
+        if  [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
168
+            available_flavors=$(nova flavor-list)
169
+            if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
170
+                if is_arch "ppc64"; then
171
+                    # qemu needs at least 128MB of memory to boot on ppc64
172
+                    nova flavor-create m1.nano 42 128 0 1
173
+                else
174
+                    nova flavor-create m1.nano 42 64 0 1
175
+                fi
174 176
             fi
175
-        fi
176
-        flavor_ref=42
177
-        boto_instance_type=m1.nano
178
-        if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
179
-            if is_arch "ppc64"; then
180
-                nova flavor-create m1.micro 84 256 0 1
181
-            else
182
-                nova flavor-create m1.micro 84 128 0 1
177
+            flavor_ref=42
178
+            boto_instance_type=m1.nano
179
+            if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
180
+                if is_arch "ppc64"; then
181
+                    nova flavor-create m1.micro 84 256 0 1
182
+                else
183
+                    nova flavor-create m1.micro 84 128 0 1
184
+                fi
183 185
             fi
184
-        fi
185
-        flavor_ref_alt=84
186
-    else
187
-        # Check Nova for existing flavors and, if set, look for the
188
-        # ``DEFAULT_INSTANCE_TYPE`` and use that.
189
-        boto_instance_type=$DEFAULT_INSTANCE_TYPE
190
-        flavor_lines=`nova flavor-list`
191
-        IFS=$'\r\n'
192
-        flavors=""
193
-        for line in $flavor_lines; do
194
-            f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
195
-            flavors="$flavors $f"
196
-        done
197
-
198
-        for line in $flavor_lines; do
199
-            flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
200
-        done
201
-
202
-        IFS=" "
203
-        flavors=($flavors)
204
-        num_flavors=${#flavors[*]}
205
-        echo "Found $num_flavors flavors"
206
-        if [[ $num_flavors -eq 0 ]]; then
207
-            echo "Found no valid flavors to use!"
208
-            exit 1
209
-        fi
210
-        flavor_ref=${flavors[0]}
211
-        flavor_ref_alt=$flavor_ref
212
-
213
-        # ensure flavor_ref and flavor_ref_alt have different values
214
-        # some resize instance in tempest tests depends on this.
215
-        for f in ${flavors[@]:1}; do
216
-            if [[ $f -ne $flavor_ref ]]; then
217
-                flavor_ref_alt=$f
218
-                break
186
+            flavor_ref_alt=84
187
+        else
188
+            # Check Nova for existing flavors and, if set, look for the
189
+            # ``DEFAULT_INSTANCE_TYPE`` and use that.
190
+            boto_instance_type=$DEFAULT_INSTANCE_TYPE
191
+            flavor_lines=`nova flavor-list`
192
+            IFS=$'\r\n'
193
+            flavors=""
194
+            for line in $flavor_lines; do
195
+                f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
196
+                flavors="$flavors $f"
197
+            done
198
+
199
+            for line in $flavor_lines; do
200
+                flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
201
+            done
202
+
203
+            IFS=" "
204
+            flavors=($flavors)
205
+            num_flavors=${#flavors[*]}
206
+            echo "Found $num_flavors flavors"
207
+            if [[ $num_flavors -eq 0 ]]; then
208
+                echo "Found no valid flavors to use!"
209
+                exit 1
219 210
             fi
220
-        done
211
+            flavor_ref=${flavors[0]}
212
+            flavor_ref_alt=$flavor_ref
213
+
214
+            # ensure flavor_ref and flavor_ref_alt have different values
215
+            # some resize instance in tempest tests depends on this.
216
+            for f in ${flavors[@]:1}; do
217
+                if [[ $f -ne $flavor_ref ]]; then
218
+                    flavor_ref_alt=$f
219
+                    break
220
+                fi
221
+            done
222
+        fi
221 223
     fi
222 224
 
223 225
     if [ "$Q_USE_NAMESPACE" != "False" ]; then
... ...
@@ -502,20 +506,22 @@ function init_tempest {
502 502
     local kernel="$image_dir/${base_image_name}-vmlinuz"
503 503
     local ramdisk="$image_dir/${base_image_name}-initrd"
504 504
     local disk_image="$image_dir/${base_image_name}-blank.img"
505
-    # if the cirros uec downloaded and the system is uec capable
506
-    if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a  "$VIRT_DRIVER" != "openvz" \
507
-        -a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then
508
-        echo "Prepare aki/ari/ami Images"
509
-        mkdir -p $BOTO_MATERIALS_PATH
510
-        ( #new namespace
511
-            # tenant:demo ; user: demo
512
-            source $TOP_DIR/accrc/demo/demo
513
-            euca-bundle-image -r ${CIRROS_ARCH} -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH"
514
-            euca-bundle-image -r ${CIRROS_ARCH} -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH"
515
-            euca-bundle-image -r ${CIRROS_ARCH} -i "$disk_image" -d "$BOTO_MATERIALS_PATH"
516
-        ) 2>&1 </dev/null | cat
517
-    else
518
-        echo "Boto materials are not prepared"
505
+    if is_service_enabled nova; then
506
+        # if the cirros uec downloaded and the system is uec capable
507
+        if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a  "$VIRT_DRIVER" != "openvz" \
508
+            -a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then
509
+            echo "Prepare aki/ari/ami Images"
510
+            mkdir -p $BOTO_MATERIALS_PATH
511
+            ( #new namespace
512
+                # tenant:demo ; user: demo
513
+                source $TOP_DIR/accrc/demo/demo
514
+                euca-bundle-image -r ${CIRROS_ARCH} -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH"
515
+                euca-bundle-image -r ${CIRROS_ARCH} -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH"
516
+                euca-bundle-image -r ${CIRROS_ARCH} -i "$disk_image" -d "$BOTO_MATERIALS_PATH"
517
+            ) 2>&1 </dev/null | cat
518
+        else
519
+            echo "Boto materials are not prepared"
520
+        fi
519 521
     fi
520 522
 }
521 523