diff --git a/nova/api/openstack/compute/agents.py b/nova/api/openstack/compute/agents.py index b1450fc681..489c85a920 100644 --- a/nova/api/openstack/compute/agents.py +++ b/nova/api/openstack/compute/agents.py @@ -25,9 +25,6 @@ from nova.policies import agents as agents_policies from nova import utils -ALIAS = "os-agents" - - class AgentController(wsgi.Controller): """The agent is talking about guest agent.The host can use this for things like accessing files on the disk, configuring networking, @@ -166,22 +163,3 @@ class AgentController(wsgi.Controller): except exception.AgentBuildExists as ex: raise webob.exc.HTTPConflict(explanation=ex.format_message()) return {'agent': agent} - - -class Agents(extensions.V21APIExtensionBase): - """Agents support.""" - - name = "Agents" - alias = ALIAS - version = 1 - - def get_resources(self): - resource = [extensions.ResourceExtension(ALIAS, - AgentController())] - return resource - - def get_controller_extensions(self): - """It's an abstract function V21APIExtensionBase and the extension - will not be loaded without it. - """ - return [] diff --git a/nova/api/openstack/compute/extension_info.py b/nova/api/openstack/compute/extension_info.py index 6492941c15..de6384ac59 100644 --- a/nova/api/openstack/compute/extension_info.py +++ b/nova/api/openstack/compute/extension_info.py @@ -169,6 +169,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': 'Agents', + 'alias': 'os-agents', + 'description': 'Agents support.' + }, {'name': 'Aggregates', 'alias': 'os-aggregates', 'description': 'Admin-only aggregate administration.' diff --git a/nova/api/openstack/compute/routes.py b/nova/api/openstack/compute/routes.py index 0077117167..129843bab8 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 agents from nova.api.openstack.compute import aggregates from nova.api.openstack.compute import config_drive from nova.api.openstack.compute import console_output @@ -75,6 +76,10 @@ def _create_controller(main_controller, controller_list, return controller +agents_controller = functools.partial( + _create_controller, agents.AgentController, [], []) + + aggregates_controller = functools.partial( _create_controller, aggregates.AggregateController, [], []) @@ -202,6 +207,14 @@ ROUTE_LIST = ( ('/flavors/{flavor_id}/os-flavor-access', { 'GET': [flavor_access_controller, 'index'] }), + ('/os-agents', { + 'GET': [agents_controller, 'index'], + 'POST': [agents_controller, 'create'] + }), + ('/os-agents/{id}', { + 'PUT': [agents_controller, 'update'], + 'DELETE': [agents_controller, 'delete'] + }), ('/os-aggregates', { 'GET': [aggregates_controller, 'index'], 'POST': [aggregates_controller, 'create'] diff --git a/setup.cfg b/setup.cfg index 8433c039bb..060a357baf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -72,7 +72,6 @@ wsgi_scripts = nova-api-wsgi = nova.api.openstack.compute.wsgi:init_application nova.api.v21.extensions = - agents = nova.api.openstack.compute.agents:Agents 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