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

This patch adds os-cloudpipe 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: Id02d878867dec642fab72981cd0b492c62c846fb
This commit is contained in:
jichenjc 2017-05-27 21:32:12 +08:00 committed by Stephen Finucane
parent ceed63ff7d
commit facfe2ac42
3 changed files with 12 additions and 30 deletions

View File

@ -19,8 +19,6 @@ from webob import exc
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
ALIAS = 'os-cloudpipe'
class CloudpipeController(wsgi.Controller):
"""Handle creating and listing cloudpipe instances."""
@ -42,30 +40,3 @@ class CloudpipeController(wsgi.Controller):
def update(self, req, id, body):
"""Configure cloudpipe parameters for the project."""
raise exc.HTTPGone()
class Cloudpipe(extensions.V21APIExtensionBase):
"""Adds actions to create cloudpipe instances.
When running with the Vlan network mode, you need a mechanism to route
from the public Internet to your vlans. This mechanism is known as a
cloudpipe.
At the time of creating this class, only OpenVPN is supported. Support for
a SSH Bastion host is forthcoming.
"""
name = "Cloudpipe"
alias = ALIAS
version = 1
def get_resources(self):
resource = [extensions.ResourceExtension(ALIAS,
CloudpipeController())]
return resource
def get_controller_extensions(self):
"""It's an abstract function V21APIExtensionBase and the extension
will not be loaded without it.
"""
return []

View File

@ -25,6 +25,7 @@ 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 cloudpipe
from nova.api.openstack.compute import config_drive
from nova.api.openstack.compute import console_auth_tokens
from nova.api.openstack.compute import console_output
@ -125,6 +126,10 @@ certificates_controller = functools.partial(
_create_controller, certificates.CertificatesController, [], [])
cloudpipe_controller = functools.partial(
_create_controller, cloudpipe.CloudpipeController, [], [])
fixed_ips_controller = functools.partial(_create_controller,
fixed_ips.FixedIPController, [], [])
@ -389,6 +394,13 @@ ROUTE_LIST = (
('/os-certificates/{id}', {
'GET': [certificates_controller, 'show']
}),
('/os-cloudpipe', {
'GET': [cloudpipe_controller, 'index'],
'POST': [cloudpipe_controller, 'create']
}),
('/os-cloudpipe/{id}', {
'PUT': [cloudpipe_controller, 'update']
}),
('/os-console-auth-tokens/{id}', {
'GET': [console_auth_tokens_controller, 'show']
}),

View File

@ -74,7 +74,6 @@ wsgi_scripts =
nova.api.v21.extensions =
baremetal_nodes = nova.api.openstack.compute.baremetal_nodes:BareMetalNodes
cells = nova.api.openstack.compute.cells:Cells
cloudpipe = nova.api.openstack.compute.cloudpipe:Cloudpipe
extension_info = nova.api.openstack.compute.extension_info:ExtensionInfo
images = nova.api.openstack.compute.images:Images
image_metadata = nova.api.openstack.compute.image_metadata:ImageMetadata