diff --git a/ceilometer_contexts.py b/ceilometer_contexts.py index 1cf8a0a..72aea39 100644 --- a/ceilometer_contexts.py +++ b/ceilometer_contexts.py @@ -78,6 +78,7 @@ class CeilometerContext(OSContextGenerator): from ceilometer_utils import get_shared_secret ctxt = { + 'api_workers': config('api-workers'), 'port': CEILOMETER_PORT, 'metering_secret': get_shared_secret() } diff --git a/config.yaml b/config.yaml index 7759f85..e8197f2 100644 --- a/config.yaml +++ b/config.yaml @@ -146,3 +146,8 @@ options: description: | Default multicast port number that will be used to communicate between HA Cluster nodes. + api-workers: + type: int + default: 1 + description: | + Number of workers for Ceilometer API server. (>= Kilo). diff --git a/templates/kilo/ceilometer.conf b/templates/kilo/ceilometer.conf new file mode 100644 index 0000000..da44948 --- /dev/null +++ b/templates/kilo/ceilometer.conf @@ -0,0 +1,43 @@ +# kilo +############################################################################### +# [ WARNING ] +# ceilometer configuration file maintained by Juju +# local changes may be overwritten. +############################################################################### +[DEFAULT] +debug = {{ debug }} +verbose = {{ verbose }} +use_syslog = {{ use_syslog }} +api_workers = {{ api_workers }} + +{% include "parts/rabbitmq" -%} + +[api] +port = {{ port }} + +[service_credentials] +os_auth_url = {{ service_protocol }}://{{ service_host }}:{{ service_port }}/v2.0 +os_tenant_name = {{ admin_tenant_name }} +os_username = {{ admin_user }} +os_password = {{ admin_password }} + +[database] +{% if db_replset: -%} +connection = mongodb://{{ db_mongo_servers }}/{{ db_name }}?readPreference=primaryPreferred&replicaSet={{ db_replset }} +mongodb_replica_set = {{ db_replset }} +{% else -%} +connection = mongodb://{{ db_host }}:{{ db_port }}/{{ db_name }} +{% endif %} + +[publisher_rpc] +metering_secret = {{ metering_secret }} + +[keystone_authtoken] +auth_uri = {{ service_protocol }}://{{ service_host }}:{{ service_port }}/ +auth_host = {{ auth_host }} +auth_port = {{ auth_port }} +auth_protocol = {{ auth_protocol }} +admin_tenant_name = {{ admin_tenant_name }} +admin_user = {{ admin_user }} +admin_password = {{ admin_password }} +signing_dir = {{ signing_dir }} diff --git a/unit_tests/test_ceilometer_contexts.py b/unit_tests/test_ceilometer_contexts.py index 5d63575..038dfd0 100644 --- a/unit_tests/test_ceilometer_contexts.py +++ b/unit_tests/test_ceilometer_contexts.py @@ -111,8 +111,11 @@ class CeilometerContextsTest(CharmTestCase): @patch.object(utils, 'get_shared_secret') def test_ceilometer_context(self, secret): secret.return_value = 'mysecret' - self.assertEquals(contexts.CeilometerContext()(), - {'port': 8777, 'metering_secret': 'mysecret'}) + self.assertEquals(contexts.CeilometerContext()(), { + 'port': 8777, + 'metering_secret': 'mysecret', + 'api_workers': 1, + }) def test_ceilometer_service_context(self): self.relation_ids.return_value = ['ceilometer-service:0']