Skip to content

Commit

Permalink
Fix two bugs in neutron_plugin_db:floatingip_list
Browse files Browse the repository at this point in the history
Bug https://bugs.launchpad.net/juniperopenstack/+bug/1609997 (commit
1c88e00) introduced new code aimed at reducing the data requested from
API for the security-group and floating-ip list commands. It had some
UUID formatting errors (received UUID without dashes), it has since been
supplemented by fixes from a second commit of bug
https://bugs.launchpad.net/juniperopenstack/+bug/1607584 (commits
72c9434, 697188e). Two issues remains unresolved, that are fixed with
this commit:

1a) """fip_ids = filters['id']""" in floatingip_list does not perform
the UUID formatting.
1b) Furthermore, the function """_filters_is_present""" does not
UUID-dash:ify any other keys than tenant_id.
1c) Therefore, the result is that floatingip_list can only correctly
handle filter input with floatingip object UUIDs containing dashes.
1d) As evident by Bug 1631552, this isn't always the case.
1e) This commit addresses both the UUID formatting in 1a) and also the
if casing from 1b).

2a) The intent of bug 1609997 is to only send port_ids to the backend
from neutron_plugin, if port_ids are present in the filter. This does
indeed improve latency for large setups (e.g. a tenant with a lot of
content, but where the request ops, such as issued by Horizon page
views, only cares about a specific set of floating ips)
2b) Due to the code in the """if 'port_id' in filters:""" if case
however, if a tenant_id is present (which it typically is, from Horizon
at least), the net result is that the tenant_id is the only
backreference that is passed onwards.
2c) Furthermore, again, there is no UUID-dashification happening in this
if-case (see above for reasoning).
2c) This commit fixes 2b) + 2c), e.g default to using correctly
formatted port_ids as backreference, if present, rather than the tenant_id.

Change-Id: Ie680bfd23520782ca7d2aae13e375265e57d8469
Signed-off-by: Martin Millnert <martin@millnert.se>
Closes-Bug: #1636843
(cherry picked from commit 698c8f3)
  • Loading branch information
Millnert authored and Hampapur Ajay committed Jan 6, 2017
1 parent 4eca46f commit 4cd71c7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/config/vnc_openstack/vnc_openstack/neutron_plugin_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -3444,14 +3444,15 @@ def floatingip_list(self, context, filters=None):
backref_ids = None
if filters:
if 'id' in filters:
fip_ids = filters['id']
fip_ids = [str(uuid.UUID(fid)) for fid in filters['id']]
if 'tenant_id' in filters:
backref_ids = self._validate_project_ids(context,
filters['tenant_id'])
proj_ids = backref_ids
if 'port_id' in filters:
backref_ids = backref_ids or [] + filters['port_id']
port_ids = backref_ids
port_ids = [str(uuid.UUID(pid)) for pid in filters['port_id']]
if len(port_ids) > 0:
backref_ids = port_ids
else: # no filters
if not context['is_admin']:
backref_ids = [str(uuid.UUID(context['tenant']))]
Expand All @@ -3466,7 +3467,7 @@ def floatingip_list(self, context, filters=None):
continue
# if filters has both id and tenant_id, api-server would
# have returned ORed value, neutron expects ANDed
if not self._filters_is_present(filters, 'id', fip_obj.uuid):
if filters and 'id' in filters and fip_obj.uuid not in fip_ids:
continue
if filters and 'tenant_id' in filters:
if not fip_obj.get_project_refs():
Expand Down

0 comments on commit 4cd71c7

Please sign in to comment.