From cc7c9255ac0534fe0184f7ae64e09e29a57efefb Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Sat, 14 May 2022 09:41:25 +0000 Subject: [PATCH] [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 68bbd3586bdc313a6b67f2983ba2331a7956856c) --- neutron/services/trunk/drivers/ovn/trunk_driver.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/neutron/services/trunk/drivers/ovn/trunk_driver.py b/neutron/services/trunk/drivers/ovn/trunk_driver.py index 7be9e430180..a8a33223da0 100644 --- a/neutron/services/trunk/drivers/ovn/trunk_driver.py +++ b/neutron/services/trunk/drivers/ovn/trunk_driver.py @@ -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)