Fixes missing project ID when running a octavia task.
Change-Id: I1393b41570c5316fe0012cb059b9cb64d5854aab Closes-Bug: #1833235
This commit is contained in:
parent
bc54ed8ad8
commit
65341e1531
@ -46,6 +46,7 @@ class CreateAndListLoadbalancers(octavia_utils.OctaviaBase):
|
||||
subnets = []
|
||||
loadbalancers = []
|
||||
networks = self.context.get("tenant", {}).get("networks", [])
|
||||
project_id = self.context["tenant"]["id"]
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet_id in subnets:
|
||||
@ -53,6 +54,7 @@ class CreateAndListLoadbalancers(octavia_utils.OctaviaBase):
|
||||
subnet_id=subnet_id,
|
||||
description=description,
|
||||
admin_state=admin_state,
|
||||
project_id=project_id,
|
||||
listeners=listeners,
|
||||
flavor_id=flavor_id,
|
||||
provider=provider,
|
||||
@ -88,6 +90,7 @@ class CreateAndDeleteLoadbalancers(octavia_utils.OctaviaBase):
|
||||
subnets = []
|
||||
loadbalancers = []
|
||||
networks = self.context.get("tenant", {}).get("networks", [])
|
||||
project_id = self.context["tenant"]["id"]
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet_id in subnets:
|
||||
@ -95,6 +98,7 @@ class CreateAndDeleteLoadbalancers(octavia_utils.OctaviaBase):
|
||||
subnet_id=subnet_id,
|
||||
description=description,
|
||||
admin_state=admin_state,
|
||||
project_id=project_id,
|
||||
listeners=listeners,
|
||||
flavor_id=flavor_id,
|
||||
provider=provider,
|
||||
@ -131,6 +135,7 @@ class CreateAndUpdateLoadBalancers(octavia_utils.OctaviaBase):
|
||||
subnets = []
|
||||
loadbalancers = []
|
||||
networks = self.context.get("tenant", {}).get("networks", [])
|
||||
project_id = self.context["tenant"]["id"]
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet_id in subnets:
|
||||
@ -138,6 +143,7 @@ class CreateAndUpdateLoadBalancers(octavia_utils.OctaviaBase):
|
||||
subnet_id=subnet_id,
|
||||
description=description,
|
||||
admin_state=admin_state,
|
||||
project_id=project_id,
|
||||
listeners=listeners,
|
||||
flavor_id=flavor_id,
|
||||
provider=provider,
|
||||
@ -179,6 +185,7 @@ class CreateAndShowStatsLoadBalancers(octavia_utils.OctaviaBase):
|
||||
subnets = []
|
||||
loadbalancers = []
|
||||
networks = self.context.get("tenant", {}).get("networks", [])
|
||||
project_id = self.context["tenant"]["id"]
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet_id in subnets:
|
||||
@ -186,6 +193,7 @@ class CreateAndShowStatsLoadBalancers(octavia_utils.OctaviaBase):
|
||||
subnet_id=subnet_id,
|
||||
description=description,
|
||||
admin_state=admin_state,
|
||||
project_id=project_id,
|
||||
listeners=listeners,
|
||||
flavor_id=flavor_id,
|
||||
provider=provider,
|
||||
@ -222,6 +230,7 @@ class CreateAndShowLoadBalancers(octavia_utils.OctaviaBase):
|
||||
subnets = []
|
||||
loadbalancers = []
|
||||
networks = self.context.get("tenant", {}).get("networks", [])
|
||||
project_id = self.context["tenant"]["id"]
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet_id in subnets:
|
||||
@ -229,6 +238,7 @@ class CreateAndShowLoadBalancers(octavia_utils.OctaviaBase):
|
||||
subnet_id=subnet_id,
|
||||
description=description,
|
||||
admin_state=admin_state,
|
||||
project_id=project_id,
|
||||
listeners=listeners,
|
||||
flavor_id=flavor_id,
|
||||
provider=provider,
|
||||
|
@ -39,10 +39,12 @@ class CreateAndListPools(utils.OctaviaBase):
|
||||
subnets = []
|
||||
loadbalancers = []
|
||||
networks = self.context.get("tenant", {}).get("networks", [])
|
||||
project_id = self.context["tenant"]["id"]
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet_id in subnets:
|
||||
lb = self.octavia.load_balancer_create(
|
||||
project_id=project_id,
|
||||
subnet_id=subnet_id)
|
||||
loadbalancers.append(lb)
|
||||
|
||||
@ -71,10 +73,12 @@ class CreateAndDeletePools(utils.OctaviaBase):
|
||||
subnets = []
|
||||
loadbalancers = []
|
||||
networks = self.context.get("tenant", {}).get("networks", [])
|
||||
project_id = self.context["tenant"]["id"]
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet_id in subnets:
|
||||
lb = self.octavia.load_balancer_create(
|
||||
project_id=project_id,
|
||||
subnet_id=subnet_id)
|
||||
loadbalancers.append(lb)
|
||||
|
||||
@ -103,10 +107,12 @@ class CreateAndUpdatePools(utils.OctaviaBase):
|
||||
subnets = []
|
||||
loadbalancers = []
|
||||
networks = self.context.get("tenant", {}).get("networks", [])
|
||||
project_id = self.context["tenant"]["id"]
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet_id in subnets:
|
||||
lb = self.octavia.load_balancer_create(
|
||||
project_id=project_id,
|
||||
subnet_id=subnet_id)
|
||||
loadbalancers.append(lb)
|
||||
|
||||
@ -140,10 +146,12 @@ class CreateAndShowPools(utils.OctaviaBase):
|
||||
subnets = []
|
||||
loadbalancers = []
|
||||
networks = self.context.get("tenant", {}).get("networks", [])
|
||||
project_id = self.context["tenant"]["id"]
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet_id in subnets:
|
||||
lb = self.octavia.load_balancer_create(
|
||||
project_id=project_id,
|
||||
subnet_id=subnet_id)
|
||||
loadbalancers.append(lb)
|
||||
|
||||
|
@ -54,7 +54,8 @@ class Octavia(service.Service):
|
||||
|
||||
@atomic.action_timer("octavia.load_balancer_create")
|
||||
def load_balancer_create(self, subnet_id, description=None,
|
||||
admin_state=None, listeners=None, flavor_id=None,
|
||||
admin_state=None, project_id=None,
|
||||
listeners=None, flavor_id=None,
|
||||
provider=None, vip_qos_policy_id=None):
|
||||
"""Create a load balancer
|
||||
|
||||
@ -67,6 +68,7 @@ class Octavia(service.Service):
|
||||
"listeners": listeners,
|
||||
"provider": provider,
|
||||
"admin_state_up": admin_state or True,
|
||||
"project_id": project_id,
|
||||
"vip_subnet_id": subnet_id,
|
||||
"vip_qos_policy_id": vip_qos_policy_id,
|
||||
}
|
||||
@ -215,7 +217,8 @@ class Octavia(service.Service):
|
||||
@atomic.action_timer("octavia.pool_create")
|
||||
def pool_create(self, lb_id, protocol, lb_algorithm,
|
||||
listener_id=None, description=None,
|
||||
admin_state_up=True, session_persistence=None):
|
||||
admin_state_up=True, project_id=None,
|
||||
session_persistence=None):
|
||||
"""Create a pool
|
||||
|
||||
:param lb_id: ID of the loadbalancer
|
||||
@ -224,6 +227,7 @@ class Octavia(service.Service):
|
||||
:param listener_id: ID of the listener
|
||||
:param description: a human readable description of the pool
|
||||
:param admin_state_up: administrative state of the resource
|
||||
:param project_id: project ID of the resource
|
||||
:param session_persistence: a json object specifiying the session
|
||||
persistence of the pool
|
||||
:return:
|
||||
@ -237,6 +241,7 @@ class Octavia(service.Service):
|
||||
"listener_id": listener_id,
|
||||
"description": description,
|
||||
"admin_state_up": admin_state_up,
|
||||
"project_id": project_id,
|
||||
"session_persistence": session_persistence
|
||||
}
|
||||
pool = self._clients.octavia().pool_create(
|
||||
|
@ -56,7 +56,8 @@ class PoolsTestCase(test.ScenarioTestCase):
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet in subnets:
|
||||
mock_has_calls.append(mock.call(subnet_id="fake_subnet"))
|
||||
mock_has_calls.append(mock.call(subnet_id="fake_subnet",
|
||||
project_id="fake_tenant"))
|
||||
loadbalancer_service.load_balancer_create.assert_has_calls(
|
||||
mock_has_calls)
|
||||
for lb in loadbalancer:
|
||||
@ -82,7 +83,8 @@ class PoolsTestCase(test.ScenarioTestCase):
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet in subnets:
|
||||
mock_has_calls.append(mock.call(subnet_id="fake_subnet"))
|
||||
mock_has_calls.append(mock.call(subnet_id="fake_subnet",
|
||||
project_id="fake_tenant"))
|
||||
loadbalancer_service.load_balancer_create.assert_has_calls(
|
||||
mock_has_calls)
|
||||
for lb in loadbalancer:
|
||||
@ -109,7 +111,8 @@ class PoolsTestCase(test.ScenarioTestCase):
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet in subnets:
|
||||
mock_has_calls.append(mock.call(subnet_id="fake_subnet"))
|
||||
mock_has_calls.append(mock.call(subnet_id="fake_subnet",
|
||||
project_id="fake_tenant"))
|
||||
loadbalancer_service.load_balancer_create.assert_has_calls(
|
||||
mock_has_calls)
|
||||
for lb in loadbalancer:
|
||||
@ -136,7 +139,8 @@ class PoolsTestCase(test.ScenarioTestCase):
|
||||
for network in networks:
|
||||
subnets.extend(network.get("subnets", []))
|
||||
for subnet in subnets:
|
||||
mock_has_calls.append(mock.call(subnet_id="fake_subnet"))
|
||||
mock_has_calls.append(mock.call(subnet_id="fake_subnet",
|
||||
project_id="fake_tenant"))
|
||||
loadbalancer_service.load_balancer_create.assert_has_calls(
|
||||
mock_has_calls)
|
||||
for lb in loadbalancer:
|
||||
|
@ -94,6 +94,7 @@ class LoadBalancerServiceTestCase(test.TestCase):
|
||||
"admin_state_up": True,
|
||||
"vip_qos_policy_id": None,
|
||||
"listeners": None,
|
||||
"project_id": None,
|
||||
"provider": None,
|
||||
"vip_subnet_id": "subnet_id",
|
||||
"description": None}})
|
||||
@ -219,6 +220,7 @@ class LoadBalancerServiceTestCase(test.TestCase):
|
||||
.assert_called_once_with(
|
||||
json={"pool": {
|
||||
"lb_algorithm": "ROUND_ROBIN",
|
||||
"project_id": None,
|
||||
"protocol": "HTTP",
|
||||
"listener_id": None,
|
||||
"description": None,
|
||||
|
Loading…
Reference in New Issue
Block a user