Skip to content

Commit c122661

Browse files
committed
CI: Test Nova server resize functionality
This adds an extra resize operation to core OpenStack tests. This should be fast since we are only increasing the number of cores of the VM and could help catch additional errors in CI tests. Change-Id: Ia61b995dbffcda4f1e6494548df457231cb67bd7 (cherry picked from commit f86ed02)
1 parent 09ca4bd commit c122661

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

tests/test-core-openstack.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,40 @@ function create_instance {
228228
done
229229
}
230230

231+
function resize_instance {
232+
local name=$1
233+
234+
# TODO(priteau): Remove once previous_release includes m2.tiny in
235+
# init-runonce
236+
if ! openstack flavor list -f value | grep m2.tiny; then
237+
openstack flavor create --id 6 --ram 512 --disk 1 --vcpus 2 m2.tiny
238+
fi
239+
240+
openstack server resize --flavor m2.tiny --wait ${name}
241+
# If the status is not VERIFY_RESIZE, print info and exit 1
242+
if [[ $(openstack server show ${name} -f value -c status) != "VERIFY_RESIZE" ]]; then
243+
echo "FAILED: Instance is not resized"
244+
openstack --debug server show ${name}
245+
return 1
246+
fi
247+
248+
openstack server resize confirm ${name}
249+
250+
# Confirming the resize operation is not instantaneous. Wait for change to
251+
# be reflected in server status.
252+
attempt=1
253+
while [[ $(openstack server show ${name} -f value -c status) != "ACTIVE" ]]; do
254+
echo "Instance is not active yet"
255+
attempt=$((attempt+1))
256+
if [[ $attempt -eq 5 ]]; then
257+
echo "FAILED: Instance failed to become active after resize confirm"
258+
openstack --debug server show ${name}
259+
return 1
260+
fi
261+
sleep 1
262+
done
263+
}
264+
231265
function delete_instance {
232266
local name=$1
233267
openstack server delete --wait ${name}
@@ -397,6 +431,10 @@ function test_instance_boot {
397431
echo "SUCCESS: Floating ip deallocation"
398432
fi
399433

434+
echo "TESTING: Server resize"
435+
resize_instance kolla_boot_test
436+
echo "SUCCESS: Server resize"
437+
400438
echo "TESTING: Server deletion"
401439
delete_instance kolla_boot_test
402440
echo "SUCCESS: Server deletion"

tools/init-runonce

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ if ! $KOLLA_OPENSTACK_COMMAND flavor list | grep -q m1.tiny; then
176176
$KOLLA_OPENSTACK_COMMAND flavor create --id 3 --ram 4096 --disk 40 --vcpus 2 m1.medium
177177
$KOLLA_OPENSTACK_COMMAND flavor create --id 4 --ram 8192 --disk 80 --vcpus 4 m1.large
178178
$KOLLA_OPENSTACK_COMMAND flavor create --id 5 --ram 16384 --disk 160 --vcpus 8 m1.xlarge
179+
$KOLLA_OPENSTACK_COMMAND flavor create --id 6 --ram 512 --disk 1 --vcpus 2 m2.tiny
179180
fi
180181

181182
cat << EOF

0 commit comments

Comments
 (0)