Use plain routes list for server-password endpoint instead of stevedore

This patch adds server-password 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: Ic05b858fa5db711e0e755e6d7c2beaffbc9bc2b8
This commit is contained in:
Kevin_Zheng
2017-05-03 16:23:33 +08:00
parent 68bbddd8ae
commit 6501ba0eb4
3 changed files with 9 additions and 23 deletions
+9
View File
@@ -54,6 +54,7 @@ from nova.api.openstack.compute import remote_consoles
from nova.api.openstack.compute import rescue from nova.api.openstack.compute import rescue
from nova.api.openstack.compute import security_groups from nova.api.openstack.compute import security_groups
from nova.api.openstack.compute import server_metadata from nova.api.openstack.compute import server_metadata
from nova.api.openstack.compute import server_password
from nova.api.openstack.compute import server_usage from nova.api.openstack.compute import server_usage
from nova.api.openstack.compute import servers from nova.api.openstack.compute import servers
from nova.api.openstack.compute import shelve from nova.api.openstack.compute import shelve
@@ -190,6 +191,10 @@ server_metadata_controller = functools.partial(_create_controller,
server_metadata.ServerMetadataController, [], []) server_metadata.ServerMetadataController, [], [])
server_password_controller = functools.partial(_create_controller,
server_password.ServerPasswordController, [], [])
simple_tenant_usage_controller = functools.partial(_create_controller, simple_tenant_usage_controller = functools.partial(_create_controller,
simple_tenant_usage.SimpleTenantUsageController, [], []) simple_tenant_usage.SimpleTenantUsageController, [], [])
@@ -367,6 +372,10 @@ ROUTE_LIST = (
'PUT': [server_metadata_controller, 'update'], 'PUT': [server_metadata_controller, 'update'],
'DELETE': [server_metadata_controller, 'delete'], 'DELETE': [server_metadata_controller, 'delete'],
}), }),
('/servers/{server_id}/os-server-password', {
'GET': [server_password_controller, 'index'],
'DELETE': [server_password_controller, 'clear']
}),
) )
@@ -23,9 +23,6 @@ from nova import compute
from nova.policies import server_password as sp_policies from nova.policies import server_password as sp_policies
ALIAS = 'os-server-password'
class ServerPasswordController(wsgi.Controller): class ServerPasswordController(wsgi.Controller):
"""The Server Password API controller for the OpenStack API.""" """The Server Password API controller for the OpenStack API."""
def __init__(self): def __init__(self):
@@ -55,22 +52,3 @@ class ServerPasswordController(wsgi.Controller):
meta = password.convert_password(context, None) meta = password.convert_password(context, None)
instance.system_metadata.update(meta) instance.system_metadata.update(meta)
instance.save() instance.save()
class ServerPassword(extensions.V21APIExtensionBase):
"""Server password support."""
name = "ServerPassword"
alias = ALIAS
version = 1
def get_resources(self):
resources = [
extensions.ResourceExtension(
ALIAS, ServerPasswordController(),
collection_actions={'clear': 'DELETE'},
parent=dict(member_name='server', collection_name='servers'))]
return resources
def get_controller_extensions(self):
return []
-1
View File
@@ -102,7 +102,6 @@ nova.api.v21.extensions =
server_diagnostics = nova.api.openstack.compute.server_diagnostics:ServerDiagnostics server_diagnostics = nova.api.openstack.compute.server_diagnostics:ServerDiagnostics
server_external_events = nova.api.openstack.compute.server_external_events:ServerExternalEvents server_external_events = nova.api.openstack.compute.server_external_events:ServerExternalEvents
server_migrations = nova.api.openstack.compute.server_migrations:ServerMigrations server_migrations = nova.api.openstack.compute.server_migrations:ServerMigrations
server_password = nova.api.openstack.compute.server_password:ServerPassword
server_tags = nova.api.openstack.compute.server_tags:ServerTags server_tags = nova.api.openstack.compute.server_tags:ServerTags
server_groups = nova.api.openstack.compute.server_groups:ServerGroups server_groups = nova.api.openstack.compute.server_groups:ServerGroups
services = nova.api.openstack.compute.services:Services services = nova.api.openstack.compute.services:Services