From 8be988e49d30723809aef5192cd2a38dcf1a7ece Mon Sep 17 00:00:00 2001
From: Adit Sarfaty <asarfaty@vmware.com>
Date: Tue, 6 Feb 2018 00:15:37 +0200
Subject: [PATCH] TVD: Fix filtering without project id

the plugin filtering method should support the case where the context
does not have any project id, and skip the filterring

Change-Id: I35f7eb508891d1b930867b91e98b7fb6a276eeac
---
 vmware_nsx/plugins/nsx/utils.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vmware_nsx/plugins/nsx/utils.py b/vmware_nsx/plugins/nsx/utils.py
index 3392385c60..91ff30251e 100644
--- a/vmware_nsx/plugins/nsx/utils.py
+++ b/vmware_nsx/plugins/nsx/utils.py
@@ -62,9 +62,11 @@ def filter_plugins(cls):
             """Run the original get-list method, and filter the results
             by the project id of the context
             """
-            req_p = get_project_mapping(context, context.project_id)
             entries = orig_method(self, context, filters=filters,
                                   fields=fields)
+            if not context.project_id:
+                return entries
+            req_p = get_project_mapping(context, context.project_id)
             for entry in entries[:]:
                 p = get_project_mapping(context, entry['tenant_id'])
                 if p != req_p: