Skip to content

Commit

Permalink
Check for ip-addr membership in subnet using IPNetwork instead of
Browse files Browse the repository at this point in the history
IPSet as it is way more efficient (improving port-list operations).

Change-Id: Ic73a32e0c371ddae3a00f4eff56f7e774f36b9ba
Partial-Bug: 1589014
  • Loading branch information
Hampapur Ajay committed Jul 7, 2016
1 parent b1bb1d2 commit c61d690
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
Original file line number Diff line number Diff line change
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 c61d690

Please sign in to comment.