Add config option to hide hypervisor resource provider summary

This change adds a new config option SHOW_RESOURCE_PROVIDER_SUMMARY which allows one to enable or disable the resource provider summary section in the admin view. It is useful in environments with a lot of compute nodes to keep the page small.

Default behavior is to keep the section enabled.

Change-Id: I39fd17efe50cb161517b06fec9492f5a7fa9425c
Signed-off-by: Dominic Schlegel <dominic.schlegel@hostpoint.ch>
This commit is contained in:
Dominic Schlegel committed 2026-08-21 00:38:51 +02:00
1 parent 949ffdead5
commit f9430592b1
7 files changed
+57 -5

No files matched your search

+13
View File
@@ -2577,6 +2577,19 @@ 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.
SHOW_RESOURCE_PROVIDER_SUMMARY
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 2026.2(Hibiscus)
Default: ``True``
This setting controls whether to show or hide the hypervisor resource provider
overview on the Admin -> Compute -> Hypervisors page. It is useful to
hide this in environments with a lot of hypervisor nodes in order to keep the
page small and useful. If this config is set to ``True`` it will show this
section and if it is set to ``False`` it will be hidden.
Swift
-----
@@ -22,6 +22,7 @@
</div>
</div>
</div>
{% if show_provider %}
<div class="quota-dynamic">
<h3>{% trans "Resource Providers Summary" %}</h3>
{% for provider in providers %}
@@ -63,6 +64,7 @@
</div>
{% endfor %}
</div>
{% endif %}
<div class="row-fluid">
<div class="col-sm-12">
{{ tab_group.render }}
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from django.test import override_settings
from django.urls import reverse
from openstack_dashboard import api
@@ -94,6 +95,21 @@ class HypervisorViewTest(test.BaseAdminViewTests):
self.mock_get_providers.assert_called_once_with(
test.IsHttpRequest())
self.assertTrue(res.context['show_provider'])
self.assertContains(res, 'Resource Providers Summary')
@test.create_mocks({api.nova: ['hypervisor_list',
'hypervisor_stats',
'service_list'],
api.placement: ['get_providers']})
@override_settings(SHOW_RESOURCE_PROVIDER_SUMMARY=False)
def test_disable_provider_view_summary(self):
res = self.client.get(reverse('horizon:admin:hypervisors:index'))
self.assertTemplateUsed(res, 'admin/hypervisors/index.html')
self.assertFalse(res.context['show_provider'])
self.assertNotContains(res, 'Resource Providers Summary')
self.mock_get_providers.assert_not_called()
@test.create_mocks({api.nova: ['hypervisor_list',
'hypervisor_stats',
'service_list'],
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from horizon import exceptions
@@ -37,11 +38,13 @@ class AdminIndexView(tabs.TabbedTableView):
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve hypervisor statistics.'))
try:
context["providers"] = api.placement.get_providers(self.request)
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve providers statistics.'))
context["show_provider"] = settings.SHOW_RESOURCE_PROVIDER_SUMMARY
if context["show_provider"]:
try:
context["providers"] = api.placement.get_providers(self.request)
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve providers statistics.'))
return context
+5
View File
@@ -582,3 +582,8 @@ KUBECONFIG_CERTIFICATE_AUTHORITY_DATA = ""
# Services may require a System Scope token for certain operations. This
# settings enables the use of the system scope token on per-service basis.
SYSTEM_SCOPE_SERVICES = []
# Set this to False in order to disable the resource provider summary overview
# pie charts on the Admin -> Compute -> Hypervisors page. Recommended for
# environments with a large number of hypervisors (100+).
SHOW_RESOURCE_PROVIDER_SUMMARY = True
@@ -404,3 +404,8 @@ SECURITY_GROUP_RULES = {
# Help URL can be made available for the client. To provide a help URL, edit the
# following attribute to the URL of your choice.
#HORIZON_CONFIG["help_url"] = "http://openstack.mycompany.org"
# Set to False to disable the resource provider summary overview pie charts
# on the Admin -> Compute -> Hypervisors page. Recommended for environments
# with a large number of hypervisors (100+).
#SHOW_RESOURCE_PROVIDER_SUMMARY = True
@@ -0,0 +1,8 @@
---
features:
- |
Adds a config option ``SHOW_RESOURCE_PROVIDER_SUMMARY`` so one
can disable the hypervisor resource provider overview in admin
section. This can be useful in an environment with a lot of
hypervisor nodes to keep the page small and useful. Default is
True to keep current behaviour and show this section.