Prevent extra queries to load image storage data.

This commit is contained in:
Jake Moshenko 2014-07-22 16:46:36 -04:00
parent d4c41f2b11
commit 9ad7fc7a54

View file

@ -1089,6 +1089,9 @@ def _get_repository_images_base(namespace_name, repository_name, query_modifier)
# Make sure we're always retrieving the same image object.
image = location.storage.image
# Set the storage to the one we got from the location, to prevent another query
image.storage = location.storage
if not image.id in images:
images[image.id] = image
image.storage.locations = set()