Browse Source

Only set "unknown" in LSP that makes sense

Prior to this patch, the "unknown" address was being set the logical
switch ports solely based on whether the port security was enabled or
disabled. That's not how it's intended to work.

With this patch the "unknown" address is only set to the normal logical
switch ports, those which types are "router", "localnet" or "localport"
won't be affected.

The maintenance task was updated to correct this behavior for existing
ports (the maintenance was suppose to be removed in the T cycle, this
patch bumps it to U cycle instead due to this change).

Closes-Bug: #1838535
Related-Bug: #1815270

Conflicts:
   networking_ovn/common/ovn_client.py
   networking_ovn/common/constants.py

Change-Id: I3c01bd7d1685c8a7e13a55e545e98baf19e9a0f9
Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
(cherry picked from commit 6a89dbfe47)
changes/61/699661/5
Lucas Alvares Gomes 6 months ago
parent
commit
63ff1f433a
3 changed files with 25 additions and 9 deletions
  1. +5
    -0
      networking_ovn/common/constants.py
  2. +14
    -5
      networking_ovn/common/maintenance.py
  3. +6
    -4
      networking_ovn/common/ovn_client.py

+ 5
- 0
networking_ovn/common/constants.py View File

@@ -138,3 +138,8 @@ DEFAULT_ADDR_FOR_LSP_WITH_PEER = 'router'

# Maximum chassis count where a gateway port can be hosted
MAX_GW_CHASSIS = 5

UNKNOWN_ADDR = 'unknown'

# TODO(lucasagomes): Create constants for other LSP types
LSP_TYPE_LOCALNET = 'localnet'

+ 14
- 5
networking_ovn/common/maintenance.py View File

@@ -340,13 +340,22 @@ class DBInconsistenciesPeriodics(object):
return

for port in self._nb_idl.lsp_list().execute(check_error=True):

if port.type == ovn_const.LSP_TYPE_LOCALNET:
continue

addresses = port.addresses
if not port.port_security and 'unknown' not in addresses:
addresses.append('unknown')
elif port.port_security and 'unknown' in addresses:
addresses.remove('unknown')
type_ = port.type.strip()
if not port.port_security:
if not type_ and ovn_const.UNKNOWN_ADDR not in addresses:
addresses.append(ovn_const.UNKNOWN_ADDR)
elif type_ and ovn_const.UNKNOWN_ADDR in addresses:
addresses.remove(ovn_const.UNKNOWN_ADDR)
else:
continue
if type_ and ovn_const.UNKNOWN_ADDR in addresses:
addresses.remove(ovn_const.UNKNOWN_ADDR)
elif not type_ and ovn_const.UNKNOWN_ADDR in addresses:
addresses.remove(ovn_const.UNKNOWN_ADDR)

self._nb_idl.lsp_set_addresses(
port.name, addresses=addresses).execute(check_error=True)

+ 6
- 4
networking_ovn/common/ovn_client.py View File

@@ -203,7 +203,7 @@ class OVNClient(object):
port_type = 'vtep'
options = {'vtep-physical-switch': vtep_physical_switch,
'vtep-logical-switch': vtep_logical_switch}
addresses = ["unknown"]
addresses = [ovn_const.UNKNOWN_ADDR]
parent_name = []
tag = []
port_security = []
@@ -225,13 +225,15 @@ class OVNClient(object):
port_type = ovn_const.OVN_NEUTRON_OWNER_TO_PORT_TYPE.get(
port['device_owner'], '')

# The "unknown" address should only be set for the normal LSP
# ports (the ones which type is empty)
if not port_security:
# Port security is disabled for this port.
# So this port can send traffic with any mac address.
# OVN allows any mac address from a port if "unknown"
# is added to the Logical_Switch_Port.addresses column.
# So add it.
addresses.append("unknown")
addresses.append(ovn_const.UNKNOWN_ADDR)

dhcpv4_options = self._get_port_dhcp_options(port, const.IP_VERSION_4)
dhcpv6_options = self._get_port_dhcp_options(port, const.IP_VERSION_6)
@@ -1340,9 +1342,9 @@ class OVNClient(object):
txn.add(self._nb_idl.create_lswitch_port(
lport_name=utils.ovn_provnet_port_name(network['id']),
lswitch_name=utils.ovn_name(network['id']),
addresses=['unknown'],
addresses=[ovn_const.UNKNOWN_ADDR],
external_ids={},
type='localnet',
type=ovn_const.LSP_TYPE_LOCALNET,
tag=tag if tag else [],
options={'network_name': physnet}))


Loading…
Cancel
Save