@@ -172,12 +172,21 @@ def handle_ha_chassis_group_changes(self, event, row, old):
172
172
def match_fn (self , event , row , old ):
173
173
if event != self .ROW_UPDATE :
174
174
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 :
178
184
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 :
181
190
return True
182
191
# Check if either the Gateway status or Availability Zones has
183
192
# changed in the Chassis
@@ -192,8 +201,9 @@ def match_fn(self, event, row, old):
192
201
def run (self , event , row , old ):
193
202
host = row .hostname
194
203
phy_nets = []
204
+ new_other_config = utils .get_ovn_chassis_other_config (row )
195
205
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' , '' )
197
207
mapping_dict = helpers .parse_mappings (bridge_mappings .split (',' ))
198
208
phy_nets = list (mapping_dict )
199
209
@@ -208,9 +218,10 @@ def run(self, event, row, old):
208
218
if event == self .ROW_DELETE :
209
219
kwargs ['event_from_chassis' ] = row .name
210
220
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' ,
212
223
set ()) or set ()
213
- new_mappings = row . external_ids .get ('ovn-bridge-mappings' ,
224
+ new_mappings = new_other_config .get ('ovn-bridge-mappings' ,
214
225
set ()) or set ()
215
226
if old_mappings :
216
227
old_mappings = set (old_mappings .split (',' ))
@@ -339,11 +350,17 @@ class ChassisAgentTypeChangeEvent(ChassisEvent):
339
350
events = (BaseEvent .ROW_UPDATE ,)
340
351
341
352
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 ):
343
358
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' , []))
347
364
return agent_type_change
348
365
349
366
def run (self , event , row , old ):
0 commit comments