summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorChris Behrens <cbehrens@codestud.com>2013-01-16 18:49:45 +0000
committerChris Behrens <cbehrens@codestud.com>2013-02-07 07:16:43 +0000
commitbe992f7b9a1b02a238b3a0c15c3de67e8aedd4ba (patch)
tree02c6ab2ea7e2d722e827641915259e3bd0512abf /nova/api
parent24018cabb462f8aeec921d77427e9d65b7068793 (diff)
downloadnova-be992f7b9a1b02a238b3a0c15c3de67e8aedd4ba.tar.gz
nova-be992f7b9a1b02a238b3a0c15c3de67e8aedd4ba.tar.xz
nova-be992f7b9a1b02a238b3a0c15c3de67e8aedd4ba.zip
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
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/instance_usage_audit_log.py13
1 files changed, 8 insertions, 5 deletions
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()