Use plain routes list for os-quota-sets endpoint instead of stevedore

This patch adds os-quota-sets 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: I2b9b3f2acef09e553245ce6ebac18f26269d81d0
This commit is contained in:
jichenjc 2017-04-28 21:48:23 +08:00 committed by He Jie Xu
parent 50a9d305c8
commit 671b8fd818
3 changed files with 16 additions and 24 deletions

View File

@ -36,7 +36,6 @@ from nova import quota
CONF = nova.conf.CONF
ALIAS = "os-quota-sets"
QUOTAS = quota.QUOTAS
FILTERED_QUOTAS = ["fixed_ips", "floating_ips", "networks",
@ -232,25 +231,3 @@ class QuotaSetsController(wsgi.Controller):
id, user_id)
else:
QUOTAS.destroy_all_by_project(context, id)
class QuotaSets(extensions.V21APIExtensionBase):
"""Quotas management support."""
name = "Quotas"
alias = ALIAS
version = 1
def get_resources(self):
resources = []
res = extensions.ResourceExtension(ALIAS,
QuotaSetsController(),
member_actions={'defaults': 'GET',
'detail': 'GET'})
resources.append(res)
return resources
def get_controller_extensions(self):
return []

View File

@ -51,6 +51,7 @@ from nova.api.openstack.compute import lock_server
from nova.api.openstack.compute import migrate_server
from nova.api.openstack.compute import multinic
from nova.api.openstack.compute import pause_server
from nova.api.openstack.compute import quota_sets
from nova.api.openstack.compute import remote_consoles
from nova.api.openstack.compute import rescue
from nova.api.openstack.compute import security_groups
@ -158,6 +159,10 @@ instance_usage_audit_log_controller = functools.partial(_create_controller,
instance_usage_audit_log.InstanceUsageAuditLogController, [], [])
quota_set_controller = functools.partial(_create_controller,
quota_sets.QuotaSetsController, [], [])
server_controller = functools.partial(_create_controller,
servers.ServersController,
[
@ -337,6 +342,17 @@ ROUTE_LIST = (
'GET': [keypairs_controller, 'show'],
'DELETE': [keypairs_controller, 'delete']
}),
('/os-quota-sets/{id}', {
'GET': [quota_set_controller, 'show'],
'PUT': [quota_set_controller, 'update'],
'DELETE': [quota_set_controller, 'delete']
}),
('/os-quota-sets/{id}/detail', {
'GET': [quota_set_controller, 'detail']
}),
('/os-quota-sets/{id}/defaults', {
'GET': [quota_set_controller, 'defaults']
}),
('/os-simple-tenant-usage', {
'GET': [simple_tenant_usage_controller, 'index']
}),

View File

@ -94,7 +94,6 @@ nova.api.v21.extensions =
networks = nova.api.openstack.compute.networks:Networks
networks_associate = nova.api.openstack.compute.networks_associate:NetworksAssociate
quota_classes = nova.api.openstack.compute.quota_classes:QuotaClasses
quota_sets = nova.api.openstack.compute.quota_sets:QuotaSets
remote_consoles = nova.api.openstack.compute.remote_consoles:RemoteConsoles
security_group_default_rules = nova.api.openstack.compute.security_group_default_rules:SecurityGroupDefaultRules
security_groups = nova.api.openstack.compute.security_groups:SecurityGroups