DVR: handle unbound allowed_address_pairs added

Handle unbound allowed_address_pairs added if port's
admin_state_up is True.

Change-Id: I9d9c0cc19ee25f2a0ee7ba3359b22aa9df3714de
This commit is contained in:
Dongcan Ye 2017-09-25 16:56:39 +08:00
parent 9b8a1339de
commit b43a1b75fb
1 changed files with 4 additions and 10 deletions

View File

@ -459,25 +459,19 @@ def _notify_l3_agent_port_update(resource, event, trigger, **kwargs):
if allowed_address_pairs_list and new_port_host:
new_port_state = new_port.get('admin_state_up')
original_port_state = original_port.get('admin_state_up')
if new_port_state and not original_port_state:
# Case were we activate the port from inactive state.
if new_port_state:
# Case were we activate the port from inactive state,
# or the same port has additional address_pairs added.
for address_pair in allowed_address_pairs_list:
_dvr_handle_unbound_allowed_addr_pair_add(
l3plugin, context, new_port, address_pair)
return
elif original_port_state and not new_port_state:
elif original_port_state:
# Case were we deactivate the port from active state.
for address_pair in allowed_address_pairs_list:
_dvr_handle_unbound_allowed_addr_pair_del(
l3plugin, context, original_port, address_pair)
return
elif new_port_state and original_port_state:
# Case were the same port has additional address_pairs
# added.
for address_pair in allowed_address_pairs_list:
_dvr_handle_unbound_allowed_addr_pair_add(
l3plugin, context, new_port, address_pair)
return
is_fixed_ips_changed = (
'fixed_ips' in new_port and