Merge "Use plain routes list for images instead of stevedore"
This commit is contained in:
commit
84fc76e9f3
@ -13,12 +13,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from nova.api.openstack import extensions
|
|
||||||
from nova.api.openstack import wsgi
|
from nova.api.openstack import wsgi
|
||||||
from nova.policies import image_size as is_policies
|
from nova.policies import image_size as is_policies
|
||||||
|
|
||||||
ALIAS = "image-size"
|
|
||||||
|
|
||||||
|
|
||||||
class ImageSizeController(wsgi.Controller):
|
class ImageSizeController(wsgi.Controller):
|
||||||
|
|
||||||
@ -49,19 +46,3 @@ class ImageSizeController(wsgi.Controller):
|
|||||||
for image in images_resp:
|
for image in images_resp:
|
||||||
image_cached = req.get_db_item('images', image['id'])
|
image_cached = req.get_db_item('images', image['id'])
|
||||||
self._extend_image(image, image_cached)
|
self._extend_image(image, image_cached)
|
||||||
|
|
||||||
|
|
||||||
class ImageSize(extensions.V21APIExtensionBase):
|
|
||||||
"""Adds image size to image listings."""
|
|
||||||
|
|
||||||
name = "ImageSize"
|
|
||||||
alias = ALIAS
|
|
||||||
version = 1
|
|
||||||
|
|
||||||
def get_controller_extensions(self):
|
|
||||||
controller = ImageSizeController()
|
|
||||||
extension = extensions.ControllerExtension(self, 'images', controller)
|
|
||||||
return [extension]
|
|
||||||
|
|
||||||
def get_resources(self):
|
|
||||||
return []
|
|
||||||
|
@ -27,8 +27,6 @@ import nova.image
|
|||||||
import nova.utils
|
import nova.utils
|
||||||
|
|
||||||
|
|
||||||
ALIAS = 'images'
|
|
||||||
|
|
||||||
SUPPORTED_FILTERS = {
|
SUPPORTED_FILTERS = {
|
||||||
'name': 'name',
|
'name': 'name',
|
||||||
'status': 'status',
|
'status': 'status',
|
||||||
@ -154,22 +152,3 @@ class ImagesController(wsgi.Controller):
|
|||||||
|
|
||||||
req.cache_db_items('images', images, 'id')
|
req.cache_db_items('images', images, 'id')
|
||||||
return self._view_builder.detail(req, images)
|
return self._view_builder.detail(req, images)
|
||||||
|
|
||||||
|
|
||||||
class Images(extensions.V21APIExtensionBase):
|
|
||||||
"""Proxying API for Images."""
|
|
||||||
|
|
||||||
name = "Images"
|
|
||||||
alias = ALIAS
|
|
||||||
version = 1
|
|
||||||
|
|
||||||
def get_resources(self):
|
|
||||||
coll_actions = {'detail': 'GET'}
|
|
||||||
resource = extensions.ResourceExtension(ALIAS,
|
|
||||||
ImagesController(),
|
|
||||||
collection_actions=coll_actions)
|
|
||||||
|
|
||||||
return [resource]
|
|
||||||
|
|
||||||
def get_controller_extensions(self):
|
|
||||||
return []
|
|
||||||
|
@ -53,6 +53,8 @@ from nova.api.openstack.compute import fping
|
|||||||
from nova.api.openstack.compute import hide_server_addresses
|
from nova.api.openstack.compute import hide_server_addresses
|
||||||
from nova.api.openstack.compute import hosts
|
from nova.api.openstack.compute import hosts
|
||||||
from nova.api.openstack.compute import hypervisors
|
from nova.api.openstack.compute import hypervisors
|
||||||
|
from nova.api.openstack.compute import image_size
|
||||||
|
from nova.api.openstack.compute import images
|
||||||
from nova.api.openstack.compute import instance_actions
|
from nova.api.openstack.compute import instance_actions
|
||||||
from nova.api.openstack.compute import instance_usage_audit_log
|
from nova.api.openstack.compute import instance_usage_audit_log
|
||||||
from nova.api.openstack.compute import ips
|
from nova.api.openstack.compute import ips
|
||||||
@ -195,6 +197,11 @@ hypervisors_controller = functools.partial(
|
|||||||
_create_controller, hypervisors.HypervisorsController, [], [])
|
_create_controller, hypervisors.HypervisorsController, [], [])
|
||||||
|
|
||||||
|
|
||||||
|
images_controller = functools.partial(
|
||||||
|
_create_controller, images.ImagesController,
|
||||||
|
[image_size.ImageSizeController], [])
|
||||||
|
|
||||||
|
|
||||||
instance_actions_controller = functools.partial(_create_controller,
|
instance_actions_controller = functools.partial(_create_controller,
|
||||||
instance_actions.InstanceActionsController, [], [])
|
instance_actions.InstanceActionsController, [], [])
|
||||||
|
|
||||||
@ -374,6 +381,16 @@ ROUTE_LIST = (
|
|||||||
('/flavors/{flavor_id}/os-flavor-access', {
|
('/flavors/{flavor_id}/os-flavor-access', {
|
||||||
'GET': [flavor_access_controller, 'index']
|
'GET': [flavor_access_controller, 'index']
|
||||||
}),
|
}),
|
||||||
|
('/images', {
|
||||||
|
'GET': [images_controller, 'index']
|
||||||
|
}),
|
||||||
|
('/images/detail', {
|
||||||
|
'GET': [images_controller, 'detail'],
|
||||||
|
}),
|
||||||
|
('/images/{id}', {
|
||||||
|
'GET': [images_controller, 'show'],
|
||||||
|
'DELETE': [images_controller, 'delete']
|
||||||
|
}),
|
||||||
('/limits', {
|
('/limits', {
|
||||||
'GET': [limits_controller, 'index']
|
'GET': [limits_controller, 'index']
|
||||||
}),
|
}),
|
||||||
|
@ -76,9 +76,7 @@ wsgi_scripts =
|
|||||||
nova.api.v21.extensions =
|
nova.api.v21.extensions =
|
||||||
baremetal_nodes = nova.api.openstack.compute.baremetal_nodes:BareMetalNodes
|
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
|
||||||
images = nova.api.openstack.compute.images:Images
|
|
||||||
image_metadata = nova.api.openstack.compute.image_metadata:ImageMetadata
|
image_metadata = nova.api.openstack.compute.image_metadata:ImageMetadata
|
||||||
image_size = nova.api.openstack.compute.image_size:ImageSize
|
|
||||||
security_group_default_rules = nova.api.openstack.compute.security_group_default_rules:SecurityGroupDefaultRules
|
security_group_default_rules = nova.api.openstack.compute.security_group_default_rules:SecurityGroupDefaultRules
|
||||||
security_groups = nova.api.openstack.compute.security_groups:SecurityGroups
|
security_groups = nova.api.openstack.compute.security_groups:SecurityGroups
|
||||||
versions = nova.api.openstack.compute.versionsV21:Versions
|
versions = nova.api.openstack.compute.versionsV21:Versions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user