Wait for cinder volume to become available in CI

Fixes a race condition where sometimes a volume would still be in the
'creating' state when trying to attach it to a server.

Invalid volume: Volume <id> status must be available or downloading to
reserve, but the current status is creating.

Change-Id: I0687ddfd78c384650cb361ff07aa64c5c3806a93
This commit is contained in:
Mark Goddard 2019-03-21 17:33:23 +00:00
parent 5841ec7851
commit e956cd87c8
1 changed files with 11 additions and 0 deletions

View File

@ -27,6 +27,17 @@ function test_openstack_logged {
if [[ $ACTION = "ceph" ]] || [[ $ACTION == "cinder-lvm" ]]; then
echo "TESTING: Cinder volume attachment"
openstack volume create --size 2 test_volume
attempt=1
while [[ $(openstack volume show test_volume -f value -c status) != "available" ]]; do
echo "Volume not available yet"
attempt=$((attempt+1))
if [[ $attempt -eq 10 ]]; then
echo "Volume failed to become available"
openstack volume show test_volume
return 1
fi
sleep 10
done
openstack server add volume kolla_boot_test test_volume --device /dev/vdb
attempt=1
while [[ $(openstack volume show test_volume -f value -c status) != "in-use" ]]; do