Use plain routes list for os-services endpoint instead of stevedore

This patch adds os-services related routes by a plain list, instead of
using stevedore. After all the Nova API endpoints moves to the plain
routes list, the usage of stevedore for API loading will be removed from
Nova.

Partial-implement-blueprint api-no-more-extensions-pike

Change-Id: Ib145494b9fc3c660176098e4168cf72db507f34d
This commit is contained in:
jichenjc 2017-04-28 11:59:24 +08:00 committed by He Jie Xu
parent 50e825c861
commit 95add6a97b
3 changed files with 12 additions and 19 deletions

View File

@ -71,6 +71,7 @@ from nova.api.openstack.compute import server_password
from nova.api.openstack.compute import server_tags
from nova.api.openstack.compute import server_usage
from nova.api.openstack.compute import servers
from nova.api.openstack.compute import services
from nova.api.openstack.compute import shelve
from nova.api.openstack.compute import simple_tenant_usage
from nova.api.openstack.compute import suspend_server
@ -271,6 +272,10 @@ server_tags_controller = functools.partial(_create_controller,
server_tags.ServerTagsController, [], [])
services_controller = functools.partial(_create_controller,
services.ServiceController, [], [])
simple_tenant_usage_controller = functools.partial(_create_controller,
simple_tenant_usage.SimpleTenantUsageController, [], [])
@ -475,6 +480,13 @@ ROUTE_LIST = (
('/os-server-external-events', {
'POST': [server_external_events_controller, 'create']
}),
('/os-services', {
'GET': [services_controller, 'index']
}),
('/os-services/{id}', {
'PUT': [services_controller, 'update'],
'DELETE': [services_controller, 'delete']
}),
('/os-simple-tenant-usage', {
'GET': [simple_tenant_usage_controller, 'index']
}),

View File

@ -26,8 +26,6 @@ from nova.policies import services as services_policies
from nova import servicegroup
from nova import utils
ALIAS = "os-services"
class ServiceController(wsgi.Controller):
@ -225,19 +223,3 @@ class ServiceController(wsgi.Controller):
actions = self.actions
return self._perform_action(req, id, body, actions)
class Services(extensions.V21APIExtensionBase):
"""Services support."""
name = "Services"
alias = ALIAS
version = 1
def get_resources(self):
resources = [extensions.ResourceExtension(ALIAS,
ServiceController())]
return resources
def get_controller_extensions(self):
return []

View File

@ -90,7 +90,6 @@ nova.api.v21.extensions =
security_group_default_rules = nova.api.openstack.compute.security_group_default_rules:SecurityGroupDefaultRules
security_groups = nova.api.openstack.compute.security_groups:SecurityGroups
server_groups = nova.api.openstack.compute.server_groups:ServerGroups
services = nova.api.openstack.compute.services:Services
tenant_networks = nova.api.openstack.compute.tenant_networks:TenantNetworks
user_data = nova.api.openstack.compute.user_data:UserData
versions = nova.api.openstack.compute.versionsV21:Versions