From 59587e8bba552b2e0a989f07e34250b3814fed2c Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Sun, 1 Jan 2017 03:38:18 -0800 Subject: [PATCH] NSXV3: invoke get_connected_nsxlib only once per invocation For the admin utility we only need to do this once. This will ensure that we do not have the following messages on the terminal: "Endpoint '' changing from state 'INITIALIZED' to 'UP'" Change-Id: I9183ccccc017deac70b7c7e57328867f72e9dfe5 --- vmware_nsx/shell/admin/plugins/nsxv3/resources/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vmware_nsx/shell/admin/plugins/nsxv3/resources/utils.py b/vmware_nsx/shell/admin/plugins/nsxv3/resources/utils.py index 9b0d46f874..80a530b7b6 100644 --- a/vmware_nsx/shell/admin/plugins/nsxv3/resources/utils.py +++ b/vmware_nsx/shell/admin/plugins/nsxv3/resources/utils.py @@ -21,13 +21,18 @@ from vmware_nsx.plugins.nsx_v3 import plugin from vmware_nsx.plugins.nsx_v3 import utils as v3_utils from vmware_nsxlib.v3 import nsx_constants +_NSXLIB = None + def get_nsxv3_client(): return get_connected_nsxlib().client def get_connected_nsxlib(): - return v3_utils.get_nsxlib_wrapper() + global _NSXLIB + if _NSXLIB is None: + _NSXLIB = v3_utils.get_nsxlib_wrapper() + return _NSXLIB class NeutronDbClient(db_base_plugin_v2.NeutronDbPluginV2):