From 6ff32210772a67a1b526d9d784030afc90f3ce99 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Tue, 5 Feb 2013 18:12:02 -0800 Subject: Use joined version of db.api calls Replace db.instance_get_active_by_window with db.instance_get_active_by_window_joined Remove db.instance_get_active_by_window as it is now unused When moving over to nova.db.api not returning sqlalchemy objects non-joined db calls (lazy loaded) won't work. Partially implements bp db-api-cleanup Change-Id: Iec647792a049d53862a45f95accd7f46e483aa17 --- nova/db/api.py | 11 ----------- nova/db/sqlalchemy/api.py | 19 ------------------- 2 files changed, 30 deletions(-) (limited to 'nova/db') diff --git a/nova/db/api.py b/nova/db/api.py index 8d3f0fa4d..ffd153a46 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -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. diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index fb39600c4..74ee6c9e7 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -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): -- cgit