@@ -172,12 +172,21 @@ def handle_ha_chassis_group_changes(self, event, row, old):
172172 def match_fn (self , event , row , old ):
173173 if event != self .ROW_UPDATE :
174174 return True
175- # NOTE(lucasgomes): If the external_ids column wasn't updated
176- # (meaning, Chassis "gateway" status didn't change) just returns
177- if not hasattr (old , 'external_ids' ) and event == self .ROW_UPDATE :
175+
176+ # NOTE(ralonsoh): LP#1990229 to be removed when min OVN version is
177+ # 22.09
178+ other_config = ('other_config' if hasattr (row , 'other_config' ) else
179+ 'external_ids' )
180+ # NOTE(lucasgomes): If the other_config/external_ids column wasn't
181+ # updated (meaning, Chassis "gateway" status didn't change) just
182+ # returns
183+ if not hasattr (old , other_config ) and event == self .ROW_UPDATE :
178184 return False
179- if (old .external_ids .get ('ovn-bridge-mappings' ) !=
180- row .external_ids .get ('ovn-bridge-mappings' )):
185+ old_br_mappings = utils .get_ovn_chassis_other_config (old ).get (
186+ 'ovn-bridge-mappings' )
187+ new_br_mappings = utils .get_ovn_chassis_other_config (row ).get (
188+ 'ovn-bridge-mappings' )
189+ if old_br_mappings != new_br_mappings :
181190 return True
182191 # Check if either the Gateway status or Availability Zones has
183192 # changed in the Chassis
@@ -192,8 +201,9 @@ def match_fn(self, event, row, old):
192201 def run (self , event , row , old ):
193202 host = row .hostname
194203 phy_nets = []
204+ new_other_config = utils .get_ovn_chassis_other_config (row )
195205 if event != self .ROW_DELETE :
196- bridge_mappings = row . external_ids .get ('ovn-bridge-mappings' , '' )
206+ bridge_mappings = new_other_config .get ('ovn-bridge-mappings' , '' )
197207 mapping_dict = helpers .parse_mappings (bridge_mappings .split (',' ))
198208 phy_nets = list (mapping_dict )
199209
@@ -208,9 +218,10 @@ def run(self, event, row, old):
208218 if event == self .ROW_DELETE :
209219 kwargs ['event_from_chassis' ] = row .name
210220 elif event == self .ROW_UPDATE :
211- old_mappings = old .external_ids .get ('ovn-bridge-mappings' ,
221+ old_other_config = utils .get_ovn_chassis_other_config (old )
222+ old_mappings = old_other_config .get ('ovn-bridge-mappings' ,
212223 set ()) or set ()
213- new_mappings = row . external_ids .get ('ovn-bridge-mappings' ,
224+ new_mappings = new_other_config .get ('ovn-bridge-mappings' ,
214225 set ()) or set ()
215226 if old_mappings :
216227 old_mappings = set (old_mappings .split (',' ))
@@ -339,11 +350,17 @@ class ChassisAgentTypeChangeEvent(ChassisEvent):
339350 events = (BaseEvent .ROW_UPDATE ,)
340351
341352 def match_fn (self , event , row , old = None ):
342- if not getattr (old , 'external_ids' , False ):
353+ # NOTE(ralonsoh): LP#1990229 to be removed when min OVN version is
354+ # 22.09
355+ other_config = ('other_config' if hasattr (row , 'other_config' ) else
356+ 'external_ids' )
357+ if not getattr (old , other_config , False ):
343358 return False
344- agent_type_change = n_agent .NeutronAgent .chassis_from_private (
345- row ).external_ids .get ('ovn-cms-options' , []) != (
346- old .external_ids .get ('ovn-cms-options' , []))
359+ chassis = n_agent .NeutronAgent .chassis_from_private (row )
360+ new_other_config = utils .get_ovn_chassis_other_config (chassis )
361+ old_other_config = utils .get_ovn_chassis_other_config (old )
362+ agent_type_change = new_other_config .get ('ovn-cms-options' , []) != (
363+ old_other_config .get ('ovn-cms-options' , []))
347364 return agent_type_change
348365
349366 def run (self , event , row , old ):
0 commit comments