From 57d6b97ec85844454be1f5654fb3d9390c883416 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty <asarfaty@vmware.com> Date: Thu, 15 Feb 2018 09:07:06 +0200 Subject: [PATCH] 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 --- vmware_nsx/plugins/nsx/plugin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vmware_nsx/plugins/nsx/plugin.py b/vmware_nsx/plugins/nsx/plugin.py index 5addee3cbe..ac9dd58b29 100644 --- a/vmware_nsx/plugins/nsx/plugin.py +++ b/vmware_nsx/plugins/nsx/plugin.py @@ -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):