yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #78206
[Bug 1823794] Re: We should remove require_instance_exists_using_uuid
Reviewed: https://review.opendev.org/650994
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=083eb4bc75eaed1b341c04c3692df2fabd68a0f4
Submitter: Zuul
Branch: master
commit 083eb4bc75eaed1b341c04c3692df2fabd68a0f4
Author: Matt Riedemann <mriedem.os@xxxxxxxxx>
Date: Mon Apr 8 17:30:46 2019 -0400
Delete require_instance_exists_using_uuid
This decorator is extremely old, virtual_interface_get_by_instance
started using it in 0d9d2487e2ca921ab54b1ecbe359c32ce8fb0c48 (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
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1823794
Title:
We should remove require_instance_exists_using_uuid
Status in OpenStack Compute (nova):
Fix Released
Bug description:
The require_instance_exists_using_uuid decorator is only used in one
place in the DB API:
https://github.com/openstack/nova/blob/fb1fee6772bb101eac83845bac9022df77113aaa/nova/db/sqlalchemy/api.py#L1599
This means that when listing virtual interfaces for an instance, we're
doing two queries, which is kind of dumb.
I believe this is the only place this is used:
https://github.com/openstack/nova/blob/fb1fee6772bb101eac83845bac9022df77113aaa/nova/objects/virtual_interface.py#L143
And VirtualInterfaceList.get_by_instance_uuid could be handled by
calling code to determine what to do about any missing vifs for the
instance if the caller cares.
It looks like all of the places that call
VirtualInterfaceList.get_by_instance_uuid already handle an empty list
so we could probably just remove require_instance_exists_using_uuid.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1823794/+subscriptions
References