Skip to content

Commit

Permalink
Merge "Use plain routes list for os-cells endpoint instead of stevedore"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jul 14, 2017
2 parents de0d317 + 408fcfd commit 4bd9028
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 32 deletions.
31 changes: 0 additions & 31 deletions nova/api/openstack/compute/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@

CONF = nova.conf.CONF

ALIAS = "os-cells"


def _filter_keys(item, keys):
"""Filters all model attributes except for keys
Expand Down Expand Up @@ -303,32 +301,3 @@ def sync_instances(self, req, body):
deleted = strutils.bool_from_string(deleted, strict=True)
self.cells_rpcapi.sync_instances(context, project_id=project_id,
updated_since=updated_since, deleted=deleted)


class Cells(extensions.V21APIExtensionBase):
"""Enables cells-related functionality such as adding neighbor cells,
listing neighbor cells, and getting the capabilities of the local cell.
"""

name = "Cells"
alias = ALIAS
version = 1

def get_resources(self):
coll_actions = {
'detail': 'GET',
'info': 'GET',
'sync_instances': 'POST',
'capacities': 'GET',
}
memb_actions = {
'capacities': 'GET',
}

res = extensions.ResourceExtension(ALIAS, CellsController(),
collection_actions=coll_actions,
member_actions=memb_actions)
return [res]

def get_controller_extensions(self):
return []
29 changes: 29 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 cells
from nova.api.openstack.compute import certificates
from nova.api.openstack.compute import cloudpipe
from nova.api.openstack.compute import config_drive
Expand Down Expand Up @@ -123,6 +124,10 @@ def _create_controller(main_controller, controller_list,
_create_controller, availability_zone.AvailabilityZoneController, [], [])


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


certificates_controller = functools.partial(
_create_controller, certificates.CertificatesController, [], [])

Expand Down Expand Up @@ -397,6 +402,30 @@ def _create_controller(main_controller, controller_list,
('/os-availability-zone/detail', {
'GET': [availability_zone_controller, 'detail'],
}),
('/os-cells', {
'POST': [cells_controller, 'create'],
'GET': [cells_controller, 'index'],
}),
('/os-cells/capacities', {
'GET': [cells_controller, 'capacities']
}),
('/os-cells/detail', {
'GET': [cells_controller, 'detail']
}),
('/os-cells/info', {
'GET': [cells_controller, 'info']
}),
('/os-cells/sync_instances', {
'POST': [cells_controller, 'sync_instances']
}),
('/os-cells/{id}', {
'GET': [cells_controller, 'show'],
'PUT': [cells_controller, 'update'],
'DELETE': [cells_controller, 'delete']
}),
('/os-cells/{id}/capacities', {
'GET': [cells_controller, 'capacities']
}),
('/os-certificates', {
'POST': [certificates_controller, 'create']
}),
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ wsgi_scripts =

nova.api.v21.extensions =
baremetal_nodes = nova.api.openstack.compute.baremetal_nodes:BareMetalNodes
cells = nova.api.openstack.compute.cells:Cells
extension_info = nova.api.openstack.compute.extension_info:ExtensionInfo
images = nova.api.openstack.compute.images:Images
image_metadata = nova.api.openstack.compute.image_metadata:ImageMetadata
Expand Down

0 comments on commit 4bd9028

Please sign in to comment.