Skip to content

Commit

Permalink
Merge "Check for ip-addr membership in subnet using IPNetwork instead…
Browse files Browse the repository at this point in the history
… of IPSet as it is way more efficient (improving port-list operations)."
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jul 7, 2016
2 parents 0ac76b2 + c61d690 commit eee949a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/config/vnc_openstack/vnc_openstack/neutron_plugin_db.py
Expand Up @@ -878,7 +878,7 @@ def _ip_address_to_subnet_id(self, ip_addr, net_obj, memo_req=None):
try:
subnets_info = memo_req['subnets'][net_obj.uuid]
for subnet_info in subnets_info:
if IPAddress(ip_addr) in IPSet([subnet_info['cidr']]):
if ip_addr in IPNetwork(subnet_info['cidr']):
subnet_id = subnet_info['id']
return subnet_id
except Exception:
Expand All @@ -889,7 +889,7 @@ def _ip_address_to_subnet_id(self, ip_addr, net_obj, memo_req=None):
for subnet_vnc in subnet_vncs:
cidr = '%s/%s' % (subnet_vnc.subnet.get_ip_prefix(),
subnet_vnc.subnet.get_ip_prefix_len())
if IPAddress(ip_addr) in IPSet([cidr]):
if ip_addr in IPNetwork(subnet_info['cidr']):
subnet_id = subnet_vnc.subnet_uuid
return subnet_id
return None
Expand Down

0 comments on commit eee949a

Please sign in to comment.