Adding swift role back
-swift role is now separated in upstream templates, so adding it to scaling -adding swift role back to initial data -merge.py now needs all templates and it decides based on parameters. Otherwise it doesn't work. Tuskar is currently broken because of this change in tripleo templates. So this fixes broken state. Change-Id: Icd62b94447b2d72616597d74fc8191a2d158c15c
This commit is contained in:
parent
b044b4a991
commit
b6e1c9d0c3
@ -127,6 +127,10 @@ def generate_data():
|
||||
name='Block Storage',
|
||||
description='block storage role',
|
||||
image_name='overcloud-cinder-volume')
|
||||
create_overcloud_role(conn, base_url,
|
||||
name='Object Storage',
|
||||
description='object storage role',
|
||||
image_name='overcloud-swift-storage')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -27,17 +27,21 @@ from tripleo_heat_merge import merge
|
||||
OVERCLOUD_CONTROL_ROLE = 'overcloud-control'
|
||||
OVERCLOUD_COMPUTE_ROLE = 'overcloud-compute'
|
||||
OVERCLOUD_VOLUME_ROLE = 'overcloud-cinder-volume'
|
||||
OVERCLOUD_OBJECT_STORAGE_ROLE = 'overcloud-swift-storage'
|
||||
|
||||
ROLES = {}
|
||||
ROLES[OVERCLOUD_CONTROL_ROLE] = {'template_param': 'Control',
|
||||
'flavor_param': 'OvercloudControlFlavor',
|
||||
'file_name': None}
|
||||
ROLES[OVERCLOUD_COMPUTE_ROLE] = {'template_param': 'NovaCompute',
|
||||
'flavor_param': 'OvercloudComputeFlavor',
|
||||
'file_name': 'overcloud-source.yaml'}
|
||||
ROLES[OVERCLOUD_VOLUME_ROLE] = {'template_param': 'BlockStorage',
|
||||
'flavor_param': 'OvercloudBlockStorageFlavor',
|
||||
'file_name': 'block-storage.yaml'}
|
||||
ROLES[OVERCLOUD_CONTROL_ROLE] = {
|
||||
'template_param': 'Control',
|
||||
'flavor_param': 'OvercloudControlFlavor', }
|
||||
ROLES[OVERCLOUD_COMPUTE_ROLE] = {
|
||||
'template_param': 'NovaCompute',
|
||||
'flavor_param': 'OvercloudComputeFlavor', }
|
||||
ROLES[OVERCLOUD_VOLUME_ROLE] = {
|
||||
'template_param': 'BlockStorage',
|
||||
'flavor_param': 'OvercloudBlockStorageFlavor', }
|
||||
ROLES[OVERCLOUD_OBJECT_STORAGE_ROLE] = {
|
||||
'template_param': 'SwiftStorage',
|
||||
'flavor_param': 'OvercloudSwiftStorageFlavor', }
|
||||
|
||||
|
||||
def generate_scaling_params(overcloud_roles):
|
||||
@ -52,7 +56,8 @@ def generate_scaling_params(overcloud_roles):
|
||||
:rtype: dict
|
||||
"""
|
||||
|
||||
scaling = {}
|
||||
# Default values, merge.py needs also the 0 counts.
|
||||
scaling = {'NovaCompute0': 0, 'SwiftStorage0': 0, 'BlockStorage0': 0, }
|
||||
|
||||
for overcloud_role, count in overcloud_roles.items():
|
||||
overcloud_role = overcloud_role.lower()
|
||||
@ -82,16 +87,19 @@ def merge_templates(overcloud_roles):
|
||||
# TODO(dmatthews): Add exception handling to catch merge errors
|
||||
|
||||
scale_params = generate_scaling_params(overcloud_roles)
|
||||
overcloud_src_path = _join_template_path("overcloud-source.yaml")
|
||||
overcloud_source = _join_template_path("overcloud-source.yaml")
|
||||
block_storage = _join_template_path("block-storage.yaml")
|
||||
swift_source = _join_template_path("swift-source.yaml")
|
||||
swift_storage_source = _join_template_path("swift-storage-source.yaml")
|
||||
ssl_src_path = _join_template_path("ssl-source.yaml")
|
||||
swift_src_path = _join_template_path("swift-source.yaml")
|
||||
merge_paths = [overcloud_src_path, ssl_src_path, swift_src_path]
|
||||
if OVERCLOUD_VOLUME_ROLE in overcloud_roles:
|
||||
if overcloud_roles[OVERCLOUD_VOLUME_ROLE] > 0:
|
||||
block_storage_path = _join_template_path(
|
||||
ROLES[OVERCLOUD_VOLUME_ROLE]['file_name'])
|
||||
merge_paths.append(block_storage_path)
|
||||
template = merge.merge(merge_paths, None, None,
|
||||
|
||||
# Adding all templates like in tripleo-heat-templates Makefile.
|
||||
# They will be used by merge.py according to scale_params. So the
|
||||
# decision what template to pick will not be here.
|
||||
merged_paths = [overcloud_source, block_storage, swift_source,
|
||||
swift_storage_source, ssl_src_path]
|
||||
|
||||
template = merge.merge(merged_paths, None, None,
|
||||
included_template_dir=cfg.CONF.tht_local_dir,
|
||||
scaling=scale_params)
|
||||
|
||||
|
@ -32,7 +32,7 @@ class TemplateToolsTests(unittest.TestCase):
|
||||
mock_parse_scaling.assert_called_once_with(['NovaCompute=12'])
|
||||
|
||||
@mock.patch('tripleo_heat_merge.merge.merge')
|
||||
def test_merge_templates(self, mock_merge):
|
||||
def test_merge_templates_compute(self, mock_merge):
|
||||
# Setup
|
||||
overcloud_roles = {'controller': 1, 'overcloud-compute': 12}
|
||||
|
||||
@ -42,12 +42,60 @@ class TemplateToolsTests(unittest.TestCase):
|
||||
# Verify
|
||||
mock_merge.assert_called_once_with([
|
||||
'/etc/tuskar/tripleo-heat-templates/overcloud-source.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/ssl-source.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/swift-source.yaml'],
|
||||
'/etc/tuskar/tripleo-heat-templates/block-storage.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/swift-source.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/swift-storage-source.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/ssl-source.yaml', ],
|
||||
None,
|
||||
None,
|
||||
scaling={
|
||||
'NovaCompute0': 12
|
||||
'NovaCompute0': 12, 'SwiftStorage0': 0, 'BlockStorage0': 0,
|
||||
},
|
||||
included_template_dir='/etc/tuskar/tripleo-heat-templates/'
|
||||
)
|
||||
|
||||
@mock.patch('tripleo_heat_merge.merge.merge')
|
||||
def test_merge_templates_block_storage(self, mock_merge):
|
||||
# Setup
|
||||
overcloud_roles = {'controller': 1, 'overcloud-cinder-volume': 12}
|
||||
|
||||
# Test
|
||||
template_tools.merge_templates(overcloud_roles)
|
||||
|
||||
# Verify
|
||||
mock_merge.assert_called_once_with([
|
||||
'/etc/tuskar/tripleo-heat-templates/overcloud-source.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/block-storage.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/swift-source.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/swift-storage-source.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/ssl-source.yaml', ],
|
||||
None,
|
||||
None,
|
||||
scaling={
|
||||
'NovaCompute0': 0, 'SwiftStorage0': 0, 'BlockStorage0': 12,
|
||||
},
|
||||
included_template_dir='/etc/tuskar/tripleo-heat-templates/'
|
||||
)
|
||||
|
||||
@mock.patch('tripleo_heat_merge.merge.merge')
|
||||
def test_merge_templates_object_storage(self, mock_merge):
|
||||
# Setup
|
||||
overcloud_roles = {'controller': 1, 'overcloud-swift-storage': 12}
|
||||
|
||||
# Test
|
||||
template_tools.merge_templates(overcloud_roles)
|
||||
|
||||
# Verify
|
||||
mock_merge.assert_called_once_with([
|
||||
'/etc/tuskar/tripleo-heat-templates/overcloud-source.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/block-storage.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/swift-source.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/swift-storage-source.yaml',
|
||||
'/etc/tuskar/tripleo-heat-templates/ssl-source.yaml', ],
|
||||
None,
|
||||
None,
|
||||
scaling={
|
||||
'NovaCompute0': 0, 'SwiftStorage0': 12, 'BlockStorage0': 0,
|
||||
},
|
||||
included_template_dir='/etc/tuskar/tripleo-heat-templates/'
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user