From 4ad7dff959be3fbc78cd62798ad5a7c414f8a10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Mon, 21 May 2018 14:10:32 +0200 Subject: [PATCH] Deployed Server - portmap should match neutron API The cidr property for a Neutron subnet should contain the network cidr, not the network prefixlen. The example portmap for the fake neutron port in tripleo depleoyed-server is not correct. We should pass the netowork cidr in the subnets so that the fake neutron port subnets attribute return something that match what an actual neutron port would return. Change-Id: I0f8cad690a178e7b70044c38b2277a51ae3734eb Related-Bug: #1772396 --- tripleoclient/v1/tripleo_deploy.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index 3bceb2a50..bf96cfcfa 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -46,7 +46,6 @@ from tripleo_common.utils import passwords as password_utils from tripleo_common.inventory import TripleoInventory from tripleo_common.utils import config -VIP_CIDR_PREFIX_LEN = 32 DEPLOY_FAILURE_MESSAGE = """ ########################################################## containerized undercloud deployment failed. @@ -298,9 +297,8 @@ class Deploy(command.Command): } return data - def _generate_portmap_parameters(self, ip_addr, cidr_prefixlen, - ctlplane_vip_addr, public_vip_addr, - stack_name='Undercloud', + def _generate_portmap_parameters(self, ip_addr, ip_nw, ctlplane_vip_addr, + public_vip_addr, stack_name='Undercloud', role_name='Undercloud'): hostname = utils.get_short_hostname() @@ -308,7 +306,7 @@ class Deploy(command.Command): # we need to ensure the HostnameMap matches our hostname hostname_map_name = "%s-%s-0" % (stack_name.lower(), role_name.lower()) data = { - 'ControlPlaneSubnetCidr': '%s' % cidr_prefixlen, + 'ControlPlaneSubnetCidr': '%s' % ip_nw.prefixlen, 'HostnameMap': { hostname_map_name: '%s' % hostname }, @@ -318,7 +316,7 @@ class Deploy(command.Command): 'IPPool': { 'external': [public_vip_addr] }, - 'ExternalNetCidr': '%s/%s' % (public_vip_addr, cidr_prefixlen), + 'ExternalNetCidr': '%s/%s' % (public_vip_addr, ip_nw.prefixlen), # This requires use of the # ../deployed-server/deployed-neutron-port.yaml resource in t-h-t # We use this for the control plane VIP and also via @@ -327,15 +325,15 @@ class Deploy(command.Command): 'DeployedServerPortMap': { ('%s-ctlplane' % hostname): { 'fixed_ips': [{'ip_address': ip_addr}], - 'subnets': [{'cidr': cidr_prefixlen}] + 'subnets': [{'cidr': str(ip_nw.cidr)}] }, 'control_virtual_ip': { 'fixed_ips': [{'ip_address': ctlplane_vip_addr}], - 'subnets': [{'cidr': VIP_CIDR_PREFIX_LEN}] + 'subnets': [{'cidr': str(ip_nw.cidr)}] }, 'public_virtual_ip': { 'fixed_ips': [{'ip_address': public_vip_addr}], - 'subnets': [{'cidr': VIP_CIDR_PREFIX_LEN}] + 'subnets': [{'cidr': str(ip_nw.cidr)}] } } } @@ -464,7 +462,6 @@ class Deploy(command.Command): 'tripleoclient-hosts-portmaps.yaml') ip_nw = netaddr.IPNetwork(parsed_args.local_ip) ip = str(ip_nw.ip) - cidr_prefixlen = ip_nw.prefixlen if parsed_args.control_virtual_ip: c_ip = parsed_args.control_virtual_ip @@ -478,7 +475,7 @@ class Deploy(command.Command): tmp_env = self._generate_hosts_parameters(parsed_args, p_ip) tmp_env.update(self._generate_portmap_parameters( - ip, cidr_prefixlen, c_ip, p_ip, + ip, ip_nw, c_ip, p_ip, stack_name=parsed_args.stack, role_name=self._get_primary_role_name()))