diff --git a/nova/api/openstack/compute/hosts.py b/nova/api/openstack/compute/hosts.py index 565a3e08de..ba5fac3db8 100644 --- a/nova/api/openstack/compute/hosts.py +++ b/nova/api/openstack/compute/hosts.py @@ -31,7 +31,6 @@ from nova import objects from nova.policies import hosts as hosts_policies LOG = logging.getLogger(__name__) -ALIAS = 'os-hosts' class HostController(wsgi.Controller): @@ -289,21 +288,3 @@ class HostController(wsgi.Controller): for resource in six.itervalues(by_proj_resources): resources.append({'resource': resource}) return {'host': resources} - - -class Hosts(extensions.V21APIExtensionBase): - """Admin-only host administration.""" - - name = "Hosts" - alias = ALIAS - version = 1 - - def get_resources(self): - resources = [extensions.ResourceExtension(ALIAS, - HostController(), - member_actions={"startup": "GET", "shutdown": "GET", - "reboot": "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 716edb8a34..47102bd152 100644 --- a/nova/api/openstack/compute/routes.py +++ b/nova/api/openstack/compute/routes.py @@ -47,6 +47,7 @@ from nova.api.openstack.compute import floating_ips 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 instance_actions from nova.api.openstack.compute import instance_usage_audit_log from nova.api.openstack.compute import ips @@ -166,6 +167,10 @@ fping_controller = functools.partial(_create_controller, fping.FpingController, [], []) +hosts_controller = functools.partial( + _create_controller, hosts.HostController, [], []) + + instance_actions_controller = functools.partial(_create_controller, instance_actions.InstanceActionsController, [], []) @@ -392,6 +397,22 @@ ROUTE_LIST = ( ('/os-fping/{id}', { 'GET': [fping_controller, 'show'] }), + ('/os-hosts', { + 'GET': [hosts_controller, 'index'] + }), + ('/os-hosts/{id}', { + 'GET': [hosts_controller, 'show'], + 'PUT': [hosts_controller, 'update'] + }), + ('/os-hosts/{id}/reboot', { + 'GET': [hosts_controller, 'reboot'] + }), + ('/os-hosts/{id}/shutdown', { + 'GET': [hosts_controller, 'shutdown'] + }), + ('/os-hosts/{id}/startup', { + 'GET': [hosts_controller, 'startup'] + }), ('/os-instance_usage_audit_log', { 'GET': [instance_usage_audit_log_controller, 'index'] }), diff --git a/setup.cfg b/setup.cfg index c4c6e748fa..eee9991e69 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 - hosts = nova.api.openstack.compute.hosts:Hosts hypervisors = nova.api.openstack.compute.hypervisors:Hypervisors images = nova.api.openstack.compute.images:Images image_metadata = nova.api.openstack.compute.image_metadata:ImageMetadata