Don't run periodic actions for StaticScheduler

We want bindings to be fully static when using the StaticScheduler, so
do not run the periodic actions in that scenario.

Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Change-Id: I2d874ce7170cdf3d81940dbe64960247b244fe87
This commit is contained in:
Dr. Jens Harbott 2022-08-02 08:36:32 +02:00
parent 012f2358d2
commit acfcd04dd4
2 changed files with 9 additions and 4 deletions

View File

@ -69,6 +69,7 @@ class BgpDrAgentSchedulerDbMixin(bgp_dras_ext.BgpDrSchedulerPluginBase,
def add_periodic_dragent_status_check(self):
if self.bgp_drscheduler:
if self.bgp_drscheduler.periodic_actions:
self.add_agent_status_check_worker(
self.remove_bgp_speaker_from_down_dragents)
self.add_agent_status_check_worker(

View File

@ -128,6 +128,8 @@ class BgpDrAgentFilter(base_resource_filter.BaseResourceFilter):
class BgpDrAgentSchedulerBase(BgpDrAgentFilter):
periodic_actions = True
def _register_callbacks(self):
registry.subscribe(self.schedule_bgp_speaker_callback,
dr_resources.BGP_SPEAKER,
@ -223,6 +225,8 @@ class WeightScheduler(base_scheduler.BaseWeightScheduler,
class StaticScheduler(base_scheduler.BaseScheduler,
BgpDrAgentFilter):
periodic_actions = False
def schedule_all_unscheduled_bgp_speakers(self, context):
return True