Wait for compute service to check in

With cell v2, on initial bring up, discover hosts can't run unless all
the compute nodes have checked in. The documentation says that you
should run ``nova service-list --binary nova-compute`` and see all
your hosts before running discover hosts. This isn't really viable in
a multinode devstack because of how things are brought up in parts.

We can however know that stack.sh will not complete before the compute
node is up by waiting for the compute node to check in before moving
forward. This puts a few more seconds into the run, but ensures
everything is solid in multinode environments.

Change-Id: I667e6a9be3fee8bb5bfd73426eef567489e3d88d
This commit is contained in:
Sean Dague 2017-07-25 19:51:08 -04:00
parent 331b3de88e
commit dcdf8c8e60
2 changed files with 21 additions and 0 deletions

View File

@ -407,6 +407,20 @@ EOF
return $rval
}
function wait_for_compute {
local timeout=$1
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"
return $rval
}
# ping check
# Uses globals ``ENABLED_SERVICES``, ``TOP_DIR``, ``MULTI_HOST``, ``PRIVATE_NETWORK``

View File

@ -795,6 +795,13 @@ function start_nova_compute {
fi
run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf"
fi
# 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.
wait_for_compute 60
export PATH=$old_path
}