"_handle_lb_fip_cmds" to handle the LB members correctly
This patch indents the section where the load balancer members are properly verified. This section must be executed for each load balancer matching the logical switch port with the VIP passed as an argument to the method "_handle_lb_fip_cmds". Closes-Bug: #1977969 Change-Id: Ib220867106abc59da4fae51a60ef52d0c02592c8
This commit is contained in:
@@ -934,62 +934,62 @@ class OVNClient(object):
|
||||
"for OVN LB member "
|
||||
"%s.", m['id'])
|
||||
|
||||
# Find a member LSPs from all linked LS to this LB.
|
||||
for member in members_to_verify:
|
||||
ls = self._nb_idl.lookup(
|
||||
'Logical_Switch', utils.ovn_name(member['network_id']))
|
||||
for lsp in ls.ports:
|
||||
if not lsp.addresses:
|
||||
continue
|
||||
if member['ip'] in utils.remove_macs_from_lsp_addresses(
|
||||
lsp.addresses):
|
||||
member['lsp'] = lsp
|
||||
nats = self._nb_idl.db_find_rows(
|
||||
'NAT',
|
||||
('external_ids', '=', {
|
||||
ovn_const.OVN_FIP_PORT_EXT_ID_KEY: lsp.name})
|
||||
).execute(check_error=True)
|
||||
# Find a member LSPs from all linked LS to this LB.
|
||||
for member in members_to_verify:
|
||||
ls = self._nb_idl.lookup(
|
||||
'Logical_Switch', utils.ovn_name(member['network_id']))
|
||||
for lsp in ls.ports:
|
||||
if not lsp.addresses:
|
||||
continue
|
||||
if member['ip'] in utils.remove_macs_from_lsp_addresses(
|
||||
lsp.addresses):
|
||||
member['lsp'] = lsp
|
||||
nats = self._nb_idl.db_find_rows(
|
||||
'NAT',
|
||||
('external_ids', '=', {
|
||||
ovn_const.OVN_FIP_PORT_EXT_ID_KEY: lsp.name})
|
||||
).execute(check_error=True)
|
||||
|
||||
for nat in nats:
|
||||
if action == ovn_const.FIP_ACTION_ASSOCIATE:
|
||||
# NOTE(mjozefcz): We should delete logical_port
|
||||
# and external_mac entries from member NAT in
|
||||
# order to make traffic work.
|
||||
LOG.warning(
|
||||
"Port %s is configured as a member "
|
||||
"of one of OVN Load_Balancers and "
|
||||
"Load_Balancer has FIP assigned. "
|
||||
"In order to make traffic work member "
|
||||
"FIP needs to be centralized, even if "
|
||||
"this environment is configured as "
|
||||
"DVR. Removing logical_port and "
|
||||
"external_mac from NAT entry.",
|
||||
lsp.name)
|
||||
commands.extend([
|
||||
self._nb_idl.db_clear(
|
||||
'NAT', nat.uuid, 'external_mac'),
|
||||
self._nb_idl.db_clear(
|
||||
'NAT', nat.uuid, 'logical_port')])
|
||||
else:
|
||||
# NOTE(mjozefcz): The FIP from LB VIP is
|
||||
# dissassociated now. We can decentralize
|
||||
# member FIPs now.
|
||||
LOG.warning(
|
||||
"Port %s is configured as a member "
|
||||
"of one of OVN Load_Balancers and "
|
||||
"Load_Balancer has FIP disassociated. "
|
||||
"DVR for this port can be enabled back.",
|
||||
lsp.name)
|
||||
commands.append(self._nb_idl.db_set(
|
||||
'NAT', nat.uuid,
|
||||
('logical_port', lsp.name)))
|
||||
port = self._plugin.get_port(context, lsp.name)
|
||||
if port['status'] == const.PORT_STATUS_ACTIVE:
|
||||
commands.append(
|
||||
self._nb_idl.db_set(
|
||||
'NAT', nat.uuid,
|
||||
('external_mac',
|
||||
port['mac_address'])))
|
||||
for nat in nats:
|
||||
if action == ovn_const.FIP_ACTION_ASSOCIATE:
|
||||
# NOTE(mjozefcz): We should delete logical_port
|
||||
# and external_mac entries from member NAT in
|
||||
# order to make traffic work.
|
||||
LOG.warning(
|
||||
"Port %s is configured as a member "
|
||||
"of one of OVN Load_Balancers and "
|
||||
"Load_Balancer has FIP assigned. "
|
||||
"In order to make traffic work member "
|
||||
"FIP needs to be centralized, even if "
|
||||
"this environment is configured as "
|
||||
"DVR. Removing logical_port and "
|
||||
"external_mac from NAT entry.",
|
||||
lsp.name)
|
||||
commands.extend([
|
||||
self._nb_idl.db_clear(
|
||||
'NAT', nat.uuid, 'external_mac'),
|
||||
self._nb_idl.db_clear(
|
||||
'NAT', nat.uuid, 'logical_port')])
|
||||
else:
|
||||
# NOTE(mjozefcz): The FIP from LB VIP is
|
||||
# dissassociated now. We can decentralize
|
||||
# member FIPs now.
|
||||
LOG.warning(
|
||||
"Port %s is configured as a member "
|
||||
"of one of OVN Load_Balancers and "
|
||||
"Load_Balancer has FIP disassociated. "
|
||||
"DVR for this port can be enabled back.",
|
||||
lsp.name)
|
||||
commands.append(self._nb_idl.db_set(
|
||||
'NAT', nat.uuid,
|
||||
('logical_port', lsp.name)))
|
||||
port = self._plugin.get_port(context, lsp.name)
|
||||
if port['status'] == const.PORT_STATUS_ACTIVE:
|
||||
commands.append(
|
||||
self._nb_idl.db_set(
|
||||
'NAT', nat.uuid,
|
||||
('external_mac',
|
||||
port['mac_address'])))
|
||||
|
||||
return commands
|
||||
|
||||
|
||||
Reference in New Issue
Block a user