Fix failover of az-specific loadbalancers

There is a bug exists in CalculateAmphoraDelta class
If there is no such a key as constants.MANAGEMENT_NETWORK
in availability_zone dictionary, method get will return None
It means that management_nets list will become [None], not
CONF.controller_worker.amp_boot_network_list as it supposes to be
It breaks the following failover flow

Story: 2008669
Task: 41957
Change-Id: I435c40a5493828bce24c2850182f0ddc8e5bdd1f
(cherry picked from commit 81134bdfec)
(cherry picked from commit 77a87a7f33)
(cherry picked from commit e3026d3582)
This commit is contained in:
Stanislav Dmitriev 2021-03-01 15:24:06 -05:00 committed by Gregory Thiemonge
parent 178481be9a
commit 0b4e05aeb6
1 changed files with 4 additions and 4 deletions

View File

@ -59,10 +59,10 @@ class CalculateAmphoraDelta(BaseNetworkTask):
if vrrp_port is None:
vrrp_port = self.network_driver.get_port(amphora.vrrp_port_id)
if availability_zone:
management_nets = (
[availability_zone.get(constants.MANAGEMENT_NETWORK)] or
CONF.controller_worker.amp_boot_network_list)
if (availability_zone and
availability_zone.get(constants.MANAGEMENT_NETWORK)):
management_nets = [availability_zone.get(
constants.MANAGEMENT_NETWORK)]
else:
management_nets = CONF.controller_worker.amp_boot_network_list
desired_network_ids = {vrrp_port.network_id}.union(management_nets)