diff --git a/api-ref/source/v2/examples/loadbalancer-create-curl b/api-ref/source/v2/examples/loadbalancer-create-curl index 853065b7cd..ec851dbf57 100644 --- a/api-ref/source/v2/examples/loadbalancer-create-curl +++ b/api-ref/source/v2/examples/loadbalancer-create-curl @@ -1 +1 @@ -curl -X POST -H "Content-Type: application/json" -H "X-Auth-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: " -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 diff --git a/api-ref/source/v2/examples/loadbalancer-create-response.json b/api-ref/source/v2/examples/loadbalancer-create-response.json index fdc96246e4..bd51291494 100644 --- a/api-ref/source/v2/examples/loadbalancer-create-response.json +++ b/api-ref/source/v2/examples/loadbalancer-create-response.json @@ -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", diff --git a/api-ref/source/v2/examples/loadbalancer-full-create-request.json b/api-ref/source/v2/examples/loadbalancer-full-create-request.json index 2f21071dee..f452348a8d 100644 --- a/api-ref/source/v2/examples/loadbalancer-full-create-request.json +++ b/api-ref/source/v2/examples/loadbalancer-full-create-request.json @@ -3,7 +3,7 @@ "description": "My favorite load balancer", "admin_state_up": true, "project_id": "e3cd678b11784734bc366148aa37580e", - "flavor": "", + "flavor_id": "", "listeners": [ { "name": "http_listener", diff --git a/api-ref/source/v2/examples/loadbalancer-full-create-response.json b/api-ref/source/v2/examples/loadbalancer-full-create-response.json index a010a2bd21..f50ac23477 100644 --- a/api-ref/source/v2/examples/loadbalancer-full-create-response.json +++ b/api-ref/source/v2/examples/loadbalancer-full-create-response.json @@ -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": [ { diff --git a/api-ref/source/v2/examples/loadbalancer-show-response.json b/api-ref/source/v2/examples/loadbalancer-show-response.json index 81a5b1bb79..06d89ed86d 100644 --- a/api-ref/source/v2/examples/loadbalancer-show-response.json +++ b/api-ref/source/v2/examples/loadbalancer-show-response.json @@ -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", diff --git a/api-ref/source/v2/examples/loadbalancer-update-response.json b/api-ref/source/v2/examples/loadbalancer-update-response.json index c31fe28aba..9d973a7c15 100644 --- a/api-ref/source/v2/examples/loadbalancer-update-response.json +++ b/api-ref/source/v2/examples/loadbalancer-update-response.json @@ -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", diff --git a/api-ref/source/v2/examples/loadbalancers-list-response.json b/api-ref/source/v2/examples/loadbalancers-list-response.json index 23cd546482..b234def2b7 100644 --- a/api-ref/source/v2/examples/loadbalancers-list-response.json +++ b/api-ref/source/v2/examples/loadbalancers-list-response.json @@ -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": [ { diff --git a/api-ref/source/v2/loadbalancer.inc b/api-ref/source/v2/loadbalancer.inc index 9d2c65f988..8b8fef3ca0 100644 --- a/api-ref/source/v2/loadbalancer.inc +++ b/api-ref/source/v2/loadbalancer.inc @@ -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 diff --git a/octavia/api/v2/controllers/load_balancer.py b/octavia/api/v2/controllers/load_balancer.py index 53259827d2..61d67e2d36 100644 --- a/octavia/api/v2/controllers/load_balancer.py +++ b/octavia/api/v2/controllers/load_balancer.py @@ -274,8 +274,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) diff --git a/octavia/api/v2/types/load_balancer.py b/octavia/api/v2/types/load_balancer.py index 747c88840f..29508404f9 100644 --- a/octavia/api/v2/types/load_balancer.py +++ b/octavia/api/v2/types/load_balancer.py @@ -52,7 +52,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 @@ -76,8 +76,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" @@ -125,7 +125,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): diff --git a/octavia/tests/functional/api/v2/test_load_balancer.py b/octavia/tests/functional/api/v2/test_load_balancer.py index 6b1815ba00..b28343df46 100644 --- a/octavia/tests/functional/api/v2/test_load_balancer.py +++ b/octavia/tests/functional/api/v2/test_load_balancer.py @@ -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')) @@ -1948,7 +1948,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)