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
This commit is contained in:
parent
da3cf0958e
commit
9c906a175b
@ -28,6 +28,17 @@ function test_openstack_logged {
|
|||||||
echo "TESTING: Cinder volume attachment"
|
echo "TESTING: Cinder volume attachment"
|
||||||
openstack volume create --size 2 test_volume
|
openstack volume create --size 2 test_volume
|
||||||
openstack server add volume kolla_boot_test test_volume --device /dev/vdb
|
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
|
openstack server remove volume kolla_boot_test test_volume
|
||||||
echo "SUCCESS: Cinder volume attachment"
|
echo "SUCCESS: Cinder volume attachment"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user