Use plain routes list for '/os-aggregates' endpoint instead of stevedore
This patch adds '/os-aggregates' 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. Also note that the original 'ProjectMapper' use the 'routes.Mapper.resource' to create a set of routes for a resource which comform to the Atom publishing protocol. It includes some of URL mappings we didn't document before. This patch will remove those URL mappings. For the detail, please reference: http://lists.openstack.org/pipermail/openstack-dev/2017-March/114736.html Partial-implement-blueprint api-no-more-extensions-pike Change-Id: Ia41c096a579eb1a7c5b99bd6e9267ab4b7f81776
This commit is contained in:
parent
c20d52d1af
commit
a72a36c0f6
|
@ -30,8 +30,6 @@ from nova import exception
|
|||
from nova.i18n import _
|
||||
from nova.policies import aggregates as aggr_policies
|
||||
|
||||
ALIAS = "os-aggregates"
|
||||
|
||||
|
||||
def _get_context(req):
|
||||
return req.environ['nova.context']
|
||||
|
@ -224,21 +222,3 @@ class AggregateController(wsgi.Controller):
|
|||
or key in aggregate.obj_extra_fields) and
|
||||
(show_uuid or key != 'uuid')):
|
||||
yield key, getattr(aggregate, key)
|
||||
|
||||
|
||||
class Aggregates(extensions.V21APIExtensionBase):
|
||||
"""Admin-only aggregate administration."""
|
||||
|
||||
name = "Aggregates"
|
||||
alias = ALIAS
|
||||
version = 1
|
||||
|
||||
def get_resources(self):
|
||||
resources = [extensions.ResourceExtension(
|
||||
ALIAS,
|
||||
AggregateController(),
|
||||
member_actions={'action': 'POST'})]
|
||||
return resources
|
||||
|
||||
def get_controller_extensions(self):
|
||||
return []
|
||||
|
|
|
@ -170,6 +170,10 @@ v21_to_v2_alias_mapping = {
|
|||
# completely from the code we're going to have a static list here to
|
||||
# keep the surface metadata the same.
|
||||
hardcoded_extensions = [
|
||||
{'name': 'Aggregates',
|
||||
'alias': 'os-aggregates',
|
||||
'description': 'Admin-only aggregate administration.'
|
||||
},
|
||||
{'name': 'DiskConfig',
|
||||
'alias': 'os-disk-config',
|
||||
'description': 'Disk Management Extension.'},
|
||||
|
|
|
@ -19,6 +19,7 @@ import functools
|
|||
import nova.api.openstack
|
||||
from nova.api.openstack.compute import admin_actions
|
||||
from nova.api.openstack.compute import admin_password
|
||||
from nova.api.openstack.compute import aggregates
|
||||
from nova.api.openstack.compute import config_drive
|
||||
from nova.api.openstack.compute import console_output
|
||||
from nova.api.openstack.compute import create_backup
|
||||
|
@ -71,6 +72,10 @@ def _create_controller(main_controller, controller_list,
|
|||
return controller
|
||||
|
||||
|
||||
aggregates_controller = functools.partial(
|
||||
_create_controller, aggregates.AggregateController, [], [])
|
||||
|
||||
|
||||
keypairs_controller = functools.partial(
|
||||
_create_controller, keypairs.KeypairController, [], [])
|
||||
|
||||
|
@ -174,6 +179,18 @@ ROUTE_LIST = (
|
|||
('/flavors/{flavor_id}/os-flavor-access', {
|
||||
'GET': [flavor_access_controller, 'index']
|
||||
}),
|
||||
('/os-aggregates', {
|
||||
'GET': [aggregates_controller, 'index'],
|
||||
'POST': [aggregates_controller, 'create']
|
||||
}),
|
||||
('/os-aggregates/{id}', {
|
||||
'GET': [aggregates_controller, 'show'],
|
||||
'PUT': [aggregates_controller, 'update'],
|
||||
'DELETE': [aggregates_controller, 'delete']
|
||||
}),
|
||||
('/os-aggregates/{id}/action', {
|
||||
'POST': [aggregates_controller, 'action'],
|
||||
}),
|
||||
('/os-keypairs', {
|
||||
'GET': [keypairs_controller, 'index'],
|
||||
'POST': [keypairs_controller, 'create']
|
||||
|
|
|
@ -72,7 +72,6 @@ wsgi_scripts =
|
|||
|
||||
nova.api.v21.extensions =
|
||||
agents = nova.api.openstack.compute.agents:Agents
|
||||
aggregates = nova.api.openstack.compute.aggregates:Aggregates
|
||||
assisted_volume_snapshots = nova.api.openstack.compute.assisted_volume_snapshots:AssistedVolumeSnapshots
|
||||
attach_interfaces = nova.api.openstack.compute.attach_interfaces:AttachInterfaces
|
||||
availability_zone = nova.api.openstack.compute.availability_zone:AvailabilityZone
|
||||
|
|
Loading…
Reference in New Issue