Skip to content

Commit

Permalink
Use plain routes list for os-snapshots instead of stevedore
Browse files Browse the repository at this point in the history
This patch adds os-snapshots 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: If2f073066fc4df533138409eec6c8ac0dd44d00a
  • Loading branch information
soulxu committed Jul 18, 2017
1 parent 9c900d1 commit 2b912cc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 deletions.
15 changes: 15 additions & 0 deletions nova/api/openstack/compute/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ def _create_controller(main_controller, controller_list,
simple_tenant_usage.SimpleTenantUsageController, [], [])


snapshots_controller = functools.partial(_create_controller,
volumes.SnapshotController, [], [])


tenant_networks_controller = functools.partial(_create_controller,
tenant_networks.TenantNetworkController, [], [])

Expand Down Expand Up @@ -697,6 +701,17 @@ def _create_controller(main_controller, controller_list,
('/os-simple-tenant-usage/{id}', {
'GET': [simple_tenant_usage_controller, 'show']
}),
('/os-snapshots', {
'GET': [snapshots_controller, 'index'],
'POST': [snapshots_controller, 'create']
}),
('/os-snapshots/detail', {
'GET': [snapshots_controller, 'detail']
}),
('/os-snapshots/{id}', {
'GET': [snapshots_controller, 'show'],
'DELETE': [snapshots_controller, 'delete']
}),
('/os-tenant-networks', {
'GET': [tenant_networks_controller, 'index'],
'POST': [tenant_networks_controller, 'create']
Expand Down
21 changes: 0 additions & 21 deletions nova/api/openstack/compute/volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,24 +590,3 @@ def create(self, req, body):

retval = _translate_snapshot_detail_view(context, new_snapshot)
return {'snapshot': retval}


class Volumes(extensions.V21APIExtensionBase):
"""Volumes support."""

name = "Volumes"
alias = ALIAS
version = 1

def get_resources(self):
resources = []

res = extensions.ResourceExtension(
'os-snapshots', SnapshotController(),
collection_actions={'detail': 'GET'})
resources.append(res)

return resources

def get_controller_extensions(self):
return []
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ wsgi_scripts =
nova.api.v21.extensions =
extension_info = nova.api.openstack.compute.extension_info:ExtensionInfo
versions = nova.api.openstack.compute.versionsV21:Versions
volumes = nova.api.openstack.compute.volumes:Volumes

nova.api.v21.test_extensions =
basic = nova.tests.unit.api.openstack.compute.basic:Basic
Expand Down

0 comments on commit 2b912cc

Please sign in to comment.