Merge "Adds post_upgrade_tasks for any service post-upgrade ansible tasks"

This commit is contained in:
Jenkins 2017-09-20 11:16:26 +00:00 committed by Gerrit Code Review
commit 52e1a0c943
5 changed files with 69 additions and 16 deletions

View File

@ -187,6 +187,43 @@ resources:
role_data: {get_param: role_data} role_data: {get_param: role_data}
ctlplane_service_ips: {get_param: ctlplane_service_ips} ctlplane_service_ips: {get_param: ctlplane_service_ips}
{%- for step in range(0, upgrade_steps_max) %}
{%- for role in roles %}
{{role.name}}PostUpgradeConfig_Config{{step}}:
type: OS::TripleO::UpgradeConfig
depends_on:
{%- for role_inside in enabled_roles %}
{%- if step > 0 %}
- {{role_inside.name}}PostUpgradeConfig_Deployment{{step -1}}
{%- else %}
- AllNodesPostUpgradeSteps
{%- endif %}
{%- endfor %}
properties:
UpgradeStepConfig: {get_param: [role_data, {{role.name}}, post_upgrade_tasks]}
step: {{step}}
{%- endfor %}
{%- for role in enabled_roles %}
{{role.name}}PostUpgradeConfig_Deployment{{step}}:
type: OS::Heat::SoftwareDeploymentGroup
depends_on:
{%- for role_inside in enabled_roles %}
{%- if step > 0 %}
- {{role_inside.name}}PostUpgradeConfig_Deployment{{step -1}}
{%- else %}
- AllNodesPostUpgradeSteps
{%- endif %}
{%- endfor %}
properties:
servers: {get_param: [servers, {{role.name}}]}
config: {get_resource: {{role.name}}PostUpgradeConfig_Config{{step}}}
input_values:
role: {{role.name}}
update_identifier: {get_param: UpdateIdentifier}
{%- endfor %}
{%- endfor %}
outputs: outputs:
# Output the config for each role, just use Step1 as the config should be # Output the config for each role, just use Step1 as the config should be
# the same for all steps (only the tag provided differs) # the same for all steps (only the tag provided differs)

View File

@ -193,6 +193,16 @@ resources:
expression: coalesce($.data, []).where($ != null).select($.get('upgrade_tasks')).where($ != null).flatten().distinct() expression: coalesce($.data, []).where($ != null).select($.get('upgrade_tasks')).where($ != null).flatten().distinct()
data: {get_attr: [ServiceChain, role_data]} data: {get_attr: [ServiceChain, role_data]}
PostUpgradeTasks:
type: OS::Heat::Value
properties:
type: comma_delimited_list
value:
yaql:
# Note we use distinct() here to filter any identical tasks, e.g yum update for all services
expression: coalesce($.data, []).where($ != null).select($.get('post_upgrade_tasks')).where($ != null).flatten().distinct()
data: {get_attr: [ServiceChain, role_data]}
UpdateTasks: UpdateTasks:
type: OS::Heat::Value type: OS::Heat::Value
properties: properties:
@ -263,6 +273,7 @@ outputs:
workflow_tasks: {get_attr: [WorkflowTasks, value]} workflow_tasks: {get_attr: [WorkflowTasks, value]}
step_config: {get_attr: [PuppetStepConfig, value]} step_config: {get_attr: [PuppetStepConfig, value]}
upgrade_tasks: {get_attr: [UpgradeTasks, value]} upgrade_tasks: {get_attr: [UpgradeTasks, value]}
post_upgrade_tasks: {get_attr: [PostUpgradeTasks, value]}
update_tasks: {get_attr: [UpdateTasks, value]} update_tasks: {get_attr: [UpdateTasks, value]}
upgrade_batch_tasks: {get_attr: [UpgradeBatchTasks, value]} upgrade_batch_tasks: {get_attr: [UpgradeBatchTasks, value]}
service_metadata_settings: {get_attr: [ServiceServerMetadataHook, metadata]} service_metadata_settings: {get_attr: [ServiceServerMetadataHook, metadata]}

View File

@ -66,16 +66,9 @@ outputs:
resource: openstack-cinder-volume resource: openstack-cinder-volume
state: disable state: disable
wait_for_resource: true wait_for_resource: true
- name: get bootstrap nodeid post_upgrade_tasks:
tags: step5 - name: Start cinder_volume service (pacemaker)
command: hiera bootstrap_nodeid tags: step1
register: bootstrap_node pacemaker_resource:
- block: resource: openstack-cinder-volume
- name: Sync cinder DB state: enable
command: cinder-manage db sync
- name: Start cinder_volume service (pacemaker)
pacemaker_resource:
resource: openstack-cinder-volume
state: enable
tags: step5
when: bootstrap_node.stdout == ansible_hostname

View File

@ -0,0 +1,12 @@
---
upgrade:
- |
This adds post_upgrade_tasks, ansible tasks that can be added to any
service manifest (currently, pacemaker/cinder-volume for bug 1706951).
These are similar to the existing upgrade_tasks in their format, however
they will be executed *after* the docker/puppet config. So the order is
upgrade_tasks, deployment steps (docker/puppet), then post_upgrade_tasks.
Also like the upgrade_tasks these are serialised and you can use 'tags'
with 'step0' to 'step6' (more can be added if needed).

View File

@ -44,9 +44,9 @@ OPTIONAL_SECTIONS = ['workflow_tasks']
REQUIRED_DOCKER_SECTIONS = ['service_name', 'docker_config', 'puppet_config', REQUIRED_DOCKER_SECTIONS = ['service_name', 'docker_config', 'puppet_config',
'config_settings', 'step_config'] 'config_settings', 'step_config']
OPTIONAL_DOCKER_SECTIONS = ['docker_puppet_tasks', 'upgrade_tasks', OPTIONAL_DOCKER_SECTIONS = ['docker_puppet_tasks', 'upgrade_tasks',
'service_config_settings', 'host_prep_tasks', 'post_upgrade_tasks', 'service_config_settings',
'metadata_settings', 'kolla_config', 'host_prep_tasks', 'metadata_settings',
'global_config_settings'] 'kolla_config', 'global_config_settings']
REQUIRED_DOCKER_PUPPET_CONFIG_SECTIONS = ['config_volume', 'step_config', REQUIRED_DOCKER_PUPPET_CONFIG_SECTIONS = ['config_volume', 'step_config',
'config_image'] 'config_image']
OPTIONAL_DOCKER_PUPPET_CONFIG_SECTIONS = [ 'puppet_tags', 'volumes' ] OPTIONAL_DOCKER_PUPPET_CONFIG_SECTIONS = [ 'puppet_tags', 'volumes' ]