Merge "Use plain routes list for '/os-aggregates' endpoint instead of stevedore"

This commit is contained in:
Jenkins
2017-04-25 17:11:26 +00:00
committed by Gerrit Code Review
4 changed files with 21 additions and 21 deletions

View File

@@ -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 []

View File

@@ -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.'},

View File

@@ -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']

View File

@@ -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