|
...
|
...
|
@@ -82,11 +82,11 @@ nova boot --flavor $FLAVOR --image $IMAGE $NAME --security_groups=$SECGROUP
|
|
82
|
82
|
# Waiting for boot
|
|
83
|
83
|
# ----------------
|
|
84
|
84
|
|
|
85
|
|
-# let's give it 5 seconds to launch
|
|
86
|
|
-sleep 5
|
|
87
|
|
-
|
|
88
|
|
-# check that the status is active
|
|
89
|
|
-nova show $NAME | grep status | grep -q ACTIVE
|
|
|
85
|
+# check that the status is active within 10 seconds
|
|
|
86
|
+if ! timeout 10 sh -c "while ! nova show $NAME | grep status | grep -q ACTIVE; do sleep 1; done"; then
|
|
|
87
|
+ echo "server didn't become active!"
|
|
|
88
|
+ exit 1
|
|
|
89
|
+fi
|
|
90
|
90
|
|
|
91
|
91
|
# get the IP of the server
|
|
92
|
92
|
IP=`nova show $NAME | grep "private network" | cut -d"|" -f3`
|
|
...
|
...
|
@@ -121,21 +121,21 @@ FLOATING_IP=`nova floating-ip-list | grep None | head -1 | cut -d '|' -f2 | sed
|
|
121
|
121
|
# add floating ip to our server
|
|
122
|
122
|
nova add-floating-ip $NAME $FLOATING_IP
|
|
123
|
123
|
|
|
124
|
|
-# sleep for a smidge
|
|
125
|
|
-sleep 5
|
|
|
124
|
+# test we can ping our floating ip within 10 seconds
|
|
|
125
|
+if ! timeout 10 sh -c "while ! ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then
|
|
|
126
|
+ echo "Couldn't ping server with floating ip"
|
|
|
127
|
+ exit 1
|
|
|
128
|
+fi
|
|
126
|
129
|
|
|
127
|
|
-# ping our floating ip
|
|
128
|
130
|
ping -c1 -w1 $FLOATING_IP
|
|
129
|
131
|
|
|
130
|
132
|
# dis-allow icmp traffic (ping)
|
|
131
|
133
|
nova secgroup-delete-rule $SECGROUP icmp -1 -1 0.0.0.0/0
|
|
132
|
134
|
|
|
133
|
|
-# sleep for a smidge
|
|
134
|
|
-sleep 5
|
|
135
|
|
-
|
|
136
|
|
-# ping our floating ip
|
|
137
|
|
-if ( ping -c1 -w1 $FLOATING_IP ); then
|
|
|
135
|
+# test we can aren't able to ping our floating ip within 10 seconds
|
|
|
136
|
+if ! timeout 10 sh -c "while ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then
|
|
138
|
137
|
print "Security group failure - ping should not be allowed!"
|
|
|
138
|
+ echo "Couldn't ping server with floating ip"
|
|
139
|
139
|
exit 1
|
|
140
|
140
|
fi
|
|
141
|
141
|
|