Modifying Cisco templates to support composable roles

Change-Id: I21fee832aeeb9780f818ae869ea8714f28bbe4a0
Closes-bug:  #1704853
(cherry picked from commit 605ad6f65d)
This commit is contained in:
Sandhya Dasu 2017-07-25 13:20:17 -04:00
parent ac5513dc22
commit eeaa235111
1 changed files with 14 additions and 50 deletions

View File

@ -174,45 +174,15 @@ resources:
echo "$HOST_FQDN $MACS"
fi
CollectMacDeploymentsController:
{% for role in roles %}
CollectMacDeployments{{role.name}}:
type: OS::Heat::SoftwareDeployments
properties:
name: CollectMacDeploymentsController
servers: {get_param: [servers, Controller]}
config: {get_resource: CollectMacConfig}
actions: ['CREATE'] # Only do this on CREATE
CollectMacDeploymentsCompute:
type: OS::Heat::SoftwareDeployments
properties:
name: CollectMacDeploymentsCompute
servers: {get_param: [servers, Compute]}
config: {get_resource: CollectMacConfig}
actions: ['CREATE'] # Only do this on CREATE
CollectMacDeploymentsBlockStorage:
type: OS::Heat::SoftwareDeployments
properties:
name: CollectMacDeploymentsBlockStorage
servers: {get_param: [servers, BlockStorage]}
config: {get_resource: CollectMacConfig}
actions: ['CREATE'] # Only do this on CREATE
CollectMacDeploymentsObjectStorage:
type: OS::Heat::SoftwareDeployments
properties:
name: CollectMacDeploymentsObjectStorage
servers: {get_param: [servers, ObjectStorage]}
config: {get_resource: CollectMacConfig}
actions: ['CREATE'] # Only do this on CREATE
CollectMacDeploymentsCephStorage:
type: OS::Heat::SoftwareDeployments
properties:
name: CollectMacDeploymentsCephStorage
servers: {get_param: [servers, CephStorage]}
name: CollectMacDeployments{{role.name}}
servers: {get_param: [servers, {{role.name}}]}
config: {get_resource: CollectMacConfig}
actions: ['CREATE'] # Only do this on CREATE
{% endfor %}
# Now we calculate the additional nexus config based on the mappings
MappingToNexusConfig:
@ -220,11 +190,9 @@ resources:
properties:
group: script
inputs:
- name: controller_mappings
- name: compute_mappings
- name: blockstorage_mappings
- name: objectstorage_mappings
- name: cephstorage_mappings
{%- for role in roles %}
- name: {{role.name}}_mappings
{%- endfor %}
- name: nexus_config
config: |
#!/bin/python
@ -233,11 +201,9 @@ resources:
import os
from copy import deepcopy
mappings = ['controller_mappings',
'compute_mappings',
'blockstorage_mappings',
'objectstorage_mappings',
'cephstorage_mappings',
mappings = [{%- for role in roles %}
'{{role.name}}_mappings',
{%- endfor %}
'nexus_config']
mapdict_list = []
nexus = {}
@ -295,11 +261,9 @@ resources:
# FIXME(shardy): It'd be more convenient if we could join these
# items together but because the returned format is a map (not a list)
# we can't use list_join or str_replace. Possible Heat TODO.
controller_mappings: {get_attr: [CollectMacDeploymentsController, deploy_stdouts]}
compute_mappings: {get_attr: [CollectMacDeploymentsCompute, deploy_stdouts]}
blockstorage_mappings: {get_attr: [CollectMacDeploymentsBlockStorage, deploy_stdouts]}
objectstorage_mappings: {get_attr: [CollectMacDeploymentsObjectStorage, deploy_stdouts]}
cephstorage_mappings: {get_attr: [CollectMacDeploymentsCephStorage, deploy_stdouts]}
{%- for role in roles %}
{{role.name}}_mappings: {get_attr: [CollectMacDeployments{{role.name}}, deploy_stdouts]}
{%- endfor %}
nexus_config: {get_param: NetworkNexusConfig}
actions: ['CREATE'] # Only do this on CREATE