summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-19 20:14:53 +0000
committerGerrit Code Review <review@openstack.org>2017-06-19 20:14:53 +0000
commit3000c8637ee9bdb75fff5de3cb488e45c22bb6ef (patch)
treeaf82637a878c6003f78fb6558938bbfcc039dbaf
parent8069fc8ce42c771656730ac91293536d3a1900a9 (diff)
parentceed63ff7dc328993615d05a7fc63966e19d451e (diff)
Merge "Use plain routes list for os-quota-classes endpoint instead of stevedore"
-rw-r--r--nova/api/openstack/compute/quota_classes.py26
-rw-r--r--nova/api/openstack/compute/routes.py9
-rw-r--r--setup.cfg1
3 files changed, 12 insertions, 24 deletions
diff --git a/nova/api/openstack/compute/quota_classes.py b/nova/api/openstack/compute/quota_classes.py
index e09631b..efc01dd 100644
--- a/nova/api/openstack/compute/quota_classes.py
+++ b/nova/api/openstack/compute/quota_classes.py
@@ -28,7 +28,6 @@ from nova import utils
28 28
29 29
30QUOTAS = quota.QUOTAS 30QUOTAS = quota.QUOTAS
31ALIAS = "os-quota-class-sets"
32 31
33# Quotas that are only enabled by specific extensions 32# Quotas that are only enabled by specific extensions
34EXTENDED_QUOTAS = {'server_groups': 'os-server-group-quotas', 33EXTENDED_QUOTAS = {'server_groups': 'os-server-group-quotas',
@@ -41,10 +40,10 @@ class QuotaClassSetsController(wsgi.Controller):
41 40
42 def __init__(self, **kwargs): 41 def __init__(self, **kwargs):
43 self.supported_quotas = QUOTAS.resources 42 self.supported_quotas = QUOTAS.resources
44 extension_info = kwargs.pop('extension_info').get_extensions() 43 # TODO(jichenjc): need fix v2 and v2.1 API difference here see bug
44 # 1693168 for more info
45 for resource, extension in EXTENDED_QUOTAS.items(): 45 for resource, extension in EXTENDED_QUOTAS.items():
46 if extension not in extension_info: 46 self.supported_quotas.remove(resource)
47 self.supported_quotas.remove(resource)
48 47
49 def _format_quota_set(self, quota_class, quota_set): 48 def _format_quota_set(self, quota_class, quota_set):
50 """Convert the quota object to a result dict.""" 49 """Convert the quota object to a result dict."""
@@ -89,22 +88,3 @@ class QuotaClassSetsController(wsgi.Controller):
89 88
90 values = QUOTAS.get_class_quotas(context, quota_class) 89 values = QUOTAS.get_class_quotas(context, quota_class)
91 return self._format_quota_set(None, values) 90 return self._format_quota_set(None, values)
92
93
94class QuotaClasses(extensions.V21APIExtensionBase):
95 """Quota classes management support."""
96
97 name = "QuotaClasses"
98 alias = ALIAS
99 version = 1
100
101 def get_resources(self):
102 resources = []
103 res = extensions.ResourceExtension(
104 ALIAS,
105 QuotaClassSetsController(extension_info=self.extension_info))
106 resources.append(res)
107 return resources
108
109 def get_controller_extensions(self):
110 return []
diff --git a/nova/api/openstack/compute/routes.py b/nova/api/openstack/compute/routes.py
index c216e22..0c35ecb 100644
--- a/nova/api/openstack/compute/routes.py
+++ b/nova/api/openstack/compute/routes.py
@@ -61,6 +61,7 @@ from nova.api.openstack.compute import migrate_server
61from nova.api.openstack.compute import migrations 61from nova.api.openstack.compute import migrations
62from nova.api.openstack.compute import multinic 62from nova.api.openstack.compute import multinic
63from nova.api.openstack.compute import pause_server 63from nova.api.openstack.compute import pause_server
64from nova.api.openstack.compute import quota_classes
64from nova.api.openstack.compute import quota_sets 65from nova.api.openstack.compute import quota_sets
65from nova.api.openstack.compute import remote_consoles 66from nova.api.openstack.compute import remote_consoles
66from nova.api.openstack.compute import rescue 67from nova.api.openstack.compute import rescue
@@ -209,6 +210,10 @@ migrations_controller = functools.partial(_create_controller,
209 migrations.MigrationsController, [], []) 210 migrations.MigrationsController, [], [])
210 211
211 212
213quota_classes_controller = functools.partial(_create_controller,
214 quota_classes.QuotaClassSetsController, [], [])
215
216
212quota_set_controller = functools.partial(_create_controller, 217quota_set_controller = functools.partial(_create_controller,
213 quota_sets.QuotaSetsController, [], []) 218 quota_sets.QuotaSetsController, [], [])
214 219
@@ -484,6 +489,10 @@ ROUTE_LIST = (
484 ('/os-migrations', { 489 ('/os-migrations', {
485 'GET': [migrations_controller, 'index'] 490 'GET': [migrations_controller, 'index']
486 }), 491 }),
492 ('/os-quota-class-sets/{id}', {
493 'GET': [quota_classes_controller, 'show'],
494 'PUT': [quota_classes_controller, 'update']
495 }),
487 ('/os-quota-sets/{id}', { 496 ('/os-quota-sets/{id}', {
488 'GET': [quota_set_controller, 'show'], 497 'GET': [quota_set_controller, 'show'],
489 'PUT': [quota_set_controller, 'update'], 498 'PUT': [quota_set_controller, 'update'],
diff --git a/setup.cfg b/setup.cfg
index 53d8e9a..8f55a1b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -82,7 +82,6 @@ nova.api.v21.extensions =
82 multiple_create = nova.api.openstack.compute.multiple_create:MultipleCreate 82 multiple_create = nova.api.openstack.compute.multiple_create:MultipleCreate
83 networks = nova.api.openstack.compute.networks:Networks 83 networks = nova.api.openstack.compute.networks:Networks
84 networks_associate = nova.api.openstack.compute.networks_associate:NetworksAssociate 84 networks_associate = nova.api.openstack.compute.networks_associate:NetworksAssociate
85 quota_classes = nova.api.openstack.compute.quota_classes:QuotaClasses
86 remote_consoles = nova.api.openstack.compute.remote_consoles:RemoteConsoles 85 remote_consoles = nova.api.openstack.compute.remote_consoles:RemoteConsoles
87 security_group_default_rules = nova.api.openstack.compute.security_group_default_rules:SecurityGroupDefaultRules 86 security_group_default_rules = nova.api.openstack.compute.security_group_default_rules:SecurityGroupDefaultRules
88 security_groups = nova.api.openstack.compute.security_groups:SecurityGroups 87 security_groups = nova.api.openstack.compute.security_groups:SecurityGroups