Skip to content
Snippets Groups Projects
Commit 9c906a17 authored by Mark Goddard's avatar Mark Goddard
Browse files

Wait for volume attachment in CI before detach

In some cases the volume attachment is not finished by the time we
attempt to detach it, causing the following error:

Volume status must be 'in-use' and attach_status must be 'attached' to detach.

This change waits for the volume to be attached before detaching.

Change-Id: Id23d114cf8a2b40f8f0784cbfb84e9fa0829adc0
parent da3cf095
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,17 @@ function test_openstack_logged {
echo "TESTING: Cinder volume attachment"
openstack volume create --size 2 test_volume
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
echo "Volume not attached yet"
attempt=$((attempt+1))
if [[ $attempt -eq 10 ]]; then
echo "Volume failed to attach"
openstack volume show test_volume
return 1
fi
sleep 10
done
openstack server remove volume kolla_boot_test test_volume
echo "SUCCESS: Cinder volume attachment"
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment