Add OPENSTACK_NOVA_EXTENSIONS_BLACKLIST option to settings
This lets us disable any Nova extension we like, not just the simple tenant usage. Closes-bug: #1474241 Change-Id: I21840054225cd59cc62fd4f070172a2847173b14
This commit is contained in:
parent
750df2441e
commit
18f4b752b8
@ -1076,6 +1076,18 @@ http://tinyurl.com/anticlickjack
|
||||
``False`` to exclude the frame-busting code and allow iframe embedding.
|
||||
|
||||
|
||||
``OPENSTACK_NOVA_EXTENSIONS_BLACKLIST``
|
||||
---------------------------------------
|
||||
|
||||
.. versionadded:: 8.0.0(Liberty)
|
||||
|
||||
Default: ``[]``
|
||||
|
||||
Ignore all listed Nova extensions, and behave as if they were unsupported.
|
||||
Can be used to selectively disable certain costly extensions for performance
|
||||
reasons.
|
||||
|
||||
|
||||
Django Settings (Partial)
|
||||
=========================
|
||||
|
||||
|
@ -935,7 +935,15 @@ def interface_detach(request, server, port_id):
|
||||
|
||||
@memoized
|
||||
def list_extensions(request):
|
||||
return nova_list_extensions.ListExtManager(novaclient(request)).show_all()
|
||||
"""List all nova extensions, except the ones in the blacklist."""
|
||||
|
||||
blacklist = set(getattr(settings,
|
||||
'OPENSTACK_NOVA_EXTENSIONS_BLACKLIST', []))
|
||||
return [
|
||||
extension for extension in
|
||||
nova_list_extensions.ListExtManager(novaclient(request)).show_all()
|
||||
if extension.name not in blacklist
|
||||
]
|
||||
|
||||
|
||||
@memoized
|
||||
|
@ -156,11 +156,14 @@ class NovaRestTestCase(test.TestCase):
|
||||
# Extensions
|
||||
#
|
||||
@mock.patch.object(nova.api, 'nova')
|
||||
@mock.patch.object(settings,
|
||||
'OPENSTACK_NOVA_EXTENSIONS_BLACKLIST', ['baz'])
|
||||
def _test_extension_list(self, nc):
|
||||
request = self.mock_rest_request()
|
||||
nc.list_extensions.return_value = [
|
||||
mock.Mock(**{'to_dict.return_value': {'name': 'foo'}}),
|
||||
mock.Mock(**{'to_dict.return_value': {'name': 'bar'}}),
|
||||
mock.Mock(**{'to_dict.return_value': {'name': 'baz'}}),
|
||||
]
|
||||
response = nova.Extensions().get(request)
|
||||
self.assertStatusCode(response, 200)
|
||||
|
Loading…
x
Reference in New Issue
Block a user