From ba43260108cfa218c35b503499c5acd84bc62467 Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Wed, 13 Feb 2013 10:07:24 -0800 Subject: [PATCH] Avoid extra query when overlapping IPs are disabled Bug 1124363 Change-Id: I431d19a987e18ec2648d9cb0aad185e5ba68f830 --- quantum/db/db_base_plugin_v2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quantum/db/db_base_plugin_v2.py b/quantum/db/db_base_plugin_v2.py index 8960629ee1..fb34bf835f 100644 --- a/quantum/db/db_base_plugin_v2.py +++ b/quantum/db/db_base_plugin_v2.py @@ -688,8 +688,9 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2): """ new_subnet_ipset = netaddr.IPSet([new_subnet_cidr]) - subnet_list = network.subnets - if not cfg.CONF.allow_overlapping_ips: + if cfg.CONF.allow_overlapping_ips: + subnet_list = network.subnets + else: subnet_list = self._get_all_subnets(context) for subnet in subnet_list: if (netaddr.IPSet([subnet.cidr]) & new_subnet_ipset):