Merge lp:~james-page/charms/trusty/glance/worker-config into lp:~openstack-charmers-archive/charms/trusty/glance/next

Proposed by James Page
Status: Merged
Merged at revision: 71
Proposed branch: lp:~james-page/charms/trusty/glance/worker-config
Merge into: lp:~openstack-charmers-archive/charms/trusty/glance/next
Diff against target: 99 lines (+32/-1)
6 files modified
config.yaml (+7/-0)
hooks/charmhelpers/contrib/openstack/context.py (+19/-0)
hooks/glance_utils.py (+3/-1)
templates/icehouse/glance-api.conf (+1/-0)
templates/icehouse/glance-registry.conf (+1/-0)
templates/juno/glance-api.conf (+1/-0)
To merge this branch: bzr merge lp:~james-page/charms/trusty/glance/worker-config
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+237414@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Liam Young (gnuoy) wrote :

Approve

review: Approve
70. By James Page

Rebase

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2014-10-06 21:26:18 +0000
3+++ config.yaml 2014-10-07 19:33:37 +0000
4@@ -146,3 +146,10 @@
5 order for this charm to function correctly, the privacy extension must be
6 disabled and a non-temporary address must be configured/available on
7 your network interface.
8+ worker-multiplier:
9+ type: int
10+ default: 2
11+ description: |
12+ The CPU core multiplier to use when configuring worker processes for
13+ Glance. By default, the number of workers for each daemon is set to
14+ twice the number of CPU cores a service unit has.
15
16=== modified file 'hooks/charmhelpers/contrib/openstack/context.py'
17--- hooks/charmhelpers/contrib/openstack/context.py 2014-10-07 09:02:12 +0000
18+++ hooks/charmhelpers/contrib/openstack/context.py 2014-10-07 19:33:37 +0000
19@@ -903,3 +903,22 @@
20 return {
21 'bind_host': '0.0.0.0'
22 }
23+
24+
25+class WorkerConfigContext(OSContextGenerator):
26+
27+ @property
28+ def num_cpus(self):
29+ try:
30+ from psutil import NUM_CPUS
31+ except ImportError:
32+ apt_install('python-psutil', fatal=True)
33+ from psutil import NUM_CPUS
34+ return NUM_CPUS
35+
36+ def __call__(self):
37+ multiplier = config('worker-multiplier') or 1
38+ ctxt = {
39+ "workers": self.num_cpus * multiplier
40+ }
41+ return ctxt
42
43=== modified file 'hooks/glance_utils.py'
44--- hooks/glance_utils.py 2014-10-07 14:47:14 +0000
45+++ hooks/glance_utils.py 2014-10-07 19:33:37 +0000
46@@ -83,7 +83,8 @@
47 context.IdentityServiceContext(),
48 context.SyslogContext(),
49 glance_contexts.LoggingConfigContext(),
50- glance_contexts.GlanceIPv6Context()],
51+ glance_contexts.GlanceIPv6Context(),
52+ context.WorkerConfigContext()],
53 'services': ['glance-registry']
54 }),
55 (GLANCE_API_CONF, {
56@@ -97,6 +98,7 @@
57 context.SyslogContext(),
58 glance_contexts.LoggingConfigContext(),
59 glance_contexts.GlanceIPv6Context(),
60+ context.WorkerConfigContext(),
61 glance_contexts.MultiStoreContext()],
62 'services': ['glance-api']
63 }),
64
65=== modified file 'templates/icehouse/glance-api.conf'
66--- templates/icehouse/glance-api.conf 2014-10-07 09:19:09 +0000
67+++ templates/icehouse/glance-api.conf 2014-10-07 19:33:37 +0000
68@@ -2,6 +2,7 @@
69 verbose = {{ verbose }}
70 use_syslog = {{ use_syslog }}
71 debug = {{ debug }}
72+workers = {{ workers }}
73
74 {% if rbd_pool -%}
75 default_store = rbd
76
77=== modified file 'templates/icehouse/glance-registry.conf'
78--- templates/icehouse/glance-registry.conf 2014-08-06 12:32:10 +0000
79+++ templates/icehouse/glance-registry.conf 2014-10-07 19:33:37 +0000
80@@ -2,6 +2,7 @@
81 verbose = {{ verbose }}
82 use_syslog = {{ use_syslog }}
83 debug = {{ debug }}
84+workers = {{ workers }}
85
86 bind_host = {{ bind_host }}
87 bind_port = 9191
88
89=== modified file 'templates/juno/glance-api.conf'
90--- templates/juno/glance-api.conf 2014-10-07 15:19:08 +0000
91+++ templates/juno/glance-api.conf 2014-10-07 19:33:37 +0000
92@@ -2,6 +2,7 @@
93 verbose = {{ verbose }}
94 use_syslog = {{ use_syslog }}
95 debug = {{ debug }}
96+workers = {{ workers }}
97
98 known_stores = {{ known_stores }}
99 {% if rbd_pool -%}

Subscribers

People subscribed via source and target branches