Fix PortNotFound exception when updating a LB after a failover
The ApplyQos task applied the qos policy on the VRRP ports of all the amphorae linked to a load balancer, including amphorae in DELETED status. It triggered an ERROR when updating a LB (with a qos policy) after a failover. Story 2009667 Task 43894 Change-Id: I876fd91fb40d9250381bbb37f8148b53692a7d8d (cherry picked from commit c3481d04a25c4e6f03ce4de720c620730188d99e)
This commit is contained in:
parent
0bf3ae96d1
commit
328ffc00cf
@ -621,6 +621,10 @@ class ApplyQos(BaseNetworkTask):
|
||||
if not amps_data:
|
||||
amps_data = loadbalancer.amphorae
|
||||
|
||||
amps_data = [amp
|
||||
for amp in amps_data
|
||||
if amp.status == constants.AMPHORA_ALLOCATED]
|
||||
|
||||
apply_qos = ApplyQosAmphora()
|
||||
for amp_data in amps_data:
|
||||
apply_qos._apply_qos_on_vrrp_port(loadbalancer, amp_data,
|
||||
|
@ -694,6 +694,10 @@ class ApplyQos(BaseNetworkTask):
|
||||
id=loadbalancer[constants.LOADBALANCER_ID])
|
||||
amps_data = db_lb.amphorae
|
||||
|
||||
amps_data = [amp
|
||||
for amp in amps_data
|
||||
if amp.status == constants.AMPHORA_ALLOCATED]
|
||||
|
||||
apply_qos = ApplyQosAmphora()
|
||||
for amp_data in amps_data:
|
||||
apply_qos._apply_qos_on_vrrp_port(loadbalancer, amp_data.to_dict(),
|
||||
|
@ -177,8 +177,10 @@ MOCK_FLOATING_IP = {'floatingip': {'id': MOCK_FLOATING_IP_ID,
|
||||
|
||||
MOCK_AMP_ID1 = 'amp1-id'
|
||||
MOCK_AMP_ID2 = 'amp2-id'
|
||||
MOCK_AMP_ID3 = 'amp3-id'
|
||||
MOCK_AMP_COMPUTE_ID1 = 'amp1-compute-id'
|
||||
MOCK_AMP_COMPUTE_ID2 = 'amp2-compute-id'
|
||||
MOCK_AMP_COMPUTE_ID3 = 'amp3-compute-id'
|
||||
|
||||
MOCK_MANAGEMENT_SUBNET_ID = 'mgmt-subnet-1'
|
||||
MOCK_MANAGEMENT_NET_ID = 'mgmt-net-1'
|
||||
@ -218,9 +220,11 @@ MOCK_VIP_SUBNET_ID = 'vip-subnet-1'
|
||||
MOCK_VIP_NET_ID = 'vip-net-1'
|
||||
MOCK_VRRP_PORT_ID1 = 'vrrp-port-1'
|
||||
MOCK_VRRP_PORT_ID2 = 'vrrp-port-2'
|
||||
MOCK_VRRP_PORT_ID3 = 'vrrp-port-3'
|
||||
# These IPs become vrrp_ip
|
||||
MOCK_VRRP_IP1 = '55.55.55.1'
|
||||
MOCK_VRRP_IP2 = '55.55.55.2'
|
||||
MOCK_VRRP_IP3 = '55.55.55.3'
|
||||
|
||||
MOCK_VRRP_FIXED_IPS1 = [{'ip_address': MOCK_VRRP_IP1,
|
||||
'subnet_id': MOCK_VIP_SUBNET_ID}]
|
||||
|
@ -50,11 +50,17 @@ INTERFACE = data_models.Interface(id=uuidutils.generate_uuid(),
|
||||
compute_id=COMPUTE_ID, fixed_ips=FIXED_IPS,
|
||||
port_id=PORT_ID)
|
||||
AMPS_DATA = [o_data_models.Amphora(id=t_constants.MOCK_AMP_ID1,
|
||||
status=constants.AMPHORA_ALLOCATED,
|
||||
vrrp_port_id=t_constants.MOCK_VRRP_PORT_ID1,
|
||||
vrrp_ip=t_constants.MOCK_VRRP_IP1),
|
||||
o_data_models.Amphora(id=t_constants.MOCK_AMP_ID2,
|
||||
status=constants.AMPHORA_ALLOCATED,
|
||||
vrrp_port_id=t_constants.MOCK_VRRP_PORT_ID2,
|
||||
vrrp_ip=t_constants.MOCK_VRRP_IP2)
|
||||
vrrp_ip=t_constants.MOCK_VRRP_IP2),
|
||||
o_data_models.Amphora(id=t_constants.MOCK_AMP_ID3,
|
||||
status=constants.DELETED,
|
||||
vrrp_port_id=t_constants.MOCK_VRRP_PORT_ID3,
|
||||
vrrp_ip=t_constants.MOCK_VRRP_IP3)
|
||||
]
|
||||
UPDATE_DICT = {constants.TOPOLOGY: None}
|
||||
|
||||
|
@ -52,11 +52,17 @@ INTERFACE = data_models.Interface(id=uuidutils.generate_uuid(),
|
||||
compute_id=COMPUTE_ID, fixed_ips=FIXED_IPS,
|
||||
port_id=PORT_ID)
|
||||
AMPS_DATA = [o_data_models.Amphora(id=t_constants.MOCK_AMP_ID1,
|
||||
status=constants.AMPHORA_ALLOCATED,
|
||||
vrrp_port_id=t_constants.MOCK_VRRP_PORT_ID1,
|
||||
vrrp_ip=t_constants.MOCK_VRRP_IP1),
|
||||
o_data_models.Amphora(id=t_constants.MOCK_AMP_ID2,
|
||||
status=constants.AMPHORA_ALLOCATED,
|
||||
vrrp_port_id=t_constants.MOCK_VRRP_PORT_ID2,
|
||||
vrrp_ip=t_constants.MOCK_VRRP_IP2)
|
||||
vrrp_ip=t_constants.MOCK_VRRP_IP2),
|
||||
o_data_models.Amphora(id=t_constants.MOCK_AMP_ID3,
|
||||
status=constants.DELETED,
|
||||
vrrp_port_id=t_constants.MOCK_VRRP_PORT_ID3,
|
||||
vrrp_ip=t_constants.MOCK_VRRP_IP3)
|
||||
]
|
||||
UPDATE_DICT = {constants.TOPOLOGY: None}
|
||||
_session_mock = mock.MagicMock()
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fix a bug when updating a load balancer with a QoS policy after a failover,
|
||||
Octavia attempted to update the VRRP ports of the deleted amphorae, moving
|
||||
the provisioning status of the load balancer to ERROR.
|
Loading…
x
Reference in New Issue
Block a user