Correct naming for quota resources
Story: 2002997 Task: 23013 Change-Id: Ie2f3944676f04e80b8dd4affe947b03d36d854f5
This commit is contained in:
parent
4688739662
commit
bd0206a6ea
@ -1 +1 @@
|
||||
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"quota":{"load_balancer":10,"listener":-1,"member":50,"pool":-1,"health_monitor":-1}}' http://198.51.100.10:9876/v2/lbaas/quotas/e3cd678b11784734bc366148aa37580e
|
||||
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"quota":{"loadbalancer":10,"listener":-1,"member":50,"pool":-1,"healthmonitor":-1}}' http://198.51.100.10:9876/v2/lbaas/quotas/e3cd678b11784734bc366148aa37580e
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"quota": {
|
||||
"load_balancer": 10,
|
||||
"loadbalancer": 10,
|
||||
"listener": -1,
|
||||
"member": 50,
|
||||
"pool": -1,
|
||||
"health_monitor": -1
|
||||
"healthmonitor": -1
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"quota": {
|
||||
"load_balancer": 10,
|
||||
"loadbalancer": 10,
|
||||
"listener": -1,
|
||||
"member": 50,
|
||||
"pool": -1,
|
||||
"health_monitor": -1
|
||||
"healthmonitor": -1
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"quota": {
|
||||
"load_balancer": 50,
|
||||
"loadbalancer": 50,
|
||||
"listener": -1,
|
||||
"member": -1,
|
||||
"pool": -1,
|
||||
"health_monitor": -1
|
||||
"healthmonitor": -1
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"quotas": [
|
||||
{
|
||||
"load_balancer": 5,
|
||||
"loadbalancer": 5,
|
||||
"member": 50,
|
||||
"health_monitor": -1,
|
||||
"healthmonitor": -1,
|
||||
"listener": null,
|
||||
"project_id": "e3cd678b11784734bc366148aa37580e",
|
||||
"pool": null
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"quota": {
|
||||
"load_balancer": 5,
|
||||
"loadbalancer": 5,
|
||||
"listener": -1,
|
||||
"member": 50,
|
||||
"pool": -1,
|
||||
"health_monitor": -1
|
||||
"healthmonitor": -1
|
||||
}
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ Response Parameters
|
||||
|
||||
.. rest_parameters:: ../parameters.yaml
|
||||
|
||||
- health_monitor: quota-health_monitor
|
||||
- healthmonitor: quota-health_monitor
|
||||
- listener: quota-listener
|
||||
- load_balancer: quota-load_balancer
|
||||
- loadbalancer: quota-load_balancer
|
||||
- member: quota-member
|
||||
- pool: quota-pool
|
||||
- project_id: project_id
|
||||
@ -98,9 +98,9 @@ Response Parameters
|
||||
|
||||
.. rest_parameters:: ../parameters.yaml
|
||||
|
||||
- health_monitor: quota-health_monitor
|
||||
- healthmonitor: quota-health_monitor
|
||||
- listener: quota-listener
|
||||
- load_balancer: quota-load_balancer
|
||||
- loadbalancer: quota-load_balancer
|
||||
- member: quota-member
|
||||
- pool: quota-pool
|
||||
|
||||
@ -155,9 +155,9 @@ Response Parameters
|
||||
|
||||
.. rest_parameters:: ../parameters.yaml
|
||||
|
||||
- health_monitor: quota-health_monitor
|
||||
- healthmonitor: quota-health_monitor
|
||||
- listener: quota-listener
|
||||
- load_balancer: quota-load_balancer
|
||||
- loadbalancer: quota-load_balancer
|
||||
- member: quota-member
|
||||
- pool: quota-pool
|
||||
|
||||
@ -205,9 +205,9 @@ Request
|
||||
|
||||
.. rest_parameters:: ../parameters.yaml
|
||||
|
||||
- health_monitor: quota-health_monitor-optional
|
||||
- healthmonitor: quota-health_monitor-optional
|
||||
- listener: quota-listener-optional
|
||||
- load_balancer: quota-load_balancer-optional
|
||||
- loadbalancer: quota-load_balancer-optional
|
||||
- member: quota-member-optional
|
||||
- pool: quota-pool-optional
|
||||
- project_id: path-project-id
|
||||
@ -229,9 +229,9 @@ Response Parameters
|
||||
|
||||
.. rest_parameters:: ../parameters.yaml
|
||||
|
||||
- health_monitor: quota-health_monitor
|
||||
- healthmonitor: quota-health_monitor
|
||||
- listener: quota-listener
|
||||
- load_balancer: quota-load_balancer
|
||||
- loadbalancer: quota-load_balancer
|
||||
- member: quota-member
|
||||
- pool: quota-pool
|
||||
|
||||
|
@ -20,6 +20,9 @@ from octavia.common import constants as consts
|
||||
|
||||
class QuotaBase(base.BaseType):
|
||||
"""Individual quota definitions."""
|
||||
loadbalancer = wtypes.wsattr(wtypes.IntegerType(
|
||||
minimum=consts.MIN_QUOTA, maximum=consts.MAX_QUOTA))
|
||||
# Misspelled version, deprecated in Rocky
|
||||
load_balancer = wtypes.wsattr(wtypes.IntegerType(
|
||||
minimum=consts.MIN_QUOTA, maximum=consts.MAX_QUOTA))
|
||||
listener = wtypes.wsattr(wtypes.IntegerType(
|
||||
@ -28,9 +31,20 @@ class QuotaBase(base.BaseType):
|
||||
minimum=consts.MIN_QUOTA, maximum=consts.MAX_QUOTA))
|
||||
pool = wtypes.wsattr(wtypes.IntegerType(
|
||||
minimum=consts.MIN_QUOTA, maximum=consts.MAX_QUOTA))
|
||||
healthmonitor = wtypes.wsattr(wtypes.IntegerType(
|
||||
minimum=consts.MIN_QUOTA, maximum=consts.MAX_QUOTA))
|
||||
# Misspelled version, deprecated in Rocky
|
||||
health_monitor = wtypes.wsattr(wtypes.IntegerType(
|
||||
minimum=consts.MIN_QUOTA, maximum=consts.MAX_QUOTA))
|
||||
|
||||
def to_dict(self, render_unsets=False):
|
||||
quota_dict = super(QuotaBase, self).to_dict(render_unsets)
|
||||
if 'loadbalancer' in quota_dict:
|
||||
quota_dict['load_balancer'] = quota_dict.pop('loadbalancer')
|
||||
if 'healthmonitor' in quota_dict:
|
||||
quota_dict['health_monitor'] = quota_dict.pop('healthmonitor')
|
||||
return quota_dict
|
||||
|
||||
|
||||
class QuotaResponse(base.BaseType):
|
||||
"""Wrapper object for quotas responses."""
|
||||
@ -47,19 +61,28 @@ class QuotaResponse(base.BaseType):
|
||||
class QuotaAllBase(base.BaseType):
|
||||
"""Wrapper object for get all quotas responses."""
|
||||
project_id = wtypes.wsattr(wtypes.StringType())
|
||||
loadbalancer = wtypes.wsattr(wtypes.IntegerType())
|
||||
# Misspelled version, deprecated in Rocky, remove in T
|
||||
load_balancer = wtypes.wsattr(wtypes.IntegerType())
|
||||
listener = wtypes.wsattr(wtypes.IntegerType())
|
||||
member = wtypes.wsattr(wtypes.IntegerType())
|
||||
pool = wtypes.wsattr(wtypes.IntegerType())
|
||||
healthmonitor = wtypes.wsattr(wtypes.IntegerType())
|
||||
# Misspelled version, deprecated in Rocky, remove in T
|
||||
health_monitor = wtypes.wsattr(wtypes.IntegerType())
|
||||
|
||||
_type_to_model_map = {}
|
||||
_type_to_model_map = {'loadbalancer': 'load_balancer',
|
||||
'healthmonitor': 'health_monitor'}
|
||||
_child_map = {}
|
||||
|
||||
@classmethod
|
||||
def from_data_model(cls, data_model, children=False):
|
||||
quotas = super(QuotaAllBase, cls).from_data_model(
|
||||
data_model, children=children)
|
||||
# For backwards compatibility, remove in T
|
||||
quotas.load_balancer = quotas.loadbalancer
|
||||
# For backwards compatibility, remove in T
|
||||
quotas.health_monitor = quotas.healthmonitor
|
||||
return quotas
|
||||
|
||||
|
||||
|
@ -97,6 +97,40 @@ class TestQuotas(base.BaseAPITest):
|
||||
|
||||
quota1['project_id'] = quota1['tenant_id'] = project_id1
|
||||
quota2['project_id'] = quota2['tenant_id'] = project_id2
|
||||
# Expected deprecated names until T
|
||||
quota1['healthmonitor'] = quota1['health_monitor']
|
||||
quota1['loadbalancer'] = quota1['load_balancer']
|
||||
quota2['healthmonitor'] = quota2['health_monitor']
|
||||
quota2['loadbalancer'] = quota2['load_balancer']
|
||||
|
||||
expected = {'quotas': [quota1, quota2], 'quotas_links': []}
|
||||
self.assertEqual(expected, quota_list)
|
||||
|
||||
def test_deprecated_get_and_put_vars(self):
|
||||
project_id1 = uuidutils.generate_uuid()
|
||||
project_id2 = uuidutils.generate_uuid()
|
||||
quota_path1 = self.QUOTA_PATH.format(project_id=project_id1)
|
||||
quota1 = {'load_balancer': constants.QUOTA_UNLIMITED, 'listener': 30,
|
||||
'pool': 30, 'health_monitor': 30, 'member': 30}
|
||||
body1 = {'quota': quota1}
|
||||
self.put(quota_path1, body1, status=202)
|
||||
quota_path2 = self.QUOTA_PATH.format(project_id=project_id2)
|
||||
quota2 = {'loadbalancer': 50, 'listener': 50, 'pool': 50,
|
||||
'healthmonitor': 50, 'member': 50}
|
||||
body2 = {'quota': quota2}
|
||||
self.put(quota_path2, body2, status=202)
|
||||
|
||||
response = self.get(self.QUOTAS_PATH)
|
||||
quota_list = response.json
|
||||
|
||||
quota1['project_id'] = quota1['tenant_id'] = project_id1
|
||||
quota2['project_id'] = quota2['tenant_id'] = project_id2
|
||||
# Expected deprecated names until T
|
||||
quota1['healthmonitor'] = quota1['health_monitor']
|
||||
quota1['loadbalancer'] = quota1['load_balancer']
|
||||
quota2['health_monitor'] = quota2['healthmonitor']
|
||||
quota2['load_balancer'] = quota2['loadbalancer']
|
||||
|
||||
expected = {'quotas': [quota1, quota2], 'quotas_links': []}
|
||||
self.assertEqual(expected, quota_list)
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
The quota objects named `health_monitor` and `load_balancer` have been
|
||||
renamed to `healthmonitor` and `loadbalancer`, respectively. The old names
|
||||
are deprecated, and will be removed in the T cycle.
|
||||
|
Loading…
x
Reference in New Issue
Block a user