Don't wait on ERROR VM state
Detect ERROR state and exit immediately rather than waiting timeout.
Change-Id: Ib20d03b73123e1390fffcd14fd373c93342bb9d8
(cherry picked from commit d1888ac7cf
)
This commit is contained in:
parent
f3568aa2a5
commit
2682c9ae2c
@ -180,15 +180,20 @@ openstack server create \
|
|||||||
timeout_seconds=120
|
timeout_seconds=120
|
||||||
elapsed_seconds=0
|
elapsed_seconds=0
|
||||||
while true; do
|
while true; do
|
||||||
INSTANCE_ACTIVE=$(openstack server show ${INSTANCE_NAME} -f json | jq -r '.status')
|
INSTANCE_STATUS=$(openstack server show ${INSTANCE_NAME} -f json | jq -r '.status')
|
||||||
if [ "${INSTANCE_ACTIVE}" == "ACTIVE" ]; then
|
case "${INSTANCE_STATUS}" in
|
||||||
|
"ACTIVE")
|
||||||
echo "${INSTANCE_NAME} reached 'ACTIVE' status"
|
echo "${INSTANCE_NAME} reached 'ACTIVE' status"
|
||||||
break
|
break
|
||||||
fi
|
;;
|
||||||
|
"ERROR")
|
||||||
|
echo "${INSTANCE_NAME} failed"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
sleep 3
|
sleep 3
|
||||||
elapsed_seconds=$(expr $elapsed_seconds + 3)
|
elapsed_seconds=$(expr $elapsed_seconds + 3)
|
||||||
if [ $elapsed_seconds -ge $timeout_seconds ]; then
|
if [ $elapsed_seconds -ge $timeout_seconds ]; then
|
||||||
echo "FAILURE: Instance failed to boot."
|
echo "FAILURE: Instance failed to boot within ${elapsed_seconds} seconds"
|
||||||
openstack server show ${INSTANCE_NAME} -f json 2>&1
|
openstack server show ${INSTANCE_NAME} -f json 2>&1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user