From 3bbd48216a181e1955a582e0b05c4ee265ab3c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Wed, 25 Sep 2019 17:29:07 +0200 Subject: [PATCH] Undercloud ctplane router for IPv6 RA's idempotent Check if the router exists before creating it. The undercloud re-install fail's when using IPv6 provisioning network since the router already exists. Also, don't create the router if routed networks is enabled. In this case the router in the infrastructure should handle router advertisements. Change-Id: I5bc0a88bbb7912bb10693ce393ac89365f29a940 Closes-Bug: #1844767 --- .../post_deploy/undercloud_ctlplane_network.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/extraconfig/post_deploy/undercloud_ctlplane_network.py b/extraconfig/post_deploy/undercloud_ctlplane_network.py index 5414885258..a0adc3c962 100755 --- a/extraconfig/post_deploy/undercloud_ctlplane_network.py +++ b/extraconfig/post_deploy/undercloud_ctlplane_network.py @@ -176,6 +176,10 @@ def _neutron_segment_update(sdk, segment_id, name): def _ensure_neutron_router(sdk, name, subnet_id): + # If the router already exist, don't try to create it again. + if list(sdk.network.routers(name=name)): + return + try: router = sdk.network.create_router(name=name, admin_state_up='true') sdk.network.add_interface_to_router(router.id, subnet_id=subnet_id) @@ -248,8 +252,14 @@ def _local_neutron_segments_and_subnets(sdk, ctlplane_id, net_cidrs): s['DnsNameServers']) # If the subnet is IPv6 we need to start a router so that router # advertisments are sent out for stateless IP addressing to work. - if netaddr.IPNetwork(s['NetworkCidr']).version == 6: - _ensure_neutron_router(sdk, name, subnet.id) + # NOTE(hjensas): Don't do this for routed networks. The router will + # use the address defined as gateway for the subnet, and in a + # deployment with routed networks this will conflict with the router + # in the infrastructure. The router in the infrastucture must be + # configured to send router advertisements. + if not CONF['enable_routed_networks']: + if netaddr.IPNetwork(s['NetworkCidr']).version == 6: + _ensure_neutron_router(sdk, name, subnet.id) net_cidrs.append(s['NetworkCidr']) return net_cidrs @@ -283,10 +293,6 @@ def _remote_neutron_segments_and_subnets(sdk, ctlplane_id, net_cidrs): sdk, ctlplane_id, s['NetworkCidr'], s['NetworkGateway'], s['HostRoutes'], s.get('AllocationPools'), name, segment.id, s['DnsNameServers']) - # If the subnet is IPv6 we need to start a router so that router - # advertisments are sent out for stateless IP addressing to work. - if netaddr.IPNetwork(s['NetworkCidr']).version == 6: - _ensure_neutron_router(sdk, name, subnet.id) net_cidrs.append(s['NetworkCidr']) return net_cidrs