Correct flavor to flavor_id in LB API

This matches neutron-lbaas. This was never actually used, so changing it
should not be an issue hopefully.

Change-Id: If5dfcb291e7fa5c406ea99905f61673786823c8b
(cherry picked from commit 86da7a86a1)
This commit is contained in:
Adam Harwell 2018-04-19 16:15:01 -07:00 committed by Carlos Goncalves
parent 12bf4409fa
commit 3b944e8c9c
11 changed files with 23 additions and 23 deletions

View File

@ -1 +1 @@
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"loadbalancer": {"description": "My favorite load balancer", "admin_state_up": true, "project_id": "e3cd678b11784734bc366148aa37580e", "flavor": "a7ae5d5a-d855-4f9a-b187-af66b53f4d04", "vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a", "vip_address": "203.0.113.50", "provider": "octavia", "name": "best_load_balancer", "vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"}}' http://198.51.100.10:9876/v2.0/lbaas/loadbalancers
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"loadbalancer": {"description": "My favorite load balancer", "admin_state_up": true, "project_id": "e3cd678b11784734bc366148aa37580e", "flavor_id": "a7ae5d5a-d855-4f9a-b187-af66b53f4d04", "vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a", "vip_address": "203.0.113.50", "provider": "octavia", "name": "best_load_balancer", "vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"}}' http://198.51.100.10:9876/v2.0/lbaas/loadbalancers

View File

@ -4,7 +4,7 @@
"admin_state_up": true,
"project_id": "e3cd678b11784734bc366148aa37580e",
"provisioning_status": "PENDING_CREATE",
"flavor": "",
"flavor_id": "",
"vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a",
"vip_address": "203.0.113.50",
"vip_network_id": "d0d217df-3958-4fbf-a3c2-8dad2908c709",

View File

@ -3,7 +3,7 @@
"description": "My favorite load balancer",
"admin_state_up": true,
"project_id": "e3cd678b11784734bc366148aa37580e",
"flavor": "",
"flavor_id": "",
"listeners": [
{
"name": "http_listener",

View File

@ -4,7 +4,7 @@
"admin_state_up": true,
"project_id": "e3cd678b11784734bc366148aa37580e",
"provisioning_status": "ACTIVE",
"flavor": "",
"flavor_id": "",
"vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a",
"listeners": [
{

View File

@ -4,7 +4,7 @@
"admin_state_up": true,
"project_id": "e3cd678b11784734bc366148aa37580e",
"provisioning_status": "PENDING_CREATE",
"flavor": "",
"flavor_id": "",
"vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a",
"vip_address": "203.0.113.50",
"vip_network_id": "d0d217df-3958-4fbf-a3c2-8dad2908c709",

View File

@ -4,7 +4,7 @@
"admin_state_up": false,
"project_id": "e3cd678b11784734bc366148aa37580e",
"provisioning_status": "PENDING_UPDATE",
"flavor": "",
"flavor_id": "",
"vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a",
"vip_address": "203.0.113.50",
"vip_network_id": "d0d217df-3958-4fbf-a3c2-8dad2908c709",

View File

@ -5,7 +5,7 @@
"admin_state_up": true,
"project_id": "e3cd678b11784734bc366148aa37580e",
"provisioning_status": "ACTIVE",
"flavor": "a7ae5d5a-d855-4f9a-b187-af66b53f4d04",
"flavor_id": "",
"vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a",
"listeners": [
{

View File

@ -48,7 +48,7 @@ Response Parameters
- admin_state_up: admin_state_up
- created_at: created_at
- description: description
- flavor: flavor-id
- flavor_id: flavor-id
- id: loadbalancer-id
- listeners: listeners
- loadbalancers: loadbalancers
@ -102,7 +102,7 @@ and submit the request again.
Administrative users can specify a project ID that is different than
their own to create load balancers for other projects.
An optional ``flavor`` attribute can be used to create the load balancer
An optional ``flavor_id`` attribute can be used to create the load balancer
using a pre-configured octavia flavor. Flavors are created by the operator
to allow custom load balancer configurations, such as allocating more
memory for the load balancer.
@ -115,7 +115,7 @@ You can also specify the ``provider`` attribute when you create a
load balancer. The ``provider`` attribute specifies which backend should
be used to create the load balancer. This could be the default provider
(``octavia``) or a vendor supplied ``provider`` if one has been installed.
Setting both a flavor and a provider will result in a conflict error.
Setting both a flavor_id and a provider will result in a conflict error.
Specifying a Virtual IP (VIP) is mandatory. There are three ways to specify
a VIP network for the load balancer:
@ -162,7 +162,7 @@ Request
- admin_state_up: admin_state_up-default-optional
- description: description-optional
- flavor: flavor-id-optional
- flavor_id: flavor-id-optional
- listeners: listeners-optional
- loadbalancer: loadbalancer
- name: name-optional
@ -194,7 +194,7 @@ Response Parameters
- admin_state_up: admin_state_up
- created_at: created_at
- description: description
- flavor: flavor-id
- flavor_id: flavor-id
- id: loadbalancer-id
- listeners: listeners
- loadbalancer: loadbalancer
@ -286,7 +286,7 @@ Response Parameters
- admin_state_up: admin_state_up
- created_at: created_at
- description: description
- flavor: flavor-id
- flavor_id: flavor-id
- id: loadbalancer-id
- loadbalancer: loadbalancer
- listeners: listeners
@ -370,7 +370,7 @@ Response Parameters
- admin_state_up: admin_state_up
- created_at: created_at
- description: description
- flavor: flavor-id
- flavor_id: flavor-id
- id: loadbalancer-id
- listeners: listeners
- loadbalancer: loadbalancer

View File

@ -271,8 +271,8 @@ class LoadBalancersController(base.BaseController):
# Remove these lines as they are implemented.
if 'provider' in lb_dict:
del lb_dict['provider']
if 'flavor' in lb_dict:
del lb_dict['flavor']
if 'flavor_id' in lb_dict:
del lb_dict['flavor_id']
db_lb = self.repositories.create_load_balancer_and_vip(
lock_session, lb_dict, vip_dict)

View File

@ -53,7 +53,7 @@ class LoadBalancerResponse(BaseLoadBalancerType):
listeners = wtypes.wsattr([types.IdOnlyType])
pools = wtypes.wsattr([types.IdOnlyType])
provider = wtypes.wsattr(wtypes.StringType())
flavor = wtypes.wsattr(wtypes.StringType())
flavor_id = wtypes.wsattr(wtypes.StringType())
vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType())
@classmethod
@ -77,8 +77,8 @@ class LoadBalancerResponse(BaseLoadBalancerType):
result.pools = [
pool_model.from_data_model(i) for i in data_model.pools]
if not result.flavor:
result.flavor = ""
if not result.flavor_id:
result.flavor_id = ""
if not result.provider:
result.provider = "octavia"
@ -126,7 +126,7 @@ class LoadBalancerPOST(BaseLoadBalancerType):
provider = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_PROVIDERS))
# TODO(johnsom) This should be dynamic based on the loaded flavors
# once flavors are implemented.
flavor = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_FLAVORS))
flavor_id = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_FLAVORS))
class LoadBalancerRootPOST(types.BaseType):

View File

@ -797,12 +797,12 @@ class TestLoadBalancer(base.BaseAPITest):
lb_json = {'name': 'test1',
'vip_subnet_id': uuidutils.generate_uuid(),
'project_id': self.project_id,
'flavor': 'BOGUS'
'flavor_id': 'BOGUS'
}
lb_json.update(optionals)
body = self._build_body(lb_json)
response = self.post(self.LBS_PATH, body, status=400)
self.assertIn("Invalid input for field/attribute flavor. Value: "
self.assertIn("Invalid input for field/attribute flavor_id. Value: "
"'BOGUS'. Value should be one of:",
response.json.get('faultstring'))
@ -1925,7 +1925,7 @@ class TestLoadBalancerGraph(base.BaseAPITest):
# expected that this would be overwritten anyway, so 'ANY' is fine?
'vip_network_id': mock.ANY,
'vip_qos_policy_id': None,
'flavor': '',
'flavor_id': '',
'provider': 'octavia'
}
expected_lb.update(create_lb)