From be992f7b9a1b02a238b3a0c15c3de67e8aedd4ba Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Wed, 16 Jan 2013 18:49:45 +0000 Subject: Cells: Add cells support to instance_usage_audit_log api extension Adds task_log_get_all() call to HostAPI() so that we can use the local DB when cells is disabled or proxy via cells if cells is enabled. Adds task_log_get_all() call to cells. Change-Id: I9e78c17fcf70f98903d0a26c1de3e2581b8977ad --- .../openstack/compute/contrib/instance_usage_audit_log.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/instance_usage_audit_log.py b/nova/api/openstack/compute/contrib/instance_usage_audit_log.py index 4b0afdecf..512b58869 100644 --- a/nova/api/openstack/compute/contrib/instance_usage_audit_log.py +++ b/nova/api/openstack/compute/contrib/instance_usage_audit_log.py @@ -21,7 +21,7 @@ import datetime import webob.exc from nova.api.openstack import extensions -from nova import db +from nova import compute from nova.openstack.common import cfg from nova import utils @@ -34,6 +34,8 @@ authorize = extensions.extension_authorizer('compute', class InstanceUsageAuditLogController(object): + def __init__(self): + self.host_api = compute.HostAPI() def index(self, req): context = req.environ['nova.context'] @@ -78,12 +80,13 @@ class InstanceUsageAuditLogController(object): begin = defbegin if end is None: end = defend - task_logs = db.task_log_get_all(context, "instance_usage_audit", - begin, end) + task_logs = self.host_api.task_log_get_all(context, + "instance_usage_audit", + begin, end) # We do this this way to include disabled compute services, # which can have instances on them. (mdragon) - services = [svc for svc in db.service_get_all(context) - if svc['topic'] == CONF.compute_topic] + filters = {'topic': CONF.compute_topic} + services = self.host_api.service_get_all(context, filters=filters) hosts = set(serv['host'] for serv in services) seen_hosts = set() done_hosts = set() -- cgit