[OVN] Remove SG dependency on original port dict
The 'port_object' needs to be removed, so the current security group dependency on it needs to be resolved first. The 'security_group_ids' has been stored in the 'external_ids' of the logical switch port. When updating or deleting a port, the security groups can be obtained directly from 'ovn_port'. Change-Id: I764f3426fe0e38094b77b69f4cb752d042f4d701 Partial-Bug: #1863987
This commit is contained in:
parent
6b9765c991
commit
2581778264
|
@ -420,17 +420,6 @@ class OVNClient(object):
|
|||
|
||||
db_rev.bump_revision(admin_context, port, ovn_const.TYPE_PORTS)
|
||||
|
||||
# TODO(lucasagomes): Remove this helper method in the Rocky release
|
||||
def _get_lsp_backward_compat_sgs(self, ovn_port, port_object=None,
|
||||
skip_trusted_port=True):
|
||||
if ovn_const.OVN_SG_IDS_EXT_ID_KEY in ovn_port.external_ids:
|
||||
return utils.get_ovn_port_security_groups(
|
||||
ovn_port, skip_trusted_port=skip_trusted_port)
|
||||
elif port_object is not None:
|
||||
return utils.get_lsp_security_groups(
|
||||
port_object, skip_trusted_port=skip_trusted_port)
|
||||
return []
|
||||
|
||||
def _set_unset_virtual_port_type(self, context, txn, parent_port,
|
||||
addresses, unset=False):
|
||||
cmd = self._nb_idl.set_lswitch_port_to_virtual_type
|
||||
|
@ -546,8 +535,7 @@ class OVNClient(object):
|
|||
**columns_dict))
|
||||
|
||||
# Determine if security groups or fixed IPs are updated.
|
||||
old_sg_ids = set(self._get_lsp_backward_compat_sgs(
|
||||
ovn_port, port_object=port_object))
|
||||
old_sg_ids = set(utils.get_ovn_port_security_groups(ovn_port))
|
||||
new_sg_ids = set(utils.get_lsp_security_groups(port))
|
||||
detached_sg_ids = old_sg_ids - new_sg_ids
|
||||
attached_sg_ids = new_sg_ids - old_sg_ids
|
||||
|
@ -747,8 +735,8 @@ class OVNClient(object):
|
|||
|
||||
addresses = utils.sort_ips_by_version(
|
||||
utils.get_ovn_port_addresses(ovn_port))
|
||||
sec_groups = self._get_lsp_backward_compat_sgs(
|
||||
ovn_port, port_object=port_object, skip_trusted_port=False)
|
||||
sec_groups = utils.get_ovn_port_security_groups(
|
||||
ovn_port, skip_trusted_port=False)
|
||||
for sg_id in sec_groups:
|
||||
for ip_version, addr_list in addresses.items():
|
||||
if not addr_list:
|
||||
|
|
Loading…
Reference in New Issue