Use plain routes list for limits endpoint instead of stevedore
This patch adds limits and os-used-limits related routes by a plain list, instead of using stevedore. After all the Nova API endpoints moves to the plain routes list, the usage of stevedore for API loading will be removed from Nova. Partial-implement-blueprint api-no-more-extensions-pike Change-Id: I170a081fe874447fab4eee7c6dc57f8028f7b9a3
This commit is contained in:
parent
2d6782a1a7
commit
788ea35c9d
|
@ -29,7 +29,6 @@ from nova import quota
|
|||
|
||||
|
||||
QUOTAS = quota.QUOTAS
|
||||
ALIAS = 'limits'
|
||||
|
||||
|
||||
class LimitsController(wsgi.Controller):
|
||||
|
@ -64,19 +63,3 @@ class LimitsController(wsgi.Controller):
|
|||
builder = limits_views.ViewBuilder()
|
||||
return builder.build(abs_limits, filter_result=filter_result,
|
||||
max_image_meta=max_image_meta)
|
||||
|
||||
|
||||
class Limits(extensions.V21APIExtensionBase):
|
||||
"""Limits support."""
|
||||
|
||||
name = "Limits"
|
||||
alias = ALIAS
|
||||
version = 1
|
||||
|
||||
def get_resources(self):
|
||||
resource = [extensions.ResourceExtension(ALIAS,
|
||||
LimitsController())]
|
||||
return resource
|
||||
|
||||
def get_controller_extensions(self):
|
||||
return []
|
||||
|
|
|
@ -47,6 +47,7 @@ from nova.api.openstack.compute import floating_ips_bulk
|
|||
from nova.api.openstack.compute import hide_server_addresses
|
||||
from nova.api.openstack.compute import instance_usage_audit_log
|
||||
from nova.api.openstack.compute import keypairs
|
||||
from nova.api.openstack.compute import limits
|
||||
from nova.api.openstack.compute import lock_server
|
||||
from nova.api.openstack.compute import migrate_server
|
||||
from nova.api.openstack.compute import migrations
|
||||
|
@ -63,6 +64,7 @@ from nova.api.openstack.compute import servers
|
|||
from nova.api.openstack.compute import shelve
|
||||
from nova.api.openstack.compute import simple_tenant_usage
|
||||
from nova.api.openstack.compute import suspend_server
|
||||
from nova.api.openstack.compute import used_limits
|
||||
from nova.api.openstack import wsgi
|
||||
import nova.conf
|
||||
|
||||
|
@ -160,6 +162,14 @@ instance_usage_audit_log_controller = functools.partial(_create_controller,
|
|||
instance_usage_audit_log.InstanceUsageAuditLogController, [], [])
|
||||
|
||||
|
||||
limits_controller = functools.partial(
|
||||
_create_controller, limits.LimitsController,
|
||||
[
|
||||
used_limits.UsedLimitsController,
|
||||
],
|
||||
[])
|
||||
|
||||
|
||||
migrations_controller = functools.partial(_create_controller,
|
||||
migrations.MigrationsController, [], [])
|
||||
|
||||
|
@ -258,6 +268,9 @@ ROUTE_LIST = (
|
|||
('/flavors/{flavor_id}/os-flavor-access', {
|
||||
'GET': [flavor_access_controller, 'index']
|
||||
}),
|
||||
('/limits', {
|
||||
'GET': [limits_controller, 'index']
|
||||
}),
|
||||
('/os-agents', {
|
||||
'GET': [agents_controller, 'index'],
|
||||
'POST': [agents_controller, 'create']
|
||||
|
|
|
@ -25,9 +25,6 @@ from nova import quota
|
|||
QUOTAS = quota.QUOTAS
|
||||
|
||||
|
||||
ALIAS = "os-used-limits"
|
||||
|
||||
|
||||
class UsedLimitsController(wsgi.Controller):
|
||||
|
||||
@staticmethod
|
||||
|
@ -80,20 +77,3 @@ class UsedLimitsController(wsgi.Controller):
|
|||
context.can(ul_policies.BASE_POLICY_NAME, target)
|
||||
return tenant_id
|
||||
return context.project_id
|
||||
|
||||
|
||||
class UsedLimits(extensions.V21APIExtensionBase):
|
||||
"""Provide data on limited resources that are being used."""
|
||||
|
||||
name = "UsedLimits"
|
||||
alias = ALIAS
|
||||
version = 1
|
||||
|
||||
def get_controller_extensions(self):
|
||||
controller = UsedLimitsController()
|
||||
limits_ext = extensions.ControllerExtension(self, 'limits',
|
||||
controller=controller)
|
||||
return [limits_ext]
|
||||
|
||||
def get_resources(self):
|
||||
return []
|
||||
|
|
|
@ -88,7 +88,6 @@ nova.api.v21.extensions =
|
|||
image_size = nova.api.openstack.compute.image_size:ImageSize
|
||||
instance_actions = nova.api.openstack.compute.instance_actions:InstanceActions
|
||||
ips = nova.api.openstack.compute.ips:IPs
|
||||
limits = nova.api.openstack.compute.limits:Limits
|
||||
multiple_create = nova.api.openstack.compute.multiple_create:MultipleCreate
|
||||
networks = nova.api.openstack.compute.networks:Networks
|
||||
networks_associate = nova.api.openstack.compute.networks_associate:NetworksAssociate
|
||||
|
@ -103,7 +102,6 @@ nova.api.v21.extensions =
|
|||
server_groups = nova.api.openstack.compute.server_groups:ServerGroups
|
||||
services = nova.api.openstack.compute.services:Services
|
||||
tenant_networks = nova.api.openstack.compute.tenant_networks:TenantNetworks
|
||||
used_limits = nova.api.openstack.compute.used_limits:UsedLimits
|
||||
user_data = nova.api.openstack.compute.user_data:UserData
|
||||
versions = nova.api.openstack.compute.versionsV21:Versions
|
||||
virtual_interfaces = nova.api.openstack.compute.virtual_interfaces:VirtualInterfaces
|
||||
|
|
Loading…
Reference in New Issue