From 3176e57da097f2c238b134f18b1a4af00e105546 Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Mon, 1 Apr 2019 09:46:31 +0000 Subject: Update capacity check API Query the AZinfo from the cache Relay on the background thread of AZcap Auditing Change-Id: I064dbc22c71ef25683145ef1c96274ce6ac74c3b Issue-ID: MULTICLOUD-542 Signed-off-by: Bin Yang --- share/starlingx_base/registration/registration.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'share/starlingx_base/registration/registration.py') diff --git a/share/starlingx_base/registration/registration.py b/share/starlingx_base/registration/registration.py index 7a85b29f..59074568 100644 --- a/share/starlingx_base/registration/registration.py +++ b/share/starlingx_base/registration/registration.py @@ -373,7 +373,8 @@ class InfraResourceAuditor(newton_registration.RegistryHelper): continue hypervisors_dict[h["hypervisor_hostname"]] = h - az_pserver_info = {} + vimAzCacheKey = "cap_azlist_" + vimid + vimAzList = [] # cloud_owner, cloud_region_id = extsys.decode_vim_id(vimid) for az in self._get_list_resources( "/os-availability-zone/detail", "compute", session, @@ -393,6 +394,8 @@ class InfraResourceAuditor(newton_registration.RegistryHelper): if azName == 'internal': continue + vimAzList.append(azName) + # get list of host names pservers_info = [k for (k, v) in az['hosts'].items()] # set the association between az and pservers @@ -456,6 +459,7 @@ class InfraResourceAuditor(newton_registration.RegistryHelper): # update the cache cache.set(azCapCacheKey, json.dumps(azCapInfoCache), 3600 * 24) + cache.set(vimAzCacheKey, vimAzList, 3600 * 24) except Exception as e: self._logger.error("azcap_audit raise exception: %s" % e) pass -- cgit 1.2.3-korg