summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Benton <blak111@gmail.com>2014-11-18 08:34:56 -0800
committerIhar Hrachyshka <ihrachys@redhat.com>2014-11-26 19:39:24 +0100
commit3e1d3a786500510be7338ce9e5c81e8daccfeb40 (patch)
tree1b1c7145e3ca93e1392d30a5c5935eb1ade57071
parent63b43376b3818a28af496d3a6f4e6957df9427f2 (diff)
downloadneutron-3e1d3a786500510be7338ce9e5c81e8daccfeb40.tar.gz
Prevent an iteration through ports on IPv6 slaac
A recent change[1] allowed subnets to be deleted even if they had active IPv6 SLAAC allocations on them. The updated check was inefficient because it would check every port in the subnet even if the subnet was a SLAAC subnet. This patch just shortcuts out that check. 1. I281f5a1553248e09174dc49d0a42aef4b5c44bee Change-Id: I2c35495b3642c644e4758f28ccddcc076139ec3b (cherry picked from commit b3a44c2d5d8ca85bcc5ccffc76d2a959e373e5d4)
-rw-r--r--neutron/plugins/ml2/plugin.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py
index fe3a6face8..26d2c98a3a 100644
--- a/neutron/plugins/ml2/plugin.py
+++ b/neutron/plugins/ml2/plugin.py
@@ -725,11 +725,9 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
filter_by(network_id=subnet['network_id']).
with_lockmode('update').all())
LOG.debug(_("Ports to auto-deallocate: %s"), allocated)
- only_auto_del = all(not a.port_id or
- a.ports.device_owner in db_base_plugin_v2.
- AUTO_DELETE_PORT_OWNERS or
- ipv6_utils.is_slaac_subnet(subnet)
- for a in allocated)
+ only_auto_del = ipv6_utils.is_slaac_subnet(subnet) or all(
+ not a.port_id or a.ports.device_owner in db_base_plugin_v2.
+ AUTO_DELETE_PORT_OWNERS for a in allocated)
if not only_auto_del:
LOG.debug(_("Tenant-owned ports exist"))
raise exc.SubnetInUse(subnet_id=id)