diff --git a/nova/api/openstack/compute/image_size.py b/nova/api/openstack/compute/image_size.py index 371db5d9d30..8ed4ae6135f 100644 --- a/nova/api/openstack/compute/image_size.py +++ b/nova/api/openstack/compute/image_size.py @@ -13,12 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.policies import image_size as is_policies -ALIAS = "image-size" - class ImageSizeController(wsgi.Controller): @@ -49,19 +46,3 @@ def detail(self, req, resp_obj): for image in images_resp: image_cached = req.get_db_item('images', image['id']) 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 [] diff --git a/nova/api/openstack/compute/images.py b/nova/api/openstack/compute/images.py index 060bd462784..44c5e0c5fc9 100644 --- a/nova/api/openstack/compute/images.py +++ b/nova/api/openstack/compute/images.py @@ -27,8 +27,6 @@ import nova.utils -ALIAS = 'images' - SUPPORTED_FILTERS = { 'name': 'name', 'status': 'status', @@ -154,22 +152,3 @@ def detail(self, req): req.cache_db_items('images', images, 'id') 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 [] diff --git a/nova/api/openstack/compute/routes.py b/nova/api/openstack/compute/routes.py index debd43e9c55..66190462430 100644 --- a/nova/api/openstack/compute/routes.py +++ b/nova/api/openstack/compute/routes.py @@ -53,6 +53,8 @@ from nova.api.openstack.compute import hide_server_addresses from nova.api.openstack.compute import hosts 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_usage_audit_log from nova.api.openstack.compute import ips @@ -195,6 +197,11 @@ def _create_controller(main_controller, controller_list, _create_controller, hypervisors.HypervisorsController, [], []) +images_controller = functools.partial( + _create_controller, images.ImagesController, + [image_size.ImageSizeController], []) + + instance_actions_controller = functools.partial(_create_controller, instance_actions.InstanceActionsController, [], []) @@ -374,6 +381,16 @@ def _create_controller(main_controller, controller_list, ('/flavors/{flavor_id}/os-flavor-access', { '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', { 'GET': [limits_controller, 'index'] }), diff --git a/setup.cfg b/setup.cfg index 69efe1498c6..6c02201d5a8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -74,9 +74,7 @@ wsgi_scripts = nova.api.v21.extensions = baremetal_nodes = nova.api.openstack.compute.baremetal_nodes:BareMetalNodes 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_size = nova.api.openstack.compute.image_size:ImageSize security_group_default_rules = nova.api.openstack.compute.security_group_default_rules:SecurityGroupDefaultRules security_groups = nova.api.openstack.compute.security_groups:SecurityGroups versions = nova.api.openstack.compute.versionsV21:Versions