Use has_lock_periodic decorator for the tasks which require ovn db lock
This is follow up patch for the [1] which introduced this new decorator. [1] https://review.opendev.org/c/openstack/neutron/+/896544 Change-Id: I2de3b5d7ba5783dd82acacda89ab4b64c2d29149 (cherry picked from commit 2a6bc5db237d28ddfdda16aea7c1b3416f3e14a4)
This commit is contained in:
parent
22b502da1a
commit
59bda697ad
@ -537,16 +537,13 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
|
||||
|
||||
# A static spacing value is used here, but this method will only run
|
||||
# once per lock due to the use of periodics.NeverAgain().
|
||||
@periodics.periodic(spacing=600, run_immediately=True)
|
||||
@has_lock_periodic(spacing=600, run_immediately=True)
|
||||
def check_for_ha_chassis_group(self):
|
||||
# If external ports is not supported stop running
|
||||
# this periodic task
|
||||
if not self._ovn_client.is_external_ports_supported():
|
||||
raise periodics.NeverAgain()
|
||||
|
||||
if not self.has_lock:
|
||||
return
|
||||
|
||||
external_ports = self._nb_idl.db_find_rows(
|
||||
'Logical_Switch_Port', ('type', '=', ovn_const.LSP_TYPE_EXTERNAL)
|
||||
).execute(check_error=True)
|
||||
@ -822,7 +819,7 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
|
||||
|
||||
# A static spacing value is used here, but this method will only run
|
||||
# once per lock due to the use of periodics.NeverAgain().
|
||||
@periodics.periodic(spacing=600, run_immediately=True)
|
||||
@has_lock_periodic(spacing=600, run_immediately=True)
|
||||
def check_baremetal_ports_dhcp_options(self):
|
||||
"""Update baremetal ports DHCP options
|
||||
|
||||
@ -834,9 +831,6 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
|
||||
if not self._ovn_client.is_external_ports_supported():
|
||||
raise periodics.NeverAgain()
|
||||
|
||||
if not self.has_lock:
|
||||
return
|
||||
|
||||
context = n_context.get_admin_context()
|
||||
ports = ports_obj.Port.get_ports_by_vnic_type_and_host(
|
||||
context, portbindings.VNIC_BAREMETAL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user