Speed up quotas fetching using futurist library

Partial-implements: blueprint fetch-resources-in-parallel
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Change-Id: I95f02f16b3d3dcbc1dff60d7fb35d31016e8679d
This commit is contained in:
Ivan Kolodyazhny 2018-03-15 13:00:48 +02:00
parent 56ae087995
commit b12264140c

View File

@ -24,6 +24,7 @@ from openstack_dashboard.api import cinder
from openstack_dashboard.api import neutron
from openstack_dashboard.api import nova
from openstack_dashboard.contrib.developer.profiler import api as profiler
from openstack_dashboard.utils import futurist_utils
LOG = logging.getLogger(__name__)
@ -415,9 +416,13 @@ def tenant_quota_usages(request, tenant_id=None, targets=None):
enabled_quotas &= set(targets)
disabled_quotas = set(QUOTA_FIELDS) - enabled_quotas
_get_tenant_compute_usages(request, usages, disabled_quotas, tenant_id)
_get_tenant_network_usages(request, usages, disabled_quotas, tenant_id)
_get_tenant_volume_usages(request, usages, disabled_quotas, tenant_id)
futurist_utils.call_functions_parallel(
(_get_tenant_compute_usages,
[request, usages, disabled_quotas, tenant_id]),
(_get_tenant_network_usages,
[request, usages, disabled_quotas, tenant_id]),
(_get_tenant_volume_usages,
[request, usages, disabled_quotas, tenant_id]))
return usages