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

This patch adds os-interface 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: I4afbc20e60bb8d324027903879d60f808595dac1
This commit is contained in:
He Jie Xu
2017-04-26 15:52:22 +08:00
committed by Stephen Finucane
parent a1eca94d89
commit 01e3fa9246
3 changed files with 13 additions and 26 deletions
@@ -30,9 +30,6 @@ from nova import network
from nova.policies import attach_interfaces as ai_policies
ALIAS = 'os-attach-interfaces'
def _translate_interface_attachment_view(port_info):
"""Maps keys for interface attachment details view."""
return {
@@ -177,25 +174,3 @@ class InterfaceAttachmentController(wsgi.Controller):
except exception.InstanceInvalidState as state_error:
common.raise_http_conflict_for_instance_invalid_state(state_error,
'detach_interface', server_id)
class AttachInterfaces(extensions.V21APIExtensionBase):
"""Attach interface support."""
name = "AttachInterfaces"
alias = ALIAS
version = 1
def get_resources(self):
res = [extensions.ResourceExtension('os-interface',
InterfaceAttachmentController(),
parent=dict(
member_name='server',
collection_name='servers'))]
return res
def get_controller_extensions(self):
"""It's an abstract function V21APIExtensionBase and the extension
will not be loaded without it.
"""
return []
+13
View File
@@ -22,6 +22,7 @@ from nova.api.openstack.compute import admin_password
from nova.api.openstack.compute import agents
from nova.api.openstack.compute import aggregates
from nova.api.openstack.compute import assisted_volume_snapshots
from nova.api.openstack.compute import attach_interfaces
from nova.api.openstack.compute import availability_zone
from nova.api.openstack.compute import certificates
from nova.api.openstack.compute import config_drive
@@ -216,6 +217,10 @@ server_metadata_controller = functools.partial(_create_controller,
server_metadata.ServerMetadataController, [], [])
server_os_interface_controller = functools.partial(_create_controller,
attach_interfaces.InterfaceAttachmentController, [], [])
server_password_controller = functools.partial(_create_controller,
server_password.ServerPasswordController, [], [])
@@ -420,6 +425,14 @@ ROUTE_LIST = (
'PUT': [server_metadata_controller, 'update'],
'DELETE': [server_metadata_controller, 'delete'],
}),
('/servers/{server_id}/os-interface', {
'GET': [server_os_interface_controller, 'index'],
'POST': [server_os_interface_controller, 'create']
}),
('/servers/{server_id}/os-interface/{id}', {
'GET': [server_os_interface_controller, 'show'],
'DELETE': [server_os_interface_controller, 'delete']
}),
('/servers/{server_id}/os-server-password', {
'GET': [server_password_controller, 'index'],
'DELETE': [server_password_controller, 'clear']
-1
View File
@@ -72,7 +72,6 @@ wsgi_scripts =
nova-metadata-wsgi = nova.api.metadata.wsgi:init_application
nova.api.v21.extensions =
attach_interfaces = nova.api.openstack.compute.attach_interfaces:AttachInterfaces
baremetal_nodes = nova.api.openstack.compute.baremetal_nodes:BareMetalNodes
block_device_mapping = nova.api.openstack.compute.block_device_mapping:BlockDeviceMapping
cells = nova.api.openstack.compute.cells:Cells