From fa2e8327b9d0a10f29a4fbe3094a4533914b8ce3 Mon Sep 17 00:00:00 2001 From: Feilong Wang Date: Thu, 5 Oct 2017 14:37:34 +1300 Subject: [PATCH] Add cache for get_microversion() against Nova Actions "Lock" and "Unlock" of instance on instances table are calling api.nova.is_feature_available() to check if the feature is supported by current Nova server. Unfortunately, the function get_microversion() called by is_feature_available() is not cached, which is causing about 40 unnecesary REST API calls. If the Nova's version is under Mitaka, it could be even worse, about 80 unnecesary API calls, see openstack_dashboard/api/nova.py#L60 and novaclient/v2/versions.py#L47 for more details. Closes-Bug: #1721423 Change-Id: Ie96b1a35e379d4cf407bfd53b1ee734178f9cb07 --- openstack_dashboard/api/nova.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openstack_dashboard/api/nova.py b/openstack_dashboard/api/nova.py index d6658e21a5..13170d93b6 100644 --- a/openstack_dashboard/api/nova.py +++ b/openstack_dashboard/api/nova.py @@ -57,6 +57,7 @@ INSECURE = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) CACERT = getattr(settings, 'OPENSTACK_SSL_CACERT', None) +@memoized def get_microversion(request, feature): client = novaclient(request) min_ver, max_ver = api_versions._get_server_version_range(client)