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
This commit is contained in:
parent
30bb654b1b
commit
3bbd48216a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue