From ada3961cf3522f6c713125495ecda47d14b6e3f1 Mon Sep 17 00:00:00 2001 From: jxie Date: Mon, 19 Nov 2018 15:36:41 +0800 Subject: [PATCH] make update_operating_status_interval configurable the original setting is per 30 seconds. This still keep it as the default value, but make it configurable so that customers like CMCC can configure the interval according to their own deployment(e.g. in case of heavy pressure). --- .../lbaasv2/drivers/bigip/agent_manager.py | 15 +++++++++++++-- .../lbaasv2/drivers/bigip/constants_v2.py | 2 -- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/f5_openstack_agent/lbaasv2/drivers/bigip/agent_manager.py b/f5_openstack_agent/lbaasv2/drivers/bigip/agent_manager.py index 5af3a58ec..89d400770 100644 --- a/f5_openstack_agent/lbaasv2/drivers/bigip/agent_manager.py +++ b/f5_openstack_agent/lbaasv2/drivers/bigip/agent_manager.py @@ -47,6 +47,11 @@ default=10, help='Seconds between periodic task runs' ), + cfg.IntOpt( + 'update_operating_status_interval', + default=30, + help='Seconds between update_operating_status task runs' + ), cfg.BoolOpt( 'start_agent_admin_state_up', default=True, @@ -133,6 +138,7 @@ ] PERIODIC_TASK_INTERVAL = 10 +UPDATE_OPERATING_STATUS_INTERVAL = 30 class LogicalServiceCache(object): @@ -239,6 +245,10 @@ def __init__(self, conf): global PERIODIC_TASK_INTERVAL PERIODIC_TASK_INTERVAL = self.conf.periodic_interval + global UPDATE_OPERATING_STATUS_INTERVAL + UPDATE_OPERATING_STATUS_INTERVAL = \ + self.conf.update_operating_status_interval + # Create the cache of provisioned services self.cache = LogicalServiceCache() self.last_resync = datetime.datetime.now() @@ -497,7 +507,7 @@ def recover_errored_devices(self, context): self.lbdriver.recover_errored_devices() @periodic_task.periodic_task( - spacing=constants_v2.UPDATE_OPERATING_STATUS_INTERVAL) + spacing=UPDATE_OPERATING_STATUS_INTERVAL) def scrub_dead_agents_in_env_and_group(self, context): """Triggering a dead agent scrub on the controller.""" LOG.debug("running periodic scrub_dead_agents_in_env_and_group") @@ -508,9 +518,10 @@ def scrub_dead_agents_in_env_and_group(self, context): self.conf.environment_group_number) @periodic_task.periodic_task( - spacing=constants_v2.UPDATE_OPERATING_STATUS_INTERVAL) + spacing=UPDATE_OPERATING_STATUS_INTERVAL) def update_operating_status(self, context): """Update pool member operational status from devices to controller.""" + LOG.debug('running update_operating_status:') if not self.plugin_rpc: return diff --git a/f5_openstack_agent/lbaasv2/drivers/bigip/constants_v2.py b/f5_openstack_agent/lbaasv2/drivers/bigip/constants_v2.py index ca35d51ca..ae9a3d009 100644 --- a/f5_openstack_agent/lbaasv2/drivers/bigip/constants_v2.py +++ b/f5_openstack_agent/lbaasv2/drivers/bigip/constants_v2.py @@ -16,8 +16,6 @@ # Service resync interval RESYNC_INTERVAL = 300 -UPDATE_OPERATING_STATUS_INTERVAL = 30 - # Topic for tunnel notifications between the plugin and agent TUNNEL = 'tunnel'