[DevStack] fix restart of nova compute

We introduced nova compute restart to handle problems of it failure
to start when keystone is not available. However, now we get broken
again because stop_service fails when nova compute is not running.
This change makes it ignore failure to stop nova compute.

Also, if n-cpu failed to start the first time, the n-cpu.failure file
that
was created will fail the service_check function in the end
of the deployment, although n-cpu might be in fact up, running and
healthy.

Rename this file to `n-cpu.failure.before-restart-by-ironic` right after
stopping n-cpu so that it does not fail service_check later, but is
still
available for reference if needed.

Change-Id: Idfe7d68d6ebeb786fe9e6da6a001a0ee2e10a76b
Closes-Bug: #1546058
Related-Bug: #1537076
This commit is contained in:
Dmitry Tantsur 2016-02-16 11:53:16 +01:00 committed by Pavlo Shchelokovskyy
parent 6d8768e87c
commit 001513f423
1 changed files with 13 additions and 1 deletions

View File

@ -619,6 +619,15 @@ function wait_for_nova_resources {
die $LINENO "Timed out waiting for Nova hypervisor-stats $resource >= $expected_count"
}
function _clean_ncpu_failure {
SCREEN_NAME=${SCREEN_NAME:-stack}
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
n_cpu_failure="$SERVICE_DIR/$SCREEN_NAME/n-cpu.failure"
if [ -f ${n_cpu_failure} ]; then
mv ${n_cpu_failure} "${n_cpu_failure}.before-restart-by-ironic"
fi
}
function enroll_nodes {
local chassis_id
chassis_id=$(ironic chassis-create -d "ironic test chassis" | grep " uuid " | get_field 2)
@ -707,7 +716,10 @@ function enroll_nodes {
# NOTE(dtantsur): sometimes nova compute fails to start with ironic due
# to keystone restarting and not being able to authenticate us.
# Restart it just to be sure (and avoid gate problems like bug 1537076)
stop_nova_compute
stop_nova_compute || /bin/true
# NOTE(pas-ha) if nova compute failed before restart, .failure file
# that was created will fail the service_check in the end of the deployment
_clean_ncpu_failure
start_nova_compute
wait_for_nova_resources "count" $total_nodes
wait_for_nova_resources "vcpus" $total_cpus