From b90f16d11ee27db9c132706a3b276fa0527e6aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Thu, 7 Jan 2021 12:06:18 +0100 Subject: [PATCH] Add routes and MTU to ctlplane attrs for standalone Adds the InterfaceLocalMtu and ControlPlaneStaticRoutes values to the ctlplane network attributes for standalone. Addresses follow up for: https://review.opendev.org/c/openstack/python-tripleoclient/+/753195/8/tripleoclient/v1/tripleo_deploy.py Change-Id: I8ceb178ed1e86bd6f2fd3a294fb6251a8dc9201f --- tripleoclient/v1/tripleo_deploy.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index e977f431e..f7dba7c6c 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -613,6 +613,24 @@ class Deploy(command.Command): environments.append(target_dest) return environments + def _load_user_params(self, user_environments): + user_params = {} + for env_file in user_environments: + # undercloud heat stack virtual state tracking is'nt available yet + if env_file.endswith('undercloud-stack-vstate-dropin.yaml'): + continue + + with open(env_file, 'r') as f: + data = yaml.safe_load(f.read()) + + if data is None or data.get('parameter_defaults') is None: + continue + + for k, v in data.get('parameter_defaults', {}).items(): + user_params[k] = v + + return user_params + def _setup_heat_environments(self, roles_file_path, networks_file_path, parsed_args): """Process tripleo heat templates with jinja and deploy into work dir @@ -703,13 +721,20 @@ class Deploy(command.Command): stack_name=parsed_args.stack, role_name=self._get_primary_role_name( roles_file_path, parsed_args.templates))) + + user_params = self._load_user_params(user_environments) + host_routes = user_params.get('ControlPlaneStaticRoutes', []) + mtu = user_params.get('InterfaceLocalMtu', 1500) tmp_env.update( { 'CtlplaneNetworkAttributes': { + 'network': { + 'mtu': mtu, + }, 'subnets': { 'ctlplane-subnet': { 'cidr': str(ip_nw.cidr), - 'host_routes': [] + 'host_routes': host_routes, } } }