Merge "Prevent routers to be always updated if no shared public network"
This commit is contained in:
commit
4ab054790c
@ -366,6 +366,9 @@ class RouterModule(OpenStackModule):
|
|||||||
if 'ip_address' in p:
|
if 'ip_address' in p:
|
||||||
cur_fip_map[p['subnet_id']].add(p['ip_address'])
|
cur_fip_map[p['subnet_id']].add(p['ip_address'])
|
||||||
req_fip_map = defaultdict(set)
|
req_fip_map = defaultdict(set)
|
||||||
|
if external_fixed_ips is not None:
|
||||||
|
# User passed expected external_fixed_ips configuration.
|
||||||
|
# Build map of requested ips/subnets.
|
||||||
for p in external_fixed_ips:
|
for p in external_fixed_ips:
|
||||||
if 'ip_address' in p:
|
if 'ip_address' in p:
|
||||||
req_fip_map[p['subnet_id']].add(p['ip_address'])
|
req_fip_map[p['subnet_id']].add(p['ip_address'])
|
||||||
@ -382,7 +385,7 @@ class RouterModule(OpenStackModule):
|
|||||||
# adding ext ip with subnet 'subnet'
|
# adding ext ip with subnet 'subnet'
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Check if external ip addresses need to be removed
|
# Check if external ip addresses need to be removed.
|
||||||
for fip in cur_ext_fips:
|
for fip in cur_ext_fips:
|
||||||
subnet = fip['subnet_id']
|
subnet = fip['subnet_id']
|
||||||
ip = fip['ip_address']
|
ip = fip['ip_address']
|
||||||
@ -394,11 +397,6 @@ class RouterModule(OpenStackModule):
|
|||||||
# removing ext ip with subnet
|
# removing ext ip with subnet
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if not external_fixed_ips and len(cur_ext_fips) > 1:
|
|
||||||
# No external fixed ips requested but
|
|
||||||
# router has several external fixed ips
|
|
||||||
return True
|
|
||||||
|
|
||||||
# Check if internal interfaces need update
|
# Check if internal interfaces need update
|
||||||
if to_add or to_remove or missing_port_ids:
|
if to_add or to_remove or missing_port_ids:
|
||||||
# need to change interfaces
|
# need to change interfaces
|
||||||
@ -448,7 +446,8 @@ class RouterModule(OpenStackModule):
|
|||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
def _build_router_interface_config(self, filters):
|
def _build_router_interface_config(self, filters):
|
||||||
external_fixed_ips = []
|
# Undefine external_fixed_ips to have possibility to unset them
|
||||||
|
external_fixed_ips = None
|
||||||
internal_ports_missing = []
|
internal_ports_missing = []
|
||||||
internal_ifaces = []
|
internal_ifaces = []
|
||||||
|
|
||||||
@ -459,6 +458,8 @@ class RouterModule(OpenStackModule):
|
|||||||
.get('external_fixed_ips')
|
.get('external_fixed_ips')
|
||||||
ext_fixed_ips = ext_fixed_ips or self.params['external_fixed_ips']
|
ext_fixed_ips = ext_fixed_ips or self.params['external_fixed_ips']
|
||||||
if ext_fixed_ips:
|
if ext_fixed_ips:
|
||||||
|
# User passed external_fixed_ips configuration. Initialize ips list
|
||||||
|
external_fixed_ips = []
|
||||||
for iface in ext_fixed_ips:
|
for iface in ext_fixed_ips:
|
||||||
subnet = self.conn.network.find_subnet(
|
subnet = self.conn.network.find_subnet(
|
||||||
iface['subnet_id'], ignore_missing=False, **filters)
|
iface['subnet_id'], ignore_missing=False, **filters)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user