Deal with nested references to scaling parameters
As discussed @ https://bugzilla.redhat.com/show_bug.cgi?id=1253628 due to the way Tuskar deals with scaling params, nested references to the top-level scaling parameters won't work. This will ensure that these are replaced with the updated Role::count parameters that Tuskar uses for role scaling. Change-Id: Ibbcbfe16a9552ca479b691dbaeb3027388c59456 Related-Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1253628
This commit is contained in:
parent
e8eac7e562
commit
d63ea868b8
|
@ -37,6 +37,12 @@ HEAT_TYPE_RESOURCE_GROUP = 'OS::Heat::ResourceGroup'
|
|||
# Name of the property added to a resource group to control its scaling
|
||||
PROPERTY_SCALING_COUNT = 'count'
|
||||
|
||||
# Names of the top-level (master-seed) scaling params
|
||||
PROPERTY_SCALING_PARAMS = ["CephStorageCount", "ControllerCount",
|
||||
"ComputeCount", "BlockStorageCount",
|
||||
"ObjectStorageCount", ]
|
||||
|
||||
|
||||
# Name of the property added to a resource group to control removing resources
|
||||
PROPERTY_REMOVAL_POLICIES = 'removal_policies'
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ from tuskar.templates.heat import Environment
|
|||
from tuskar.templates.heat import EnvironmentParameter
|
||||
from tuskar.templates.heat import Resource
|
||||
from tuskar.templates import namespace as ns_utils
|
||||
|
||||
from tuskar.templates import plan as tuskar_plan
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -237,12 +237,16 @@ def update_role_property_references(destination, orig, namespace):
|
|||
if isinstance(check_me, dict):
|
||||
for k, v in check_me.items():
|
||||
if k == 'get_param' and v in all_role_property_keys:
|
||||
check_me[k] = ns_utils.apply_template_namespace(namespace,
|
||||
v)
|
||||
# Deal with nested references to the scaling params
|
||||
if v in tuskar_plan.PROPERTY_SCALING_PARAMS:
|
||||
check_me[k] = ns_utils.apply_template_namespace(
|
||||
namespace, tuskar_plan.PROPERTY_SCALING_COUNT)
|
||||
else:
|
||||
check_me[k] = ns_utils.apply_template_namespace(
|
||||
namespace, v)
|
||||
else:
|
||||
# It could be a nested dictionary, so recurse further
|
||||
_update_property(v)
|
||||
|
||||
top_level_resources = [r for r in destination.resources if not _is_role(r)]
|
||||
for r in top_level_resources:
|
||||
for p in r.properties:
|
||||
|
|
Loading…
Reference in New Issue