[jamespage,r=gnuoy] Add support for worker process configuration
This commit is contained in:
commit
c9ec9ef09f
@ -146,3 +146,10 @@ options:
|
||||
order for this charm to function correctly, the privacy extension must be
|
||||
disabled and a non-temporary address must be configured/available on
|
||||
your network interface.
|
||||
worker-multiplier:
|
||||
type: int
|
||||
default: 2
|
||||
description: |
|
||||
The CPU core multiplier to use when configuring worker processes for
|
||||
Glance. 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 {
|
||||
'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
|
||||
|
@ -83,7 +83,8 @@ CONFIG_FILES = OrderedDict([
|
||||
context.IdentityServiceContext(),
|
||||
context.SyslogContext(),
|
||||
glance_contexts.LoggingConfigContext(),
|
||||
glance_contexts.GlanceIPv6Context()],
|
||||
glance_contexts.GlanceIPv6Context(),
|
||||
context.WorkerConfigContext()],
|
||||
'services': ['glance-registry']
|
||||
}),
|
||||
(GLANCE_API_CONF, {
|
||||
@ -97,6 +98,7 @@ CONFIG_FILES = OrderedDict([
|
||||
context.SyslogContext(),
|
||||
glance_contexts.LoggingConfigContext(),
|
||||
glance_contexts.GlanceIPv6Context(),
|
||||
context.WorkerConfigContext(),
|
||||
glance_contexts.MultiStoreContext()],
|
||||
'services': ['glance-api']
|
||||
}),
|
||||
|
@ -2,6 +2,7 @@
|
||||
verbose = {{ verbose }}
|
||||
use_syslog = {{ use_syslog }}
|
||||
debug = {{ debug }}
|
||||
workers = {{ workers }}
|
||||
|
||||
{% if rbd_pool -%}
|
||||
default_store = rbd
|
||||
|
@ -2,6 +2,7 @@
|
||||
verbose = {{ verbose }}
|
||||
use_syslog = {{ use_syslog }}
|
||||
debug = {{ debug }}
|
||||
workers = {{ workers }}
|
||||
|
||||
bind_host = {{ bind_host }}
|
||||
bind_port = 9191
|
||||
|
@ -2,6 +2,7 @@
|
||||
verbose = {{ verbose }}
|
||||
use_syslog = {{ use_syslog }}
|
||||
debug = {{ debug }}
|
||||
workers = {{ workers }}
|
||||
|
||||
known_stores = {{ known_stores }}
|
||||
{% if rbd_pool -%}
|
||||
|
Loading…
Reference in New Issue
Block a user