From fbed3f3d7a9c2a0804c7c0ae862779b2144af8f4 Mon Sep 17 00:00:00 2001 From: Edward Hope-Morley Date: Fri, 11 Aug 2017 18:20:13 +0100 Subject: [PATCH] Support configurable metadata_workers Adds config option worker-multiplier to allow configuring the number of workers used for the metadata api when using local dhcp. Change-Id: Ie3a7d6aab0d9902a6637637fbf75b2df3ec084b1 Closes-Bug: 1707618 --- config.yaml | 9 +++++++++ hooks/neutron_ovs_utils.py | 4 +++- templates/icehouse/metadata_agent.ini | 1 + templates/juno/metadata_agent.ini | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/config.yaml b/config.yaml index 9f782ea4..5afc2490 100644 --- a/config.yaml +++ b/config.yaml @@ -207,6 +207,15 @@ options: . Multiple devices can be configured by providing multi values delimited by spaces. + worker-multiplier: + type: float + default: + description: | + The CPU core multiplier to use when configuring worker processes for + this services e.g. metadata-agent. By default, the number of workers for + each daemon is set to twice the number of CPU cores a service unit has. + When deployed in a LXD container, this default value will be capped to 4 + workers unless this configuration option is set. # Network config (by default all access is over 'private-address') os-data-network: type: string diff --git a/hooks/neutron_ovs_utils.py b/hooks/neutron_ovs_utils.py index 90aca73a..0fece95b 100644 --- a/hooks/neutron_ovs_utils.py +++ b/hooks/neutron_ovs_utils.py @@ -62,6 +62,7 @@ from charmhelpers.contrib.openstack.neutron import ( from charmhelpers.contrib.openstack.context import ( ExternalPortContext, DataPortContext, + WorkerConfigContext, ) from charmhelpers.core.host import ( adduser, @@ -184,7 +185,8 @@ METADATA_RESOURCE_MAP = OrderedDict([ (NEUTRON_METADATA_AGENT_CONF, { 'services': ['neutron-metadata-agent'], 'contexts': [neutron_ovs_context.SharedSecretContext(), - neutron_ovs_context.APIIdentityServiceContext()], + neutron_ovs_context.APIIdentityServiceContext(), + WorkerConfigContext()], }), ]) DHCP_RESOURCE_MAP = OrderedDict([ diff --git a/templates/icehouse/metadata_agent.ini b/templates/icehouse/metadata_agent.ini index bddc97f4..9e923267 100644 --- a/templates/icehouse/metadata_agent.ini +++ b/templates/icehouse/metadata_agent.ini @@ -17,3 +17,4 @@ state_path = /var/lib/neutron nova_metadata_port = 8775 metadata_proxy_shared_secret = {{ shared_secret }} cache_url = memory://?default_ttl=5 +metadata_workers = {{ workers }} diff --git a/templates/juno/metadata_agent.ini b/templates/juno/metadata_agent.ini index bddc97f4..9e923267 100644 --- a/templates/juno/metadata_agent.ini +++ b/templates/juno/metadata_agent.ini @@ -17,3 +17,4 @@ state_path = /var/lib/neutron nova_metadata_port = 8775 metadata_proxy_shared_secret = {{ shared_secret }} cache_url = memory://?default_ttl=5 +metadata_workers = {{ workers }}