Don't allow deletion of the router ports without IP addresses
This patch effectively reverts old patch [1]. From now on it will be not allowed to directly remove router ports which don't have fixed IPs assigned. Such ports will be treated as any other ports connected to the routers. Originally [1] was introduced to allow cleanup of the router ports for which subnets were deleted. But now it's not needed anymore as we prevent deletion of subnet if there are any ports with IP allocated from that subnet. Closes-bug: #2025056 [1] https://review.opendev.org/c/openstack/neutron/+/20424 Change-Id: I1a3723ae999fefb5dcbe3a60cf1a4902da9f0265
This commit is contained in:
parent
b86ca713f7
commit
32d589f03e
|
@ -1745,15 +1745,6 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
|||
return
|
||||
if port['device_owner'] not in self.router_device_owners:
|
||||
return
|
||||
# Raise port in use only if the port has IP addresses
|
||||
# Otherwise it's a stale port that can be removed
|
||||
fixed_ips = port['fixed_ips']
|
||||
if not fixed_ips:
|
||||
LOG.debug("Port %(port_id)s has owner %(port_owner)s, but "
|
||||
"no IP address, so it can be deleted",
|
||||
{'port_id': port['id'],
|
||||
'port_owner': port['device_owner']})
|
||||
return
|
||||
# NOTE(kevinbenton): we also check to make sure that the
|
||||
# router still exists. It's possible for HA router interfaces
|
||||
# to remain after the router is deleted if they encounter an
|
||||
|
|
|
@ -269,9 +269,10 @@ class TestL3_NAT_dbonly_mixin(
|
|||
# without fixed IPs is allowed
|
||||
gp.return_value.get_port.return_value = {
|
||||
'device_owner': n_const.DEVICE_OWNER_ROUTER_INTF, 'fixed_ips': [],
|
||||
'id': 'f'
|
||||
'device_id': '44', 'id': 'f',
|
||||
}
|
||||
self.db.prevent_l3_port_deletion(None, None)
|
||||
with testtools.ExpectedException(n_exc.ServicePortInUse):
|
||||
self.db.prevent_l3_port_deletion(mock.Mock(), None)
|
||||
|
||||
@mock.patch.object(directory, 'get_plugin')
|
||||
def test_prevent_l3_port_no_router(self, gp):
|
||||
|
|
Loading…
Reference in New Issue