Merge "Ensure only the right events are processed"
This commit is contained in:
commit
191eb7145b
@ -392,11 +392,13 @@ class PortBindingCreateUpEvent(row_event.RowEvent):
|
|||||||
self.event_name = 'PortBindingCreateUpEvent'
|
self.event_name = 'PortBindingCreateUpEvent'
|
||||||
|
|
||||||
def match_fn(self, event, row, old):
|
def match_fn(self, event, row, old):
|
||||||
if row.type == ovn_const.PB_TYPE_VIRTUAL:
|
if row.type in (ovn_const.PB_TYPE_VIRTUAL,
|
||||||
# NOTE(ltomasbo): Skipping as virtual ports are not being set to
|
ovn_const.OVN_CHASSIS_REDIRECT):
|
||||||
# ACTIVE
|
# NOTE(ltomasbo): Skipping virtual ports as they are not being
|
||||||
|
# set to ACTIVE
|
||||||
|
# NOTE(ltomasbo): No need to handle cr ports
|
||||||
return False
|
return False
|
||||||
elif row.type == ovn_const.PB_TYPE_PATCH:
|
if row.type == ovn_const.PB_TYPE_PATCH:
|
||||||
# NOTE(ltomasbo): Only handle the logical_switch_port side,
|
# NOTE(ltomasbo): Only handle the logical_switch_port side,
|
||||||
# not the router side.
|
# not the router side.
|
||||||
if (row.logical_port.startswith('lrp-') or
|
if (row.logical_port.startswith('lrp-') or
|
||||||
@ -434,10 +436,12 @@ class PortBindingCreateDownEvent(row_event.RowEvent):
|
|||||||
self.event_name = 'PortBindingCreateDownEvent'
|
self.event_name = 'PortBindingCreateDownEvent'
|
||||||
|
|
||||||
def match_fn(self, event, row, old):
|
def match_fn(self, event, row, old):
|
||||||
if row.type in [ovn_const.PB_TYPE_VIRTUAL, ovn_const.PB_TYPE_PATCH]:
|
if row.type in [ovn_const.PB_TYPE_VIRTUAL, ovn_const.PB_TYPE_PATCH,
|
||||||
|
ovn_const.OVN_CHASSIS_REDIRECT]:
|
||||||
# NOTE(ltomasbo): Skipping as virtual ports are not being set to
|
# NOTE(ltomasbo): Skipping as virtual ports are not being set to
|
||||||
# ACTIVE
|
# ACTIVE
|
||||||
# Patch ports are set to UP on creation, no need to update
|
# Patch ports are set to UP on creation, no need to update
|
||||||
|
# No need to handle cr ports
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# TODO(ltomasbo): Remove the checkings for 'up' column once minimal
|
# TODO(ltomasbo): Remove the checkings for 'up' column once minimal
|
||||||
@ -472,17 +476,27 @@ class PortBindingUpdateUpEvent(row_event.RowEvent):
|
|||||||
self.event_name = 'PortBindingUpdateUpEvent'
|
self.event_name = 'PortBindingUpdateUpEvent'
|
||||||
|
|
||||||
def match_fn(self, event, row, old):
|
def match_fn(self, event, row, old):
|
||||||
if row.type == ovn_const.PB_TYPE_VIRTUAL:
|
if row.type in (ovn_const.PB_TYPE_VIRTUAL,
|
||||||
# NOTE(ltomasbo): Skipping as virtual ports are not being set to
|
ovn_const.OVN_CHASSIS_REDIRECT):
|
||||||
# ACTIVE
|
# NOTE(ltomasbo): Skipping virtual ports as they are not being
|
||||||
|
# set to ACTIVE
|
||||||
|
# NOTE(ltomasbo): No need to handle cr ports
|
||||||
return False
|
return False
|
||||||
elif row.type == ovn_const.PB_TYPE_PATCH:
|
if row.type == ovn_const.PB_TYPE_PATCH:
|
||||||
# NOTE(ltomasbo): Only handle the logical_switch_port side,
|
# NOTE(ltomasbo): Only handle the logical_switch_port side,
|
||||||
# not the router side.
|
# not the router side.
|
||||||
if (row.logical_port.startswith('lrp-') or
|
if (row.logical_port.startswith('lrp-') or
|
||||||
row.logical_port.startswith('cr-lrp')):
|
row.logical_port.startswith('cr-lrp')):
|
||||||
return False
|
return False
|
||||||
return True
|
try:
|
||||||
|
if old.mac:
|
||||||
|
# NOTE(ltomasbo): only execute it once (the first update
|
||||||
|
# event for this port), as you don't need to set it to
|
||||||
|
# active several time
|
||||||
|
return True
|
||||||
|
except AttributeError:
|
||||||
|
return False
|
||||||
|
return False
|
||||||
# TODO(ltomasbo): Remove the checkings for 'up' column once minimal
|
# TODO(ltomasbo): Remove the checkings for 'up' column once minimal
|
||||||
# ovn version has it (v21.03.0). The match_fn can be then replaced
|
# ovn version has it (v21.03.0). The match_fn can be then replaced
|
||||||
# by different init method above:
|
# by different init method above:
|
||||||
@ -521,10 +535,13 @@ class PortBindingUpdateDownEvent(row_event.RowEvent):
|
|||||||
self.event_name = 'PortBindingUpdateDownEvent'
|
self.event_name = 'PortBindingUpdateDownEvent'
|
||||||
|
|
||||||
def match_fn(self, event, row, old):
|
def match_fn(self, event, row, old):
|
||||||
if row.type in [ovn_const.PB_TYPE_VIRTUAL, ovn_const.PB_TYPE_PATCH]:
|
if row.type in [ovn_const.PB_TYPE_VIRTUAL, ovn_const.PB_TYPE_PATCH,
|
||||||
|
ovn_const.OVN_CHASSIS_REDIRECT]:
|
||||||
# NOTE(ltomasbo): Skipping as virtual ports are not being set to
|
# NOTE(ltomasbo): Skipping as virtual ports are not being set to
|
||||||
# ACTIVE
|
# ACTIVE
|
||||||
# Patch ports are set to UP on creation, no need to update
|
# Patch ports are meant to be always UP, after creation, no need
|
||||||
|
# to update
|
||||||
|
# No need to handle cr ports
|
||||||
return False
|
return False
|
||||||
# TODO(ltomasbo): Remove the checkings for 'up' column once minimal
|
# TODO(ltomasbo): Remove the checkings for 'up' column once minimal
|
||||||
# ovn version has it (v21.03.0). The match_fn can be then replaced
|
# ovn version has it (v21.03.0). The match_fn can be then replaced
|
||||||
|
Loading…
Reference in New Issue
Block a user