Skip to content

Commit

Permalink
Merge "Use plain routes list for os-baremetal-nodes endpoint instead …
Browse files Browse the repository at this point in the history
…of stevedore"
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jul 19, 2017
2 parents 52a7492 + 24fadbe commit 2e4417d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
22 changes: 0 additions & 22 deletions nova/api/openstack/compute/baremetal_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
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']

Expand Down Expand Up @@ -154,23 +152,3 @@ def _add_interface(self, req, id, body):
@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 []
16 changes: 16 additions & 0 deletions nova/api/openstack/compute/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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
Expand Down Expand Up @@ -130,6 +131,10 @@ def _create_controller(main_controller, controller_list,
_create_controller, availability_zone.AvailabilityZoneController, [], [])


baremetal_nodes_controller = functools.partial(
_create_controller, baremetal_nodes.BareMetalNodeController, [], [])


cells_controller = functools.partial(
_create_controller, cells.CellsController, [], [])

Expand Down Expand Up @@ -459,6 +464,17 @@ def _create_controller(main_controller, controller_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'],
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,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
Expand Down

0 comments on commit 2e4417d

Please sign in to comment.