Skip to content

Commit 083eb4b

Browse files
committed
Delete require_instance_exists_using_uuid
This decorator is extremely old, virtual_interface_get_by_instance started using it in 0d9d248 (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
1 parent fb1fee6 commit 083eb4b

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

nova/db/sqlalchemy/api.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,6 @@ def wrapper(*args, **kwargs):
171171
return wrapper
172172

173173

174-
def require_instance_exists_using_uuid(f):
175-
"""Decorator to require the specified instance to exist.
176-
177-
Requires the wrapped function to use context and instance_uuid as
178-
their first two arguments.
179-
"""
180-
@functools.wraps(f)
181-
def wrapper(context, instance_uuid, *args, **kwargs):
182-
instance_get_by_uuid(context, instance_uuid)
183-
return f(context, instance_uuid, *args, **kwargs)
184-
185-
return wrapper
186-
187-
188174
def select_db_reader_mode(f):
189175
"""Decorator to select synchronous or asynchronous reader mode.
190176
@@ -1596,7 +1582,6 @@ def virtual_interface_get_by_uuid(context, vif_uuid):
15961582

15971583

15981584
@require_context
1599-
@require_instance_exists_using_uuid
16001585
@pick_context_manager_reader_allow_async
16011586
def virtual_interface_get_by_instance(context, instance_uuid):
16021587
"""Gets all virtual interfaces for instance.

0 commit comments

Comments
 (0)