Browse code

Select proper flavor_ref_alt for Tempest

Currently if user selects the default instance type for Tempest
tests, some of resize-related tests may fail due to resize attempt
into flavor with smaller disk size. It is because there is just
simple check if flavor_ref and flavor_ref_alt (IDs) aren't the same.
To ensure resize is really possible, there shall be additional
verification introduced.

Co-Authored-By: MichaƂ Madarasz <michal.madarasz@corp.ovh.com>
Change-Id: Iaa1bfa9cb76cbe54be658d2d70d97d99e7fb5be9

Szymon Datko authored on 2019/08/22 22:39:53
Showing 1 changed files
... ...
@@ -130,6 +130,8 @@ function configure_tempest {
130 130
     local available_flavors
131 131
     local flavors_ref
132 132
     local flavor_lines
133
+    local flavor_ref_size
134
+    local flavor_ref_alt_size
133 135
     local public_network_id
134 136
     local public_router_id
135 137
     local ssh_connect_method="floating"
... ...
@@ -233,11 +235,24 @@ function configure_tempest {
233 233
             fi
234 234
             flavor_ref=${flavors[0]}
235 235
             flavor_ref_alt=$flavor_ref
236
+            flavor_ref_size=$(openstack flavor show --format value --column disk "${flavor_ref}")
236 237
 
237 238
             # Ensure ``flavor_ref`` and ``flavor_ref_alt`` have different values.
238 239
             # Some resize instance in tempest tests depends on this.
239 240
             for f in ${flavors[@]:1}; do
240 241
                 if [[ "$f" != "$flavor_ref" ]]; then
242
+                    #
243
+                    # NOTE(sdatko): Resize is only possible when target flavor
244
+                    #               is not smaller than the original one. For
245
+                    #               Tempest tests, in case there was a bigger
246
+                    #               flavor selected as default, e.g. m1.small,
247
+                    #               we need to perform additional check.
248
+                    #
249
+                    flavor_ref_alt_size=$(openstack flavor show --format value --column disk "${f}")
250
+                    if [[ "${flavor_ref_alt_size}" -lt "${flavor_ref_size}" ]]; then
251
+                        continue
252
+                    fi
253
+
241 254
                     flavor_ref_alt=$f
242 255
                     break
243 256
                 fi