Delete require_instance_exists_using_uuid
This decorator is extremely old, virtual_interface_get_by_instance
started using it in 0d9d2487e2
(Folsom).
virtual_interface_get_by_instance is the only thing still using it
and doesn't need to. The only thing which calls that DB API is
VirtualInterfaceList.get_by_instance_uuid and everything calling that
handles an empty list (and InstanceNotFound is probably unexpected
in anything using those anyway, i.e. they'd need to already get the
instance to lookup the VIFs).
The decorator is also not fast - it calls instance_get_by_uuid
which builds up a query on the Instance model and also joins on
the metadata and system_metadata tables which is totally unnecessary
for an existence type check.
Anyway, there seems to be no good reason for having that decorator
anymore as nothing else uses it, for example
block_device_mapping_get_all_by_instance.
Change-Id: I7dcb47f916908319ae58db12e9ab3dd8dad9ff39
Closes-Bug: #1823794
This commit is contained in:
parent
fb1fee6772
commit
083eb4bc75
@ -171,20 +171,6 @@ def require_context(f):
|
||||
return wrapper
|
||||
|
||||
|
||||
def require_instance_exists_using_uuid(f):
|
||||
"""Decorator to require the specified instance to exist.
|
||||
|
||||
Requires the wrapped function to use context and instance_uuid as
|
||||
their first two arguments.
|
||||
"""
|
||||
@functools.wraps(f)
|
||||
def wrapper(context, instance_uuid, *args, **kwargs):
|
||||
instance_get_by_uuid(context, instance_uuid)
|
||||
return f(context, instance_uuid, *args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
def select_db_reader_mode(f):
|
||||
"""Decorator to select synchronous or asynchronous reader mode.
|
||||
|
||||
@ -1596,7 +1582,6 @@ def virtual_interface_get_by_uuid(context, vif_uuid):
|
||||
|
||||
|
||||
@require_context
|
||||
@require_instance_exists_using_uuid
|
||||
@pick_context_manager_reader_allow_async
|
||||
def virtual_interface_get_by_instance(context, instance_uuid):
|
||||
"""Gets all virtual interfaces for instance.
|
||||
|
Loading…
Reference in New Issue
Block a user