diff --git a/nova/api/openstack/compute/aggregates.py b/nova/api/openstack/compute/aggregates.py index 344207c2ec..3bcd759349 100644 --- a/nova/api/openstack/compute/aggregates.py +++ b/nova/api/openstack/compute/aggregates.py @@ -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 [] diff --git a/nova/api/openstack/compute/extension_info.py b/nova/api/openstack/compute/extension_info.py index 0387bcaf9f..dcfc6b92e3 100644 --- a/nova/api/openstack/compute/extension_info.py +++ b/nova/api/openstack/compute/extension_info.py @@ -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.'}, diff --git a/nova/api/openstack/compute/routes.py b/nova/api/openstack/compute/routes.py index 262ae2f8b7..75b2241cf4 100644 --- a/nova/api/openstack/compute/routes.py +++ b/nova/api/openstack/compute/routes.py @@ -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'] diff --git a/setup.cfg b/setup.cfg index db81eeab42..369bc8a5d7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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