From b436b5292aa04e4988dc8aa6f297460f0c00419c Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Sun, 13 Oct 2019 09:26:41 +0300 Subject: [PATCH] Add caching for mdproxy & edge clusters for TZ validations Change-Id: I6d4be7a243dffce93941b979e944c718e5262deb --- vmware_nsxlib/v3/core_resources.py | 8 ++++++++ vmware_nsxlib/v3/policy/core_defs.py | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/vmware_nsxlib/v3/core_resources.py b/vmware_nsxlib/v3/core_resources.py index 65ac069a..d2c83015 100644 --- a/vmware_nsxlib/v3/core_resources.py +++ b/vmware_nsxlib/v3/core_resources.py @@ -844,6 +844,10 @@ class NsxLibEdgeCluster(utils.NsxLibApiBase): def resource_type(self): return 'EdgeCluster' + @property + def use_cache_for_get(self): + return True + def get_transport_nodes(self, uuid): ec = self.get(uuid) members = [] @@ -962,6 +966,10 @@ class NsxLibMetadataProxy(utils.NsxLibApiBase): def resource_type(self): return 'MetadataProxy' + @property + def use_cache_for_get(self): + return True + def update(self, uuid, server_url=None, secret=None, edge_cluster_id=None): body = {} # update the relevant fields diff --git a/vmware_nsxlib/v3/policy/core_defs.py b/vmware_nsxlib/v3/policy/core_defs.py index 1054707f..90516c61 100644 --- a/vmware_nsxlib/v3/policy/core_defs.py +++ b/vmware_nsxlib/v3/policy/core_defs.py @@ -1741,6 +1741,10 @@ class MetadataProxyDef(ResourceDef): def resource_type(): return 'MetadataProxyConfig' + @staticmethod + def resource_use_cache(): + return True + def path_defs(self): return (TenantDef,)