Browse code

Merge "Wait for compute service to check in"

Jenkins authored on 2017/07/28 04:01:00
Showing 2 changed files
... ...
@@ -407,6 +407,20 @@ EOF
407 407
     return $rval
408 408
 }
409 409
 
410
+function wait_for_compute {
411
+    local timeout=$1
412
+    time_start "wait_for_service"
413
+    timeout $timeout bash -x <<EOF || rval=$?
414
+        ID=""
415
+        while [[ "\$ID" == "" ]]; do
416
+            sleep 1
417
+            ID=\$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list --host `hostname` --service nova-compute -c ID -f value)
418
+        done
419
+EOF
420
+    time_stop "wait_for_service"
421
+    return $rval
422
+}
423
+
410 424
 
411 425
 # ping check
412 426
 # Uses globals ``ENABLED_SERVICES``, ``TOP_DIR``, ``MULTI_HOST``, ``PRIVATE_NETWORK``
... ...
@@ -854,6 +854,13 @@ function start_nova_compute {
854 854
         fi
855 855
         run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF"
856 856
     fi
857
+    # NOTE(sdague): with cells v2 all the compute services must be up
858
+    # and checked into the database before discover_hosts is run. This
859
+    # happens in all in one installs by accident, because > 30 seconds
860
+    # happen between here and the script ending. However, in multinode
861
+    # tests this can very often not be the case. So ensure that the
862
+    # compute is up before we move on.
863
+    wait_for_compute 60
857 864
 
858 865
     export PATH=$old_path
859 866
 }