From 001513f4234ab681d33c9d1f3cd97a005b338df9 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Tue, 16 Feb 2016 11:53:16 +0100 Subject: [PATCH] [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 --- devstack/lib/ironic | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/devstack/lib/ironic b/devstack/lib/ironic index 172048b860..d8ab63893c 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -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