diff --git a/nova/api/openstack/compute/routes.py b/nova/api/openstack/compute/routes.py index d414f3970e..9930aa0eaa 100644 --- a/nova/api/openstack/compute/routes.py +++ b/nova/api/openstack/compute/routes.py @@ -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 security_groups 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 servers from nova.api.openstack.compute import shelve @@ -190,6 +191,10 @@ server_metadata_controller = functools.partial(_create_controller, server_metadata.ServerMetadataController, [], []) +server_password_controller = functools.partial(_create_controller, + server_password.ServerPasswordController, [], []) + + simple_tenant_usage_controller = functools.partial(_create_controller, simple_tenant_usage.SimpleTenantUsageController, [], []) @@ -367,6 +372,10 @@ ROUTE_LIST = ( 'PUT': [server_metadata_controller, 'update'], 'DELETE': [server_metadata_controller, 'delete'], }), + ('/servers/{server_id}/os-server-password', { + 'GET': [server_password_controller, 'index'], + 'DELETE': [server_password_controller, 'clear'] + }), ) diff --git a/nova/api/openstack/compute/server_password.py b/nova/api/openstack/compute/server_password.py index c97c24bb15..4d9e25c649 100644 --- a/nova/api/openstack/compute/server_password.py +++ b/nova/api/openstack/compute/server_password.py @@ -23,9 +23,6 @@ from nova import compute from nova.policies import server_password as sp_policies -ALIAS = 'os-server-password' - - class ServerPasswordController(wsgi.Controller): """The Server Password API controller for the OpenStack API.""" def __init__(self): @@ -55,22 +52,3 @@ class ServerPasswordController(wsgi.Controller): meta = password.convert_password(context, None) instance.system_metadata.update(meta) 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 [] diff --git a/setup.cfg b/setup.cfg index 99e68cd1c4..cd35a57951 100644 --- a/setup.cfg +++ b/setup.cfg @@ -102,7 +102,6 @@ nova.api.v21.extensions = server_diagnostics = nova.api.openstack.compute.server_diagnostics:ServerDiagnostics server_external_events = nova.api.openstack.compute.server_external_events:ServerExternalEvents 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_groups = nova.api.openstack.compute.server_groups:ServerGroups services = nova.api.openstack.compute.services:Services