Merge "Use plain routes list for os-baremetal-nodes endpoint instead of stevedore"

This commit is contained in:
Jenkins 2017-07-19 11:45:06 +00:00 committed by Gerrit Code Review
commit 2e4417d57c
3 changed files with 16 additions and 23 deletions

View File

@ -31,8 +31,6 @@ from nova.policies import baremetal_nodes as bn_policies
ironic_client = importutils.try_import('ironicclient.client') ironic_client = importutils.try_import('ironicclient.client')
ironic_exc = importutils.try_import('ironicclient.exc') ironic_exc = importutils.try_import('ironicclient.exc')
ALIAS = "os-baremetal-nodes"
node_fields = ['id', 'cpus', 'local_gb', 'memory_mb', 'pm_address', node_fields = ['id', 'cpus', 'local_gb', 'memory_mb', 'pm_address',
'pm_user', 'service_host', 'terminal_port', 'instance_uuid'] 'pm_user', 'service_host', 'terminal_port', 'instance_uuid']
@ -154,23 +152,3 @@ class BareMetalNodeController(wsgi.Controller):
@extensions.expected_errors(400) @extensions.expected_errors(400)
def _remove_interface(self, req, id, body): def _remove_interface(self, req, id, body):
_no_ironic_proxy("port-delete") _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 []

View File

@ -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 assisted_volume_snapshots
from nova.api.openstack.compute import attach_interfaces from nova.api.openstack.compute import attach_interfaces
from nova.api.openstack.compute import availability_zone 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 cells
from nova.api.openstack.compute import certificates from nova.api.openstack.compute import certificates
from nova.api.openstack.compute import cloudpipe from nova.api.openstack.compute import cloudpipe
@ -130,6 +131,10 @@ availability_zone_controller = functools.partial(
_create_controller, availability_zone.AvailabilityZoneController, [], []) _create_controller, availability_zone.AvailabilityZoneController, [], [])
baremetal_nodes_controller = functools.partial(
_create_controller, baremetal_nodes.BareMetalNodeController, [], [])
cells_controller = functools.partial( cells_controller = functools.partial(
_create_controller, cells.CellsController, [], []) _create_controller, cells.CellsController, [], [])
@ -459,6 +464,17 @@ ROUTE_LIST = (
('/os-availability-zone/detail', { ('/os-availability-zone/detail', {
'GET': [availability_zone_controller, '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', { ('/os-cells', {
'POST': [cells_controller, 'create'], 'POST': [cells_controller, 'create'],
'GET': [cells_controller, 'index'], 'GET': [cells_controller, 'index'],

View File

@ -74,7 +74,6 @@ wsgi_scripts =
nova-metadata-wsgi = nova.api.metadata.wsgi:init_application nova-metadata-wsgi = nova.api.metadata.wsgi:init_application
nova.api.v21.extensions = nova.api.v21.extensions =
baremetal_nodes = nova.api.openstack.compute.baremetal_nodes:BareMetalNodes
extension_info = nova.api.openstack.compute.extension_info:ExtensionInfo extension_info = nova.api.openstack.compute.extension_info:ExtensionInfo
versions = nova.api.openstack.compute.versionsV21:Versions versions = nova.api.openstack.compute.versionsV21:Versions
volumes = nova.api.openstack.compute.volumes:Volumes volumes = nova.api.openstack.compute.volumes:Volumes