Move ephemeral heat upgrade to the service

Rather than using a new service, we can use the existing HeatEphemeral
service we added to ensure the undercloud is prepared for the overcloud
deployment usage of the ephemeral heat version.  Additionally this will
properly tear down the previous containered heat services once the data
has been extracted from the existing databases.

Change-Id: I13270a4866f9b339cb31ebba223121978e52b499
(cherry picked from commit 4da03adefe)
This commit is contained in:
Alex Schultz 2021-06-22 11:35:56 -06:00 committed by Jose Luis Franco
parent 53f45407fa
commit d36dfedac2
8 changed files with 57 additions and 83 deletions

View File

@ -42,13 +42,19 @@ parameters:
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
OvercloudStackRoleDataFileMap:
default: {}
description: |
Mapping of overcloud stack name, and the absolute path to the
roles data file used when deploying/updating the stack.
For example: {'overcloud': '/home/stack/roles_data.yaml'}
type: json
outputs:
role_data:
description: Role data for the Heat Ephemeral
value:
service_name: heat_ephemeral
upgrade_tasks: []
deploy_steps_tasks:
- name: Tag Ephemeral Heat Containers for Overcloud Deploy
when:
@ -72,3 +78,47 @@ outputs:
vars:
container_image: {get_param: ContainerHeatApiImage}
container_image_latest: "localhost/tripleo/openstack-heat-api:ephemeral"
upgrade_tasks:
- name: Convert to Ephemeral Heat
when:
- step|int == 1
block:
- name: Create /var/lib/tripleo-config/scripts dir
file:
path: /var/lib/tripleo-config/scripts
state: directory
recurse: true
- name: Copy undercloud-upgrade-ephemeral-heat.py to /var/lib/tripleo-config/scripts
copy:
dest: /var/lib/tripleo-config/scripts/undercloud-upgrade-ephemeral-heat.py
content: {get_file: ../../scripts/undercloud-upgrade-ephemeral-heat.py}
mode: 0755
- name: Check if heat engine is still running
shell: systemctl is-active tripleo_heat_engine.service || systemctl is-enabled tripleo_heat_engine.service
failed_when: false
become: true
register: heat_engine_enabled
- name: Store OvercloudStackRoleDataFileMap on file
vars:
role_data_file_map: {get_param: OvercloudStackRoleDataFileMap}
copy:
dest: /var/lib/tripleo-config/overcloud-stack-role-data-file-map.yaml
content: "{{ role_data_file_map | to_nice_yaml }}"
- name: Run undercloud-upgrade-ephemeral-heat.py
shell: /var/lib/tripleo-config/scripts/undercloud-upgrade-ephemeral-heat.py
register: upgrade_ephemeral_result
when:
- heat_engine_enabled.rc is defined
- heat_engine_enabled.rc == 0
- name: Tear down previous Heat containers
include_role:
name: tripleo_container_rm
vars:
tripleo_container_cli: "{{ container_cli }}"
tripleo_containers_to_rm:
- heat_api
- heat_api_cfn
- heat_engine
when:
- upgrade_ephemeral_result.rc is defined
- upgrade_ephemeral_result.rc == 0

View File

@ -1,69 +0,0 @@
heat_template_version: wallaby
description: >
Upgrade an undercloud to use ephemeral Heat
parameters:
ServiceData:
default: {}
description: Dictionary packing service data
type: json
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
type: json
RoleName:
default: ''
description: Role name on which the service is applied
type: string
RoleParameters:
default: {}
description: Parameters specific to the role
type: json
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
OvercloudStackRoleDataFileMap:
default: {}
description: |
Mapping of overcloud stack name, and the absolute path to the
roles data file used when deploying/updating the stack.
For example: {'overcloud': '/home/stack/roles_data.yaml'}
type: json
outputs:
role_data:
description: Role data for the TripleO Undercloud Upgrade Ephemeral Heat service.
value:
service_name: undercloud_upgrade_ephemeral_heat
upgrade_tasks:
- name: Create /var/lib/tripleo-config/scripts dir
file:
path: /var/lib/tripleo-config/scripts
state: directory
recurse: true
when:
- step|int == 1
- name: Copy undercloud-upgrade-ephemeral-heat.py to /var/lib/tripleo-config/scripts
copy:
dest: /var/lib/tripleo-config/scripts/undercloud-upgrade-ephemeral-heat.py
content: {get_file: ../../scripts/undercloud-upgrade-ephemeral-heat.py}
mode: 0755
when:
- step|int == 1
- name: Store OvercloudStackRoleDataFileMap on file
vars:
role_data_file_map: {get_param: OvercloudStackRoleDataFileMap}
copy:
dest: /var/lib/tripleo-config/overcloud-stack-role-data-file-map.yaml
content: "{{ role_data_file_map | to_nice_yaml }}"
when:
- step|int == 1
- name: Run undercloud-upgrade-ephemeral-heat.py
shell: /var/lib/tripleo-config/scripts/undercloud-upgrade-ephemeral-heat.py
when:
- step|int == 1

View File

@ -2,7 +2,6 @@
resource_registry:
OS::TripleO::Services::UndercloudUpgrade: ../../deployment/undercloud/undercloud-upgrade.yaml
OS::TripleO::Services::UndercloudUpgradeEphemeralHeat: ../../deployment/undercloud/undercloud-upgrade-ephemeral-heat.yaml
parameter_defaults:
UndercloudUpgrade: true

View File

@ -227,7 +227,6 @@ resource_registry:
OS::TripleO::Services::MasqueradeNetworks: OS::Heat::None
OS::TripleO::Services::TripleoValidations: OS::Heat::None
OS::TripleO::Services::UndercloudUpgrade: OS::Heat::None
OS::TripleO::Services::UndercloudUpgradeEphemeralHeat: OS::Heat::None
OS::TripleO::Services::Collectd: OS::Heat::None
OS::TripleO::Services::ManilaApi: OS::Heat::None
OS::TripleO::Services::ManilaScheduler: OS::Heat::None

View File

@ -1,8 +1,5 @@
---
features:
- A new service, OS::TripleO::Services::UndercloudUpgradeEphemeralHeat is
added to the Undercloud role. The service is mapped to OS::Heat::None by
default, but when environments/lifecycle/undercloud-upgrade-prepare.yaml is
included, the service will be enabled and will migrate any already deployed
stacks in the undercloud's Heat instance to be able to be used with the
ephemeral Heat deployment option from tripleoclient.
- Added Heat container tear down to the HeatEphemeral service to occur during
upgrades. This will convert an undercloud from non-ephemeral heat to
ephemeral heat when the service is enabled.

View File

@ -95,5 +95,4 @@
- OS::TripleO::Services::TripleoFirewall
- OS::TripleO::Services::Tuned
- OS::TripleO::Services::UndercloudUpgrade
- OS::TripleO::Services::UndercloudUpgradeEphemeralHeat
- OS::TripleO::Services::TripleoValidations

View File

@ -98,5 +98,4 @@
- OS::TripleO::Services::TripleoFirewall
- OS::TripleO::Services::Tuned
- OS::TripleO::Services::UndercloudUpgrade
- OS::TripleO::Services::UndercloudUpgradeEphemeralHeat
- OS::TripleO::Services::TripleoValidations

View File

@ -354,9 +354,9 @@ def main():
_heatclient = Client('1', endpoint=conn.endpoint_for('orchestration'),
token=conn.auth_token)
except keystoneauth1.exceptions.catalog.EndpointNotFound:
LOG.warning("No Heat endpoint found, won't migrate any "
"existing stack data.")
return
LOG.error("No Heat endpoint found, won't migrate any "
"existing stack data.")
raise
try:
stacks = args.stack or [s.name for s in heat.stacks()]