tripleo-upgrade/templates/ha-image-update-external-update.sh.j2
Sofer Athlan-Guyot cf0db8ac46 [update] Add ha-image-update external run.
The templates now integrate a test to verify very early if we need
container image's name under pacemaker control need to be modified[1].

When this happen we need to run

    openstack overcloud external-update run --tags ha_image_update

before overcloud update run on the Controller to ensure the control
plane doesn't break during update.

This patch offer the possibility to trigger this command when the
operator know that there will be such change and thus will prevent the
check from[1] to fail the update.

We also collect the log before that stage.

[1] https://review.opendev.org/c/openstack/tripleo-heat-templates/+/861100/
    look for the "Check for update of * container image name" tasks

Change-Id: I685e8ef117a394629b9be4bb6dfa8f6301bf6e89
2023-06-06 12:34:21 +02:00

77 lines
2.1 KiB
Django/Jinja

#!/bin/env bash
set -euo pipefail
{% if l3_agent_connectivity_check|bool %}
if [[ -e {{ working_dir }}/l3_agent_start_ping.sh ]]; then
source {{ overcloud_rc }}
bash {{ working_dir }}/l3_agent_start_ping.sh
fi
{% endif %}
{% if l3_agent_failover_check|bool %}
if [[ -e {{ working_dir }}/l3_agent_failover_pre.sh ]]; then
source {{ overcloud_rc }}
bash {{ working_dir }}/l3_agent_failover_pre.sh
fi
{% endif %}
{% if fip_http_check|bool %}
source {{ overcloud_rc }}
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh ) || :
bash {{ working_dir }}/fip_http_check_start.sh &
{% endif %}
{% if control_plane_check|bool %}
if [[ -e {{ working_dir }}/control_plane_test_start.sh ]]; then
bash {{ working_dir }}/control_plane_test_start.sh
# Give some time for the test to start as it need to download some
# image.
sleep 10
fi
{% endif %}
source {{ undercloud_rc }}
set +o pipefail
EXTERNAL_ANSWER=""
if openstack overcloud external-update run --help | grep -qe "--yes"; then
EXTERNAL_ANSWER="--yes"
fi
set -o pipefail
echo "[$(date)] Started HA image update external update step"
openstack overcloud external-update run ${EXTERNAL_ANSWER} \
--stack {{ overcloud_stack_name }} \
{% if overcloud_ssh_user != '' -%}
--ssh-user {{ overcloud_ssh_user }} \
{% endif -%}
--tags ha_image_update 2>&1
echo "[$(date)] Finished HA image update"
{% if l3_agent_connectivity_check|bool %}
if [[ -e {{ working_dir }}/l3_agent_stop_ping.sh ]]; then
source {{ overcloud_rc }}
bash {{ working_dir }}/l3_agent_stop_ping.sh {{ update_loss_threshold }}
fi
{% endif %}
{% if l3_agent_failover_check|bool %}
if [[ -e {{ working_dir }}/l3_agent_failover_post.sh ]]; then
source {{ overcloud_rc }}
bash {{ working_dir }}/l3_agent_failover_post.sh
fi
{% endif %}
{% if fip_http_check|bool %}
source {{ overcloud_rc }}
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh )
bash {{ working_dir }}/fip_http_check_stop.sh
{% endif %}
{% if control_plane_check|bool %}
if [[ -e {{ working_dir }}/control_plane_test_stop.sh ]]; then
bash {{ working_dir }}/control_plane_test_stop.sh 0 0
fi
{% endif %}