Merge "Wait for compute service to check in" into stable/pike

This commit is contained in:
Jenkins 2017-09-06 22:19:25 +00:00 committed by Gerrit Code Review
commit b50217fa58
3 changed files with 49 additions and 0 deletions

View File

@ -407,6 +407,26 @@ EOF
return $rval
}
function wait_for_compute {
local timeout=$1
local rval=0
time_start "wait_for_service"
timeout $timeout bash -x <<EOF || rval=$?
ID=""
while [[ "\$ID" == "" ]]; do
sleep 1
ID=\$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list --host `hostname` --service nova-compute -c ID -f value)
done
EOF
time_stop "wait_for_service"
# Figure out what's happening on platforms where this doesn't work
if [[ "$rval" != 0 ]]; then
echo "Didn't find service registered by hostname after $timeout seconds"
openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list
fi
return $rval
}
# ping check
# Uses globals ``ENABLED_SERVICES``, ``TOP_DIR``, ``MULTI_HOST``, ``PRIVATE_NETWORK``

View File

@ -944,6 +944,28 @@ function start_nova_conductor {
done
}
function is_nova_ready {
# NOTE(sdague): with cells v2 all the compute services must be up
# and checked into the database before discover_hosts is run. This
# happens in all in one installs by accident, because > 30 seconds
# happen between here and the script ending. However, in multinode
# tests this can very often not be the case. So ensure that the
# compute is up before we move on.
if is_service_enabled n-cell; then
# cells v1 can't complete the check below because it munges
# hostnames with cell information (grumble grumble).
return
fi
# TODO(sdague): honestly, this probably should be a plug point for
# an external system.
if [[ "$VIRT_DRIVER" == 'xenserver' ]]; then
# xenserver encodes information in the hostname of the compute
# because of the dom0/domU split. Just ignore for now.
return
fi
wait_for_compute 60
}
function start_nova {
# this catches the cells v1 case early
_set_singleconductor

View File

@ -1431,6 +1431,13 @@ fi
# Sanity checks
# =============
# Check that computes are all ready
#
# TODO(sdague): there should be some generic phase here.
if is_service_enabled n-cpu; then
is_nova_ready
fi
# Check the status of running services
service_check