Add support for worker configuration
This commit is contained in:
parent
a2ce89d407
commit
af33e0d5ab
@ -181,3 +181,10 @@ options:
|
|||||||
order for this charm to function correctly, the privacy extension must be
|
order for this charm to function correctly, the privacy extension must be
|
||||||
disabled and a non-temporary address must be configured/available on
|
disabled and a non-temporary address must be configured/available on
|
||||||
your network interface.
|
your network interface.
|
||||||
|
worker-multiplier:
|
||||||
|
type: int
|
||||||
|
default: 2
|
||||||
|
description: |
|
||||||
|
The CPU core multiplier to use when configuring worker processes for
|
||||||
|
Cinder. By default, the number of workers for each daemon is set to
|
||||||
|
twice the number of CPU cores a service unit has.
|
||||||
|
@ -903,3 +903,22 @@ class BindHostContext(OSContextGenerator):
|
|||||||
return {
|
return {
|
||||||
'bind_host': '0.0.0.0'
|
'bind_host': '0.0.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class WorkerConfigContext(OSContextGenerator):
|
||||||
|
|
||||||
|
@property
|
||||||
|
def num_cpus(self):
|
||||||
|
try:
|
||||||
|
from psutil import NUM_CPUS
|
||||||
|
except ImportError:
|
||||||
|
apt_install('python-psutil', fatal=True)
|
||||||
|
from psutil import NUM_CPUS
|
||||||
|
return NUM_CPUS
|
||||||
|
|
||||||
|
def __call__(self):
|
||||||
|
multiplier = config('worker-multiplier') or 1
|
||||||
|
ctxt = {
|
||||||
|
"workers": self.num_cpus * multiplier
|
||||||
|
}
|
||||||
|
return ctxt
|
||||||
|
@ -131,7 +131,8 @@ CONFIG_FILES = OrderedDict([
|
|||||||
cinder_contexts.StorageBackendContext(),
|
cinder_contexts.StorageBackendContext(),
|
||||||
cinder_contexts.LoggingConfigContext(),
|
cinder_contexts.LoggingConfigContext(),
|
||||||
context.IdentityServiceContext(),
|
context.IdentityServiceContext(),
|
||||||
context.BindHostContext()],
|
context.BindHostContext(),
|
||||||
|
context.WorkerConfigContext()],
|
||||||
'services': ['cinder-api', 'cinder-volume',
|
'services': ['cinder-api', 'cinder-volume',
|
||||||
'cinder-scheduler', 'haproxy']
|
'cinder-scheduler', 'haproxy']
|
||||||
}),
|
}),
|
||||||
|
@ -16,6 +16,7 @@ auth_strategy = keystone
|
|||||||
state_path = /var/lib/cinder
|
state_path = /var/lib/cinder
|
||||||
lock_path = /var/lock/cinder
|
lock_path = /var/lock/cinder
|
||||||
volumes_dir = /var/lib/cinder/volumes
|
volumes_dir = /var/lib/cinder/volumes
|
||||||
|
osapi_volume_workers = {{ workers }}
|
||||||
|
|
||||||
{% include "parts/rabbitmq" %}
|
{% include "parts/rabbitmq" %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user