TVD: fix get_<>s but plugin with filters

When getting networks/ports/etc with filters, we should filter by
the context plugin even if filters are added to the request,
unless the filters are very specific.
For example - when filtering by device id, the project should be ignored,
or else router GW ports (which have no project) will not be deleted.

Change-Id: Ib41bb5eca39ae0cd6b16ead60db0ecd528eb4638
This commit is contained in:
Adit Sarfaty 2018-02-15 09:07:06 +02:00
parent bda748b149
commit 57d6b97ec8
1 changed files with 5 additions and 1 deletions

View File

@ -326,7 +326,11 @@ class NsxTVDPlugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
project_id = filters.get('tenant_id')
elif filters.get('project_id'):
project_id = filters.get('project_id')
else:
# we have specific filters on the request. If those are
# specific enough, we should not filter by project
if filters.get('device_id'):
return
# If there are multiple tenants/projects being requested then
# we will not filter according to the plugin
if isinstance(project_id, list):