tripleo-upgrade/templates/overcloud_upgrade_run.sh.j2
Jose Luis Franco Arza 9e23fa6cdb Enable system upgrade and upgrade run per host.
Allow the execution of the overcloud upgrade steps by hosts
withing the Overcloud roles. After this patch is merged, the hosts
contained in the ovecloud roles (Controllers, Computes, Storage, etc...)
will be taken serially to apply the upgrade host by host.

For each of the hosts within these roles we'll execute the following
steps:

1- Pre overcloud system upgrade workarounds (Workaround executed in the
   host via Ansible with --limit)
2a- Overcloud system upgrade prepare + overcloud system upgrade run (if
   system_upgrade_compact == false)
2b- Overcloud system upgrade (if system_upgrade_compact == true)[Default]
3- Overcloud system upgrade transfer (if role == Controller and
   host == first)
4- Post overcloud system upgrade workaronuds (Workaround executed in the
   host via Ansible with --limit)
5- Pre overcloud upgrade run workarounds (Workaround executed in the
   host via Ansible with --limit)
6- Overcloud upgrade run
7- Post overcloud upgrade run workarounds (Workaround executed in the
   host via Ansible with --limit)

These sets of steps will be executed for all the hosts belonging to the
Overcloud Ansible group.

Change-Id: Ia13f479d58979561fca1c274ac7dde5dc8c2343a
2019-09-18 14:49:06 +02:00

138 lines
4.0 KiB
Django/Jinja

#!/bin/env bash
#
# Run major upgrade on overcloud nodes
#
set -euo pipefail
{# Elements will contain all the hosts in oc_roles_hosts for the
role under loop from the first element of the list to the element in the item
variable. Example:
oc_roles_hosts = { 'Controller': ['controller-0', 'controller-1', 'controller-2',
'Compute' : ['compute-0'] }
If role = 'Controller' and item = 'controller-1'
elements = ['controller-0', 'controller-1']
#}
{% set elements = oc_roles_hosts[role][0:oc_roles_hosts[role].index(item)+1] %}
{% if overcloud_upgrade_multibooks|bool %}
{%- for playbook in overcloud_upgrade_playbooks -%}
{% 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 %}
source {{ undercloud_rc }}
echo "[$(date)] Running major upgrade {{ playbook }} playbook for {{ elements }} role"
openstack overcloud upgrade run \
--stack {{ overcloud_stack_name }} \
{% if tripleo_upgrade_debug|bool -%}
--debug \
{% endif -%}
--limit {{ elements | join(',') }} --playbook {{ playbook }} 2>&1
echo "[$(date)] Finished major upgrade {{ playbook }} playbook for {{ elements }} role"
{%- endfor %}
{# validation scripts should run after all playbooks are finished #}
{% 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
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 launch_sanity_workload|bool %}
bash {{ working_dir }}/workload_launch.sh 'sanity'
{% endif %}
{# finished overcloud_upgrade_multibooks section #}
{% else %}
{% 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 %}
source {{ undercloud_rc }}
echo "[$(date)] Running major upgrade for {{ elements }} hosts"
openstack overcloud upgrade run \
--stack {{ overcloud_stack_name }} \
{% if tripleo_upgrade_debug|bool %}
--debug \
{% endif -%}
--limit {{ elements | join(',') }} --playbook all 2>&1
echo "[$(date)] Finished major upgrade for {{ elements }} hosts"
{% 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
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 launch_sanity_workload|bool %}
bash {{ working_dir }}/workload_launch.sh 'sanity'
{% endif %}
{% endif %}