From 5a189baf2f99032a0c28992fa47e372d5291c2d2 Mon Sep 17 00:00:00 2001
From: dongwenjuan <dong.wenjuan@zte.com.cn>
Date: Tue, 12 Jul 2016 10:21:51 +0800
Subject: [PATCH] check host status before deleting doctor project

In `cleanup` function, we can't delete doctor project and doctor user
before checking host status. Because we use API to get the `host status`
under the doctor project.

Change-Id: I38c0929eeff9378051e0dcda308734ab7b353509
Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
---
 tests/run.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/run.sh b/tests/run.sh
index b383a02a..3e2fbab5 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -269,8 +269,14 @@ cleanup() {
     stop_inspector
     stop_consumer
 
+    echo "waiting disabled compute host back to be enabled..."
     python ./nova_force_down.py "$COMPUTE_HOST" --unset
+    sleep 180
+    check_host_status "UP"
+    ssh $ssh_opts_cpu "$COMPUTE_USER@$COMPUTE_IP" \
+        "[ -e disable_network.log ] && cat disable_network.log"
     sleep 1
+
     (
         change_to_doctor_user
         openstack server list | grep -q " $VM_NAME " && openstack server delete "$VM_NAME"
@@ -287,12 +293,6 @@ cleanup() {
                               --project "$DOCTOR_PROJECT"
     openstack project delete "$DOCTOR_PROJECT"
     openstack user delete "$DOCTOR_USER"
-
-    echo "waiting disabled compute host back to be enabled..."
-    sleep 180
-    check_host_status "UP"
-    ssh $ssh_opts_cpu "$COMPUTE_USER@$COMPUTE_IP" \
-        "[ -e disable_network.log ] && cat disable_network.log"
 }
 
 
-- 
2.16.6