diff options
author | liu-sheng <liusheng@huawei.com> | 2015-08-05 10:48:40 +0800 |
---|---|---|
committer | LiuSheng <liusheng@huawei.com> | 2015-08-12 20:31:51 +0800 |
commit | 717bd7d0642bc6b7c1b0aa83df148251148a4d46 (patch) | |
tree | efec55313e842fe3c000366c2d8ec4f477af9206 /ceilometer/service.py | |
parent | 5edd2b4825ccac75ea22e9627c74d59a70c0f036 (diff) | |
download | ceilometer-717bd7d0642bc6b7c1b0aa83df148251148a4d46.tar.gz |
Change and move the workers options to corresponding service section
Currently, the workers options of collector, api and notification services
are all located in [DEFAULT] section. This change unify the options name
and move them to corresponding service configure section.
Additionally, this change will remove the "workers set by cpu number"
functionality, because it has no effect if the workers options has default
value.
Closes-Bug: #1481254
Change-Id: Idde86762ab6520d3adcbdd2b86d0f4de3a8517cd
Diffstat (limited to 'ceilometer/service.py')
-rw-r--r-- | ceilometer/service.py | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/ceilometer/service.py b/ceilometer/service.py index 99eb4e3f..19cd7555 100644 --- a/ceilometer/service.py +++ b/ceilometer/service.py @@ -22,9 +22,7 @@ from oslo_config import cfg import oslo_i18n from oslo_log import log -from ceilometer.i18n import _ from ceilometer import messaging -from ceilometer import utils OPTS = [ @@ -33,14 +31,6 @@ OPTS = [ help='Name of this node, which must be valid in an AMQP ' 'key. Can be an opaque identifier. For ZeroMQ only, must ' 'be a valid host name, FQDN, or IP address.'), - cfg.IntOpt('collector_workers', - default=1, - help='Number of workers for collector service. A single ' - 'collector is enabled by default.'), - cfg.IntOpt('notification_workers', - default=1, - help='Number of workers for notification service. A single ' - 'notification agent is enabled by default.'), cfg.IntOpt('http_timeout', default=600, help='Timeout seconds for HTTP requests. Set it to None to ' @@ -87,24 +77,37 @@ CLI_OPTS = [ help='Disables X.509 certificate validation when an ' 'SSL connection to Identity Service is established.'), ] + cfg.CONF.register_cli_opts(CLI_OPTS, group="service_credentials") -LOG = log.getLogger(__name__) +API_OPT = cfg.IntOpt('workers', + default=1, + min=1, + deprecated_group='DEFAULT', + deprecated_name='api_workers', + help='Number of workers for api, default value is 1.') +cfg.CONF.register_opt(API_OPT, 'api') +NOTI_OPT = cfg.IntOpt('workers', + default=1, + min=1, + deprecated_group='DEFAULT', + deprecated_name='notification_workers', + help='Number of workers for notification service, ' + 'default value is 1.') +cfg.CONF.register_opt(NOTI_OPT, 'notification') -class WorkerException(Exception): - """Exception for errors relating to service workers.""" +COLL_OPT = cfg.IntOpt('workers', + default=1, + min=1, + deprecated_group='DEFAULT', + deprecated_name='collector_workers', + help='Number of workers for collector service. ' + 'default value is 1.') +cfg.CONF.register_opt(COLL_OPT, 'collector') -def get_workers(name): - workers = (cfg.CONF.get('%s_workers' % name) or - utils.cpu_count()) - if workers and workers < 1: - msg = (_("%(worker_name)s value of %(workers)s is invalid, " - "must be greater than 0") % - {'worker_name': '%s_workers' % name, 'workers': str(workers)}) - raise WorkerException(msg) - return workers +LOG = log.getLogger(__name__) def prepare_service(argv=None): |