From a019a9007d09d190ebd3005b4c13ba78e1ec0536 Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Wed, 16 Jan 2013 18:49:56 +0000 Subject: Cells: Add cells support to hypervisors extension This removes the DB calls from the extension and moves them into HostAPI(). The cells version of HostAPI() proxies them to the appropriate cell or cells. Change-Id: I17ff10e62d2f10b85a557edcc1509ca3b0d15a29 --- nova/compute/api.py | 14 ++++++++++++++ nova/compute/cells_api.py | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index f524a6705..0119f6602 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -2482,6 +2482,20 @@ class HostAPI(base.Base): host=host, state=state) + def compute_node_get(self, context, compute_id): + """Return compute node entry for particular integer ID.""" + return self.db.compute_node_get(context, int(compute_id)) + + def compute_node_get_all(self, context): + return self.db.compute_node_get_all(context) + + def compute_node_search_by_hypervisor(self, context, hypervisor_match): + return self.db.compute_node_search_by_hypervisor(context, + hypervisor_match) + + def compute_node_statistics(self, context): + return self.db.compute_node_statistics(context) + 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 88ff70790..50449df04 100644 --- a/nova/compute/cells_api.py +++ b/nova/compute/cells_api.py @@ -649,3 +649,19 @@ class HostAPI(compute_api.HostAPI): ending, host=host, state=state) + + def compute_node_get(self, context, compute_id): + """Get a compute node from a particular cell by its integer ID. + compute_id should be in the format of 'path!to!cell@ID'. + """ + return self.cells_rpcapi.compute_node_get(context, compute_id) + + def compute_node_get_all(self, context): + return self.cells_rpcapi.compute_node_get_all(context) + + def compute_node_search_by_hypervisor(self, context, hypervisor_match): + return self.cells_rpcapi.compute_node_get_all(context, + hypervisor_match=hypervisor_match) + + def compute_node_statistics(self, context): + return self.cells_rpcapi.compute_node_stats(context) -- cgit