Преглед на файлове

Merge "Only set "unknown" in LSP that makes sense" into stable/rocky

tags/5.1.0
Zuul Gerrit Code Review преди 4 месеца
родител
ревизия
38b8985f6b
променени са 3 файла, в които са добавени 32 реда и са изтрити 19 реда
  1. +5
    -0
      networking_ovn/common/constants.py
  2. +14
    -8
      networking_ovn/common/maintenance.py
  3. +13
    -11
      networking_ovn/common/ovn_client.py

+ 5
- 0
networking_ovn/common/constants.py Целия файл

@@ -147,3 +147,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
- 8
networking_ovn/common/maintenance.py Целия файл

@@ -342,9 +342,6 @@ class DBInconsistenciesPeriodics(object):
self._ovn_client._l3_plugin.add_router_interface(
admin_context, router_id, {'port_id': port['id']}, may_exist=True)

# TODO(lucasagomes): Remove this in the T cycle
# A static spacing value is used here, but this method will only run
# once per lock due to the use of periodics.NeverAgain().
@periodics.periodic(spacing=600, run_immediately=True)
def check_for_port_security_unknown_address(self):

@@ -352,13 +349,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)


+ 13
- 11
networking_ovn/common/ovn_client.py Целия файл

@@ -204,7 +204,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 = []
@@ -227,20 +227,22 @@ class OVNClient(object):
addresses = [address]
addresses.extend(new_macs)

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")

# Only adjust the OVN type if the port is not owned by Neutron
# DHCP agents.
if (port['device_owner'] == const.DEVICE_OWNER_DHCP and
not port['device_id'].startswith('dhcp')):
port_type = 'localport'

# The "unknown" address should only be set for the normal LSP
# ports (the ones which type is empty)
if not port_security and not port_type:
# 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(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)

@@ -1349,9 +1351,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…
Отказ
Запис