diff --git a/doc/source/configuration/settings.rst b/doc/source/configuration/settings.rst index 91101e8b13..951d6c0bff 100644 --- a/doc/source/configuration/settings.rst +++ b/doc/source/configuration/settings.rst @@ -2347,6 +2347,18 @@ as nova provides all features in the recent API versions. * ``Services`` * ``Shelve`` +OPENSTACK_USE_SIMPLE_TENANT_USAGE +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 19.0.0(Wallaby) + +Default: ``True`` + +This setting controls whether ``SimpleTenantUsage`` nova API is used in the +usage overview. According to feedbacks to the horizon team, the usage of +``SimpleTenantUsage`` can cause performance issues in the nova API in larger +deployments. Try to set this to ``False`` for such cases. + Swift ----- diff --git a/openstack_dashboard/defaults.py b/openstack_dashboard/defaults.py index 2ca25b2445..a324dcac55 100644 --- a/openstack_dashboard/defaults.py +++ b/openstack_dashboard/defaults.py @@ -462,6 +462,13 @@ OPENSTACK_NEUTRON_NETWORK = { OPENSTACK_INSTANCE_RETRIEVE_IP_ADDRESSES = True OPENSTACK_NOVA_EXTENSIONS_BLACKLIST = [] + +# This setting controls whether SimpleTenantUsage nova API is used in the usage +# overview. According to feedbacks to the horizon team, the usage of +# SimpleTenantUsage can cause performance issues in the nova API in larger +# deployments. Try to set this to ``False`` for such cases. +OPENSTACK_USE_SIMPLE_TENANT_USAGE = True + # The Xen Hypervisor has the ability to set the mount point for volumes # attached to instances (other Hypervisors currently do not). Setting # can_set_mount_point to True will add the option to set the mount point diff --git a/openstack_dashboard/usage/base.py b/openstack_dashboard/usage/base.py index ba14add13e..13aebbb278 100644 --- a/openstack_dashboard/usage/base.py +++ b/openstack_dashboard/usage/base.py @@ -112,7 +112,9 @@ class BaseUsage(object): return [] def summarize(self, start, end): - if not api.nova.extension_supported('SimpleTenantUsage', self.request): + if not (settings.OPENSTACK_USE_SIMPLE_TENANT_USAGE and + api.nova.extension_supported('SimpleTenantUsage', + self.request)): return if start <= end and start <= self.today: diff --git a/openstack_dashboard/usage/views.py b/openstack_dashboard/usage/views.py index c597611689..727a982d02 100644 --- a/openstack_dashboard/usage/views.py +++ b/openstack_dashboard/usage/views.py @@ -12,6 +12,7 @@ import collections +from django.conf import settings from django.contrib.humanize.templatetags import humanize as humanize_filters from django.utils.translation import pgettext_lazy from django.utils.translation import ugettext_lazy as _ @@ -66,8 +67,10 @@ class UsageView(tables.DataTableView): context['usage'] = self.usage try: - context['simple_tenant_usage_enabled'] = \ + context['simple_tenant_usage_enabled'] = ( + settings.OPENSTACK_USE_SIMPLE_TENANT_USAGE and api.nova.extension_supported('SimpleTenantUsage', self.request) + ) except Exception: context['simple_tenant_usage_enabled'] = True return context diff --git a/releasenotes/notes/use-simple-tenant-usage-f713a2eff9357458.yaml b/releasenotes/notes/use-simple-tenant-usage-f713a2eff9357458.yaml new file mode 100644 index 0000000000..5636a7fc18 --- /dev/null +++ b/releasenotes/notes/use-simple-tenant-usage-f713a2eff9357458.yaml @@ -0,0 +1,17 @@ +--- +features: + - | + A new setting ``OPENSTACK_USE_SIMPLE_TENANT_USAGE`` was introduced + as a replacement of ``SimpleTenantUsage`` in + the deprecated ``OPENSTACK_NOVA_EXTENSIONS_BLACKLIST`` setting. + This new setting controls whether ``SimpleTenantUsage`` nova API is used + in the usage overview. According to feedbacks to the horizon team, + the usage of ``SimpleTenantUsage`` can cause performance issues in the + nova API in larger deployments. + Try to set this to ``False`` for such cases. +upgrade: + - | + Considering the deprecation of ``OPENSTACK_NOVA_EXTENSIONS_BLACKLIST``, + set a new setting ``OPENSTACK_USE_SIMPLE_TENANT_USAGE`` to ``False`` + if you specify ``SimpleTenantUsage`` in + ``OPENSTACK_USE_SIMPLE_TENANT_USAGE``