diff --git a/config.yaml b/config.yaml index 14399622..d712b067 100644 --- a/config.yaml +++ b/config.yaml @@ -428,6 +428,18 @@ options: Openstack mostly defaults to using public endpoints for internal communication between services. If set to True this option will configure services to use internal endpoints where possible. + retrieve-network-data-when-listing-instances: + type: boolean + default: True + description: | + By setting this option to False, it can be used as a workaround to improve performance and + avoid downtime when the Project > Instances page is timing out due to the neutron requests + to retrieve ports and floating IPs taking too long. The side effect is that actions such + as adding/removing floating IPs or interfaces no longer immediately update the network + data in instance list, requiring a manual reload of the page. The default value for this + config is True. For more information see + https://docs.openstack.org/horizon/latest/configuration/settings.html#openstack-instance-retrieve-ip-addresses + and LP#2045168. wsgi-socket-rotation: type: boolean default: True diff --git a/hooks/horizon_contexts.py b/hooks/horizon_contexts.py index a568013a..e8ea442d 100644 --- a/hooks/horizon_contexts.py +++ b/hooks/horizon_contexts.py @@ -257,6 +257,8 @@ class HorizonContext(OSContextGenerator): config('disable-instance-snapshot')), 'disable_password_reveal': config('disable-password-reveal'), 'enforce_password_check': config('enforce-password-check'), + 'retrieve_network_data_when_listing_instances': + config('retrieve-network-data-when-listing-instances'), } return ctxt diff --git a/templates/stein/local_settings.py b/templates/stein/local_settings.py index 4e02326e..4720451a 100644 --- a/templates/stein/local_settings.py +++ b/templates/stein/local_settings.py @@ -15,7 +15,7 @@ from openstack_dashboard.settings import HORIZON_CONFIG DEBUG = {{ debug }} TEMPLATE_DEBUG = DEBUG - +OPENSTACK_INSTANCE_RETRIEVE_IP_ADDRESSES = {{ retrieve_network_data_when_listing_instances }} # WEBROOT is the location relative to Webserver root # should end with a slash. diff --git a/unit_tests/test_horizon_contexts.py b/unit_tests/test_horizon_contexts.py index 4d30ef89..5cececdc 100644 --- a/unit_tests/test_horizon_contexts.py +++ b/unit_tests/test_horizon_contexts.py @@ -126,6 +126,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -161,6 +162,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -197,6 +199,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": True, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -233,6 +236,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": False, + "retrieve_network_data_when_listing_instances": True, } ) @@ -268,6 +272,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -303,6 +308,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -339,6 +345,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -378,6 +385,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -413,6 +421,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -423,6 +432,8 @@ class TestHorizonContexts(CharmTestCase): self.test_config.set('neutron-network-firewall', True) self.test_config.set('neutron-network-vpn', True) self.test_config.set('cinder-backup', True) + self.test_config.set( + 'retrieve-network-data-when-listing-instances', False) self.assertEqual(horizon_contexts.HorizonContext()(), {'compress_offline': True, 'debug': False, 'customization_module': '', @@ -453,6 +464,8 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": ( + False), } ) @@ -488,6 +501,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -523,6 +537,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -559,6 +574,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -595,6 +611,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -631,6 +648,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -667,6 +685,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } ) @@ -703,6 +722,7 @@ class TestHorizonContexts(CharmTestCase): "disable_instance_snapshot": False, "disable_password_reveal": False, "enforce_password_check": True, + "retrieve_network_data_when_listing_instances": True, } )