| ... | ... |
@@ -82,8 +82,8 @@ nova boot --flavor $FLAVOR --image $IMAGE $NAME --security_groups=$SECGROUP |
| 82 | 82 |
# Waiting for boot |
| 83 | 83 |
# ---------------- |
| 84 | 84 |
|
| 85 |
-# let's give it 10 seconds to launch |
|
| 86 |
-sleep 10 |
|
| 85 |
+# let's give it 5 seconds to launch |
|
| 86 |
+sleep 5 |
|
| 87 | 87 |
|
| 88 | 88 |
# check that the status is active |
| 89 | 89 |
nova show $NAME | grep status | grep -q ACTIVE |
| ... | ... |
@@ -94,14 +94,13 @@ IP=`nova show $NAME | grep "private network" | cut -d"|" -f3` |
| 94 | 94 |
# for single node deployments, we can ping private ips |
| 95 | 95 |
MULTI_HOST=${MULTI_HOST:-0}
|
| 96 | 96 |
if [ "$MULTI_HOST" = "0" ]; then |
| 97 |
- # ping it once (timeout of a second) |
|
| 98 |
- ping -c1 -w1 $IP || true |
|
| 99 |
- |
|
| 100 | 97 |
# sometimes the first ping fails (10 seconds isn't enough time for the VM's |
| 101 |
- # network to respond?), so let's wait 5 seconds and really test ping |
|
| 102 |
- sleep 5 |
|
| 103 |
- |
|
| 104 |
- ping -c1 -w1 $IP |
|
| 98 |
+ # network to respond?), so let's for 15 seconds pinging with a timeout |
|
| 99 |
+ # of a second. |
|
| 100 |
+ if ! timeout 15 sh -c "while ! ping -c1 -w1 $IP; do sleep 1; done"; then |
|
| 101 |
+ echo "Couldn't ping server" |
|
| 102 |
+ exit 1 |
|
| 103 |
+ fi |
|
| 105 | 104 |
fi |
| 106 | 105 |
|
| 107 | 106 |
# Security Groups & Floating IPs |