Merge "Add an option to get max sleep time from the config file"

This commit is contained in:
Jenkins 2016-02-01 15:41:11 +00:00 committed by Gerrit Code Review
commit 154362037e
3 changed files with 12 additions and 7 deletions

View File

@ -23,9 +23,16 @@ DRIVER_OPTS = [
default=['router', ],
help='list of drivers the rug process will load'),
]
cfg.CONF.register_opts(DRIVER_OPTS)
ASTARA_APP_OPTS = [
cfg.IntOpt('max_sleep', default=15,
help='The max sleep seconds between each attempt by'
' neutron client for fetching resource.'),
]
cfg.CONF.register_group(cfg.OptGroup(name='astara_appliance'))
cfg.CONF.register_opts(ASTARA_APP_OPTS, 'astara_appliance')
LOG = logging.getLogger(__name__)
AVAILABLE_DRIVERS = {

View File

@ -175,7 +175,6 @@ class LoadBalancer(BaseDriver):
"""
nap_time = 1
max_sleep = 15
neutron_client = neutron.Neutron(cfg.CONF)
@ -198,8 +197,8 @@ class LoadBalancer(BaseDriver):
LOG.warning(_LW(
'sleeping %s seconds before retrying'), nap_time)
time.sleep(nap_time)
# FIXME(rods): should we get max_sleep from the config file?
nap_time = min(nap_time * 2, max_sleep)
nap_time = min(nap_time * 2,
cfg.CONF.astara_appliance.max_sleep)
@staticmethod
def get_resource_id_for_tenant(worker_context, tenant_id, message):

View File

@ -223,7 +223,6 @@ class Router(BaseDriver):
"""
nap_time = 1
max_sleep = 15
neutron_client = neutron.Neutron(cfg.CONF)
@ -248,8 +247,8 @@ class Router(BaseDriver):
LOG.warning(_LW(
'sleeping %s seconds before retrying'), nap_time)
time.sleep(nap_time)
# FIXME(rods): should we get max_sleep from the config file?
nap_time = min(nap_time * 2, max_sleep)
nap_time = min(nap_time * 2,
cfg.CONF.astara_appliance.max_sleep)
@staticmethod
def get_resource_id_for_tenant(worker_context, tenant_id, message):