Update get_by_project_id on InstanceMappingList

The get_by_project_id method of InstanceMappingList was not previously
updated to account for backrefs being added. This fixes that, and brings
the actual method in line with the unit test. The method was broken
before but it was not exposed.

Change-Id: I5ca7549bdb1a91011494bc9eb64ca350ca275b54
This commit is contained in:
Andrew Laski
2016-04-05 14:19:13 -04:00
parent 97808003ac
commit a7464120c7

View File

@@ -143,9 +143,7 @@ class InstanceMappingList(base.ObjectListBase, base.NovaObject):
@db_api.api_context_manager.reader
def _get_by_project_id_from_db(context, project_id):
return (context.session.query(api_models.InstanceMapping)
.join(api_models.CellMapping)
.with_entities(api_models.InstanceMapping,
api_models.CellMapping)
.options(joinedload('cell_mapping'))
.filter(
api_models.InstanceMapping.project_id == project_id)).all()