The volume_image_metadata field was missing from the volume list
because we tried to filter VolumeGlanceMetadata against a non-existent
project_id field. Filtering should be done on the Volume associated
to the VolumeGlanceMetadata instead.
Move project_id filtering out of model_query as it assumes
the project_id field is in the queried model itself.
Build the filter ourselves against Volume.
Change-Id: I6053708296f2b5e24513dc87ed63da0f67c220ae
Closes-bug: #
1337526
@require_context
def _volume_glance_metadata_get_all(context, session=None):
- rows = model_query(context,
- models.VolumeGlanceMetadata,
- project_only=True,
- session=session).\
- filter_by(deleted=False).\
- all()
-
- return rows
+ query = model_query(context,
+ models.VolumeGlanceMetadata,
+ session=session)
+ if is_user_context(context):
+ query = query.filter(models.Volume.project_id == context.project_id)
+ return query.all()
@require_context