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 --- nova/compute/api.py | 11 +++++++++++ nova/compute/cells_api.py | 14 ++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 394f09e11..f524a6705 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -2471,6 +2471,17 @@ class HostAPI(base.Base): """Return all instances on the given host.""" return self.db.instance_get_all_by_host(context, host_name) + def task_log_get_all(self, context, task_name, period_beginning, + period_ending, host=None, state=None): + """Return the task logs within a given range, optionally + filtering by host and/or state. + """ + return self.db.task_log_get_all(context, task_name, + period_beginning, + period_ending, + host=host, + state=state) + class AggregateAPI(base.Base): """Sub-set of the Compute Manager API for managing host aggregates.""" diff --git a/nova/compute/cells_api.py b/nova/compute/cells_api.py index 98a49417f..88ff70790 100644 --- a/nova/compute/cells_api.py +++ b/nova/compute/cells_api.py @@ -635,3 +635,17 @@ class HostAPI(compute_api.HostAPI): instances = [i for i in instances if i['cell_name'] == cell_name] return instances + + def task_log_get_all(self, context, task_name, beginning, ending, + host=None, state=None): + """Return the task logs within a given range from cells, + optionally filtering by the host and/or state. For cells, the + host should be a path like 'path!to!cell@host'. If no @host + is given, only task logs from a particular cell will be returned. + """ + return self.cells_rpcapi.task_log_get_all(context, + task_name, + beginning, + ending, + host=host, + state=state) -- cgit