From 95fa00de59549b10e9d96190391dbbe0559d4939 Mon Sep 17 00:00:00 2001 From: Giulio Fidente Date: Mon, 12 Jan 2015 17:45:41 +0100 Subject: [PATCH] Set NeutronL3HA to True when number of Controllers is > 1 Change-Id: Ied3f9c49bec31af3d8af013f0240cd0af0b3b25d --- tuskar_ui/infrastructure/overview/forms.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tuskar_ui/infrastructure/overview/forms.py b/tuskar_ui/infrastructure/overview/forms.py index 7cd172b9b..cbc7d2a94 100644 --- a/tuskar_ui/infrastructure/overview/forms.py +++ b/tuskar_ui/infrastructure/overview/forms.py @@ -152,6 +152,17 @@ class EditPlan(horizon.forms.SelfHandlingForm): (field.role.node_count_parameter_name, data[name]) for (name, field) in self.fields.items() if name.endswith('-count') ) + # NOTE(gfidente): this is a bad hack meant to magically add the + # parameter which enables Neutron L3 HA when the number of + # Controllers is > 1 + try: + controller_role = self.plan.get_role_by_name('controller') + except Exception as e: + LOG.warning('Unable to find role: %s', 'controller') + else: + if parameters[controller_role.node_count_parameter_name] > 1: + l3ha_param = controller_role.parameter_prefix + 'NeutronL3HA' + parameters[l3ha_param] = 'True' try: self.plan = self.plan.patch(request, self.plan.uuid, parameters) except Exception as e: