This patch waits for instance termination to complete before trying to
delete the security group. The last change to simply move the security
group deletion to after euca-terminate-instance was not sufficient, as
it has to wait until the termination is complete.
Change-Id: Icba579534f324afb4d44abd42d8c755834dd2a57
| ... | ... |
@@ -95,5 +95,11 @@ fi |
| 95 | 95 |
# Terminate instance |
| 96 | 96 |
euca-terminate-instances $INSTANCE |
| 97 | 97 |
|
| 98 |
+# Assure it has terminated within a reasonable time |
|
| 99 |
+if ! timeout $TERMINATE_TIMEOUT sh -c "while euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then |
|
| 100 |
+ echo "server didn't terminate within $TERMINATE_TIMEOUT seconds" |
|
| 101 |
+ exit 1 |
|
| 102 |
+fi |
|
| 103 |
+ |
|
| 98 | 104 |
# Delete group |
| 99 | 105 |
euca-delete-group $SECGROUP |
| ... | ... |
@@ -89,3 +89,6 @@ export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))}
|
| 89 | 89 |
|
| 90 | 90 |
# Max time to wait for proper IP association and dis-association. |
| 91 | 91 |
export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
|
| 92 |
+ |
|
| 93 |
+# Max time to wait for a vm to terminate |
|
| 94 |
+export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30}
|