Use plain routes list for server diagnostics endpoint

This patch adds server diagnostics 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: I308d12c1e152ac70b11f40024b68eaa371ce6658
This commit is contained in:
ghanshyam 2017-05-26 12:21:36 +03:00 committed by Stephen Finucane
parent 52245af444
commit af8274b542
3 changed files with 8 additions and 23 deletions

View File

@ -58,6 +58,7 @@ from nova.api.openstack.compute import quota_sets
from nova.api.openstack.compute import remote_consoles
from nova.api.openstack.compute import rescue
from nova.api.openstack.compute import security_groups
from nova.api.openstack.compute import server_diagnostics
from nova.api.openstack.compute import server_external_events
from nova.api.openstack.compute import server_metadata
from nova.api.openstack.compute import server_migrations
@ -216,6 +217,10 @@ server_controller = functools.partial(_create_controller,
)
server_diagnostics_controller = functools.partial(_create_controller,
server_diagnostics.ServerDiagnosticsController, [], [])
server_external_events_controller = functools.partial(_create_controller,
server_external_events.ServerExternalEventsController, [], [])
@ -433,6 +438,9 @@ ROUTE_LIST = (
('/servers/{id}/action', {
'POST': [server_controller, 'action']
}),
('/servers/{server_id}/diagnostics', {
'GET': [server_diagnostics_controller, 'index']
}),
('/servers/{server_id}/metadata', {
'GET': [server_metadata_controller, 'index'],
'POST': [server_metadata_controller, 'create'],

View File

@ -23,9 +23,6 @@ from nova import exception
from nova.policies import server_diagnostics as sd_policies
ALIAS = "os-server-diagnostics"
class ServerDiagnosticsController(wsgi.Controller):
def __init__(self):
self.compute_api = compute.API()
@ -51,22 +48,3 @@ class ServerDiagnosticsController(wsgi.Controller):
raise webob.exc.HTTPConflict(explanation=e.format_message())
except NotImplementedError:
common.raise_feature_not_supported()
class ServerDiagnostics(extensions.V21APIExtensionBase):
"""Allow Admins to view server diagnostics through server action."""
name = "ServerDiagnostics"
alias = ALIAS
version = 1
def get_resources(self):
parent_def = {'member_name': 'server', 'collection_name': 'servers'}
resources = [
extensions.ResourceExtension('diagnostics',
ServerDiagnosticsController(),
parent=parent_def)]
return resources
def get_controller_extensions(self):
return []

View File

@ -94,7 +94,6 @@ nova.api.v21.extensions =
remote_consoles = nova.api.openstack.compute.remote_consoles:RemoteConsoles
security_group_default_rules = nova.api.openstack.compute.security_group_default_rules:SecurityGroupDefaultRules
security_groups = nova.api.openstack.compute.security_groups:SecurityGroups
server_diagnostics = nova.api.openstack.compute.server_diagnostics:ServerDiagnostics
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