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
This commit is contained in:
Harald Jensås 2021-01-07 12:06:18 +01:00
parent 5fcef39f3f
commit b90f16d11e
1 changed files with 26 additions and 1 deletions

View File

@ -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,
}
}
}