Merge "Make instance_get_all_*() funtions support the smart extra.$foo columns"

This commit is contained in:
Jenkins 2014-12-17 14:16:29 +00:00 committed by Gerrit Code Review
commit cf17339af6

View File

@ -1901,6 +1901,9 @@ def instance_get_all_by_filters_sort(context, filters, limit=None, marker=None,
query_prefix = session.query(models.Instance)
for column in columns_to_join_new:
if 'extra.' in column:
query_prefix = query_prefix.options(undefer(column))
else:
query_prefix = query_prefix.options(joinedload(column))
# Note: order_by is done in the sqlalchemy.utils.py paginate_query(),
@ -2229,6 +2232,9 @@ def instance_get_active_by_window_joined(context, begin, end=None,
_manual_join_columns(columns_to_join))
for column in columns_to_join_new:
if 'extra.' in column:
query = query.options(undefer(column))
else:
query = query.options(joinedload(column))
query = query.filter(or_(models.Instance.terminated_at == null(),