[Trunk] Check if parent port belongs to OVN to activate

In Trunk service, the OVN was setting always the trunk to "ACTIVE"
anytime the trunk was created or updated. This patch changes this
behaviour: only when the trunk parent port belongs to OVN (that
means, there is a related logical switch port to this Neutron port),
the methods will set the trunk to "ACTIVE".

Closes-Bug: #1974183
Change-Id: Ied5ef53882d4249e0ceaa731239befdc3ba67d03
(cherry picked from commit 68bbd3586b)
This commit is contained in:
Rodolfo Alonso Hernandez 2022-05-14 09:41:25 +00:00
parent 218ec9ac84
commit cc7c9255ac
1 changed files with 12 additions and 0 deletions

View File

@ -136,6 +136,10 @@ class OVNTrunkHandler(object):
LOG.debug("Done unsetting parent for subport %s", subport.port_id)
def trunk_created(self, trunk):
# Check if parent port is handled by OVN.
if not self.plugin_driver.nb_ovn.lookup('Logical_Switch_Port',
trunk.port_id, default=None):
return
if trunk.sub_ports:
self._set_sub_ports(trunk.port_id, trunk.sub_ports)
trunk.update(status=trunk_consts.TRUNK_ACTIVE_STATUS)
@ -145,11 +149,19 @@ class OVNTrunkHandler(object):
self._unset_sub_ports(trunk.sub_ports)
def subports_added(self, trunk, subports):
# Check if parent port is handled by OVN.
if not self.plugin_driver.nb_ovn.lookup('Logical_Switch_Port',
trunk.port_id, default=None):
return
if subports:
self._set_sub_ports(trunk.port_id, subports)
trunk.update(status=trunk_consts.TRUNK_ACTIVE_STATUS)
def subports_deleted(self, trunk, subports):
# Check if parent port is handled by OVN.
if not self.plugin_driver.nb_ovn.lookup('Logical_Switch_Port',
trunk.port_id, default=None):
return
if subports:
self._unset_sub_ports(subports)
trunk.update(status=trunk_consts.TRUNK_ACTIVE_STATUS)