Merge ""_handle_lb_fip_cmds" to handle the LB members correctly" into stable/victoria
This commit is contained in:
commit
2364266fb4
@ -820,62 +820,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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user