From 782dd69de4c6661eeb889b4e5b3b1b8df9d228b6 Mon Sep 17 00:00:00 2001 From: Matthew Sherborne Date: Thu, 7 Mar 2013 08:06:21 +1000 Subject: Prepare services index method for use with cells Move the api.openstack.compute.contrib.services' index method's logic out of the openstack api layer and into the compute api layer. The addition of the availability_zone information is already done by the host api. For this reason it was removed from the openstack api layer. The behaviour of the call remains the same, only the functionality has been moved. This patch makes the functionality automatically work in cells. Work towards: bug #1150499 Change-Id: Ia9489f11608167aed5168ccb3b670f395f7de5f7 --- nova/api/openstack/compute/contrib/services.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/services.py b/nova/api/openstack/compute/contrib/services.py index 3afd5ff45..fb7b9d591 100644 --- a/nova/api/openstack/compute/contrib/services.py +++ b/nova/api/openstack/compute/contrib/services.py @@ -20,7 +20,7 @@ import webob.exc from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.api.openstack import xmlutil -from nova import availability_zones +from nova import compute from nova import db from nova import exception from nova.openstack.common import log as logging @@ -58,6 +58,10 @@ class ServicesUpdateTemplate(xmlutil.TemplateBuilder): class ServiceController(object): + + def __init__(self): + self.host_api = compute.HostAPI() + @wsgi.serializers(xml=ServicesIndexTemplate) def index(self, req): """ @@ -66,8 +70,8 @@ class ServiceController(object): context = req.environ['nova.context'] authorize(context) now = timeutils.utcnow() - services = db.service_get_all(context) - services = availability_zones.set_availability_zones(context, services) + services = self.host_api.service_get_all( + context, set_zones=True) host = '' if 'host' in req.GET: -- cgit