Before deleting the instance, check if the instance exists 17/15717/3
authordongwenjuan <dong.wenjuan@zte.com.cn>
Thu, 16 Jun 2016 09:30:41 +0000 (17:30 +0800)
committerdongwenjuan <dong.wenjuan@zte.com.cn>
Fri, 17 Jun 2016 00:38:23 +0000 (08:38 +0800)
The instance may not exist if there is a error before creating
instance or it failed to create, run the `cleanup` to delete the
non-existent instance will raise an error

Change-Id: I13e4b63be952967605093a4427f5b0ac4be280c3
Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
tests/run.sh

index 241d689..a2656aa 100755 (executable)
@@ -226,7 +226,7 @@ cleanup() {
 
     python ./nova_force_down.py "$COMPUTE_HOST" --unset
     sleep 1
-    nova delete "$VM_NAME"
+    nova list | grep -q " $VM_NAME " && nova delete "$VM_NAME"
     sleep 1
     alarm_id=$(ceilometer alarm-list | grep " $ALARM_NAME " | awk '{print $2}')
     sleep 1