Returning a tuple instead of list in list_extensions
extension_supported is decorated with memoized_with_request(list_extensions, 1). This means that list_extensions is called to build the args for extension_supported and then make a hash. list_extensions was returning a list which is unhashable. We now return a tuple which has the following advantages: 1: is hashable. 2: tuples use less memory than lists in python, and should be use when we do not need a mutable. Change-Id: I92be6ef7880c6ac76847ec9cc8b2c83a6fd009b2 Closes-Bug: #1596545
This commit is contained in:
parent
fee1de02aa
commit
eb3180f827
@ -1042,11 +1042,11 @@ def list_extensions(nova_api):
|
||||
"""List all nova extensions, except the ones in the blacklist."""
|
||||
blacklist = set(getattr(settings,
|
||||
'OPENSTACK_NOVA_EXTENSIONS_BLACKLIST', []))
|
||||
return [
|
||||
return tuple(
|
||||
extension for extension in
|
||||
nova_list_extensions.ListExtManager(nova_api).show_all()
|
||||
if extension.name not in blacklist
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@memoized_with_request(list_extensions, 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user