Merge "Use joined version of db.api calls"

This commit is contained in:
Jenkins 2013-02-09 05:36:48 +00:00 committed by Gerrit Code Review
commit e15698fe74
2 changed files with 0 additions and 30 deletions

View File

@ -606,17 +606,6 @@ def instance_get_all_by_filters(context, filters, sort_key='created_at',
marker=marker)
def instance_get_active_by_window(context, begin, end=None, project_id=None,
host=None):
"""Get instances active during a certain time window.
Specifying a project_id will filter for a certain project.
Specifying a host will filter for instances on a given compute host.
"""
return IMPL.instance_get_active_by_window(context, begin, end,
project_id, host)
def instance_get_active_by_window_joined(context, begin, end=None,
project_id=None, host=None):
"""Get instances and joins active during a certain time window.

View File

@ -1656,25 +1656,6 @@ def regex_filter(query, model, filters):
return query
@require_context
def instance_get_active_by_window(context, begin, end=None,
project_id=None, host=None):
"""Return instances that were active during window."""
session = get_session()
query = session.query(models.Instance)
query = query.filter(or_(models.Instance.terminated_at == None,
models.Instance.terminated_at > begin))
if end:
query = query.filter(models.Instance.launched_at < end)
if project_id:
query = query.filter_by(project_id=project_id)
if host:
query = query.filter_by(host=host)
return query.all()
@require_admin_context
def instance_get_active_by_window_joined(context, begin, end=None,
project_id=None, host=None):