diff --git a/nova/api/openstack/compute/hypervisors.py b/nova/api/openstack/compute/hypervisors.py index acb18a1a22..a48e41f72b 100644 --- a/nova/api/openstack/compute/hypervisors.py +++ b/nova/api/openstack/compute/hypervisors.py @@ -32,8 +32,6 @@ from nova import servicegroup LOG = logging.getLogger(__name__) -ALIAS = "os-hypervisors" - class HypervisorsController(wsgi.Controller): """The Hypervisors API controller for the OpenStack API.""" @@ -278,25 +276,3 @@ class HypervisorsController(wsgi.Controller): context.can(hv_policies.BASE_POLICY_NAME) stats = self.host_api.compute_node_statistics(context) return dict(hypervisor_statistics=stats) - - -class Hypervisors(extensions.V21APIExtensionBase): - """Admin-only hypervisor administration.""" - - name = "Hypervisors" - alias = ALIAS - version = 1 - - def get_resources(self): - resources = [extensions.ResourceExtension(ALIAS, - HypervisorsController(), - collection_actions={'detail': 'GET', - 'statistics': 'GET'}, - member_actions={'uptime': 'GET', - 'search': 'GET', - 'servers': 'GET'})] - - return resources - - def get_controller_extensions(self): - return [] diff --git a/nova/api/openstack/compute/routes.py b/nova/api/openstack/compute/routes.py index 47102bd152..d6a0422c5e 100644 --- a/nova/api/openstack/compute/routes.py +++ b/nova/api/openstack/compute/routes.py @@ -48,6 +48,7 @@ from nova.api.openstack.compute import floating_ips_bulk from nova.api.openstack.compute import fping from nova.api.openstack.compute import hide_server_addresses from nova.api.openstack.compute import hosts +from nova.api.openstack.compute import hypervisors from nova.api.openstack.compute import instance_actions from nova.api.openstack.compute import instance_usage_audit_log from nova.api.openstack.compute import ips @@ -171,6 +172,10 @@ hosts_controller = functools.partial( _create_controller, hosts.HostController, [], []) +hypervisors_controller = functools.partial( + _create_controller, hypervisors.HypervisorsController, [], []) + + instance_actions_controller = functools.partial(_create_controller, instance_actions.InstanceActionsController, [], []) @@ -413,6 +418,27 @@ ROUTE_LIST = ( ('/os-hosts/{id}/startup', { 'GET': [hosts_controller, 'startup'] }), + ('/os-hypervisors', { + 'GET': [hypervisors_controller, 'index'] + }), + ('/os-hypervisors/detail', { + 'GET': [hypervisors_controller, 'detail'] + }), + ('/os-hypervisors/statistics', { + 'GET': [hypervisors_controller, 'statistics'] + }), + ('/os-hypervisors/{id}', { + 'GET': [hypervisors_controller, 'show'] + }), + ('/os-hypervisors/{id}/search', { + 'GET': [hypervisors_controller, 'search'] + }), + ('/os-hypervisors/{id}/servers', { + 'GET': [hypervisors_controller, 'servers'] + }), + ('/os-hypervisors/{id}/uptime', { + 'GET': [hypervisors_controller, 'uptime'] + }), ('/os-instance_usage_audit_log', { 'GET': [instance_usage_audit_log_controller, 'index'] }), diff --git a/setup.cfg b/setup.cfg index eee9991e69..7735bcfac2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -79,7 +79,6 @@ nova.api.v21.extensions = console_auth_tokens = nova.api.openstack.compute.console_auth_tokens:ConsoleAuthTokens consoles = nova.api.openstack.compute.consoles:Consoles extension_info = nova.api.openstack.compute.extension_info:ExtensionInfo - hypervisors = nova.api.openstack.compute.hypervisors:Hypervisors images = nova.api.openstack.compute.images:Images image_metadata = nova.api.openstack.compute.image_metadata:ImageMetadata image_size = nova.api.openstack.compute.image_size:ImageSize