diff --git a/nova/api/openstack/compute/baremetal_nodes.py b/nova/api/openstack/compute/baremetal_nodes.py index c7b991a78921..8125a75b337c 100644 --- a/nova/api/openstack/compute/baremetal_nodes.py +++ b/nova/api/openstack/compute/baremetal_nodes.py @@ -31,8 +31,6 @@ from nova.policies import baremetal_nodes as bn_policies ironic_client = importutils.try_import('ironicclient.client') ironic_exc = importutils.try_import('ironicclient.exc') -ALIAS = "os-baremetal-nodes" - node_fields = ['id', 'cpus', 'local_gb', 'memory_mb', 'pm_address', 'pm_user', 'service_host', 'terminal_port', 'instance_uuid'] @@ -154,23 +152,3 @@ class BareMetalNodeController(wsgi.Controller): @extensions.expected_errors(400) def _remove_interface(self, req, id, body): _no_ironic_proxy("port-delete") - - -class BareMetalNodes(extensions.V21APIExtensionBase): - """Admin-only bare-metal node administration.""" - - name = "BareMetalNodes" - alias = ALIAS - version = 1 - - def get_resources(self): - resource = [extensions.ResourceExtension(ALIAS, - BareMetalNodeController(), - member_actions={"action": "POST"})] - 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/routes.py b/nova/api/openstack/compute/routes.py index 7e9b2f4ff115..0853467574c8 100644 --- a/nova/api/openstack/compute/routes.py +++ b/nova/api/openstack/compute/routes.py @@ -24,6 +24,7 @@ from nova.api.openstack.compute import aggregates from nova.api.openstack.compute import assisted_volume_snapshots from nova.api.openstack.compute import attach_interfaces from nova.api.openstack.compute import availability_zone +from nova.api.openstack.compute import baremetal_nodes from nova.api.openstack.compute import cells from nova.api.openstack.compute import certificates from nova.api.openstack.compute import cloudpipe @@ -130,6 +131,10 @@ availability_zone_controller = functools.partial( _create_controller, availability_zone.AvailabilityZoneController, [], []) +baremetal_nodes_controller = functools.partial( + _create_controller, baremetal_nodes.BareMetalNodeController, [], []) + + cells_controller = functools.partial( _create_controller, cells.CellsController, [], []) @@ -459,6 +464,17 @@ ROUTE_LIST = ( ('/os-availability-zone/detail', { 'GET': [availability_zone_controller, 'detail'], }), + ('/os-baremetal-nodes', { + 'GET': [baremetal_nodes_controller, 'index'], + 'POST': [baremetal_nodes_controller, 'create'] + }), + ('/os-baremetal-nodes/{id}', { + 'GET': [baremetal_nodes_controller, 'show'], + 'DELETE': [baremetal_nodes_controller, 'delete'] + }), + ('/os-baremetal-nodes/{id}/action', { + 'POST': [baremetal_nodes_controller, 'action'] + }), ('/os-cells', { 'POST': [cells_controller, 'create'], 'GET': [cells_controller, 'index'], diff --git a/setup.cfg b/setup.cfg index caa8f8ef01bf..fdafa4199117 100644 --- a/setup.cfg +++ b/setup.cfg @@ -72,7 +72,6 @@ wsgi_scripts = nova-metadata-wsgi = nova.api.metadata.wsgi:init_application nova.api.v21.extensions = - baremetal_nodes = nova.api.openstack.compute.baremetal_nodes:BareMetalNodes extension_info = nova.api.openstack.compute.extension_info:ExtensionInfo versions = nova.api.openstack.compute.versionsV21:Versions volumes = nova.api.openstack.compute.volumes:Volumes