Allow defaults for Image/Flavor/RoleParameters in roles_data.yaml

This allows specific roles, e.g ComputeRealTime to specify defaults
where the services are the same as some existing roles but a different
image and/or configuration are needed.

Inspired by discussion of this requirement in:
  https://review.openstack.org/#/c/531739/

RoleParametersDefaults is merged with the user provided parameters
with precendence to user parameters, as this is a special parameter,
which contains a map of the actual parameters to be applied to a
role.

Partially Implements: blueprint tripleo-realtime
Change-Id: I6497144340d3b9276e6ed141d3bc655bfbbeb53c
This commit is contained in:
Steven Hardy 2018-01-10 09:20:14 +00:00 committed by Saravanan KR
parent ee371478d7
commit d006711426
3 changed files with 21 additions and 5 deletions

View File

@ -386,7 +386,10 @@ resources:
EndpointMap: {get_attr: [EndpointMapData, value]}
DefaultPasswords: {get_attr: [DefaultPasswords, passwords]}
RoleName: {{role.name}}
RoleParameters: {get_param: {{role.name}}Parameters}
RoleParameters:
map_merge:
- {{role.RoleParametersDefault|default({})}}
- get_param: {{role.name}}Parameters
# Lookup of role_data via heat outputs is slow, so workaround this by caching
# the value in an OS::Heat::Value resource
@ -564,7 +567,10 @@ resources:
LoggingGroups: {get_attr: [{{role.name}}ServiceChainRoleData, value, logging_groups]}
ServiceMetadataSettings: {get_attr: [{{role.name}}ServiceChainRoleData, value, service_metadata_settings]}
DeploymentServerBlacklistDict: {get_attr: [DeploymentServerBlacklistDict, value]}
RoleParameters: {get_param: {{role.name}}Parameters}
RoleParameters:
map_merge:
- {{role.RoleParametersDefault|default({})}}
- get_param: {{role.name}}Parameters
{% endfor %}
{% for role in roles %}

View File

@ -5,7 +5,7 @@
heat_template_version: queens
description: 'OpenStack {{role.name}} node configured by Puppet'
parameters:
{%- set default_flavor_name = 'baremetal' %}
{%- set default_flavor_name = role.FlavorDefault|default('baremetal') %}
{%- if role.deprecated_param_flavor is defined %}
{{role.deprecated_param_flavor}}:
description: DEPRECATED Use Overcloud{{role.name}}Flavor instead.
@ -20,7 +20,7 @@ parameters:
constraints:
- custom_constraint: nova.flavor
{%- endif %}
{%- set default_image_name = 'overcloud-full' %}
{%- set default_image_name = role.ImageDefault|default('overcloud-full') %}
{%- if role.deprecated_param_image is defined %}
{{role.deprecated_param_image}}:
type: string
@ -294,7 +294,7 @@ resources:
get_param: {{role.name}}Image
{%- endif %}
image_update_policy: {get_param: ImageUpdatePolicy}
flavor:
flavor:
{%- if role.deprecated_param_flavor is defined %}
if:
- deprecated_param_flavor_set

View File

@ -34,6 +34,16 @@ Role Options
defaults to '%stackname%-{{role.name.lower()}}-%index%'
sets the default for {{role.name}}HostnameFormat parameter in overcloud.yaml
* ImageDefault: (string) optional default image name or ID, defaults to
overcloud-full
* FlavorDefault: (string) optional default flavor name or ID, defaults to
baremetal
* RoleParametersDefault: (map) optional default to the per-role RoleParameters
value, this enables roles to specify specific values appropriate to their
configuration, defaults to an empty map.
* disable_constraints: (boolean) optional, whether to disable Nova and Glance
constraints for each role specified in the templates.