Remove buggy usage of global config

Reading cfg.CONF values during module load time, just doesn't works
because the configuration have not been read yet, this just hardcode
the default value of the options.

This change hardcode to default until it's possible to really fix the
issue (ie: no more global config).

Change-Id: I6bc6790879078faa0d62359375e42ae759730344
This commit is contained in:
Mehdi Abaakouk 2016-10-10 23:07:27 +02:00
parent bb72ae78e2
commit 8150391514
2 changed files with 13 additions and 6 deletions

View File

@ -19,12 +19,16 @@ import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer import sample
# NOTE(sileht): reading config values at loadtime won't works
# we should use set_defaults at runtime to set http_control_exchanges to
# [cfg.CONF.nova_control_exchange,
# cfg.CONF.glance_control_exchange,
# cfg.CONF.neutron_control_exchange,
# cfg.CONF.cinder_control_exchange],
OPTS = [
cfg.MultiStrOpt('http_control_exchanges',
default=[cfg.CONF.nova_control_exchange,
cfg.CONF.glance_control_exchange,
cfg.CONF.neutron_control_exchange,
cfg.CONF.cinder_control_exchange],
default=['nova', 'glance', 'neutron', 'cinder'],
help="Exchanges name to listen for notifications."),
]

View File

@ -338,8 +338,11 @@ class Connection(base.Connection):
return internal_id
@api.wrap_db_retry(retry_interval=cfg.CONF.database.retry_interval,
max_retries=cfg.CONF.database.max_retries,
# FIXME(sileht): use set_defaults to pass cfg.CONF.database.retry_interval
# and cfg.CONF.database.max_retries to this method when global config
# have been removed (puting directly cfg.CONF don't work because and copy
# the default instead of the configured value)
@api.wrap_db_retry(retry_interval=10, max_retries=10,
retry_on_deadlock=True)
def record_metering_data(self, data):
"""Write the data to the backend storage system.