Skip to content

Commit 52ea0f6

Browse files
zhhuabjdosaboy
andauthored
cherry-pick the fix for lp bug 2021550 to yoga branch (#848)
* Allow users to disable wsgi socket rotation (#801) The lp bug 1863232 introduced a new configuration option called WSGISocketRotation which allows users to disable socket rotation on the apache side. This patch will also allow setting this option on the charm side. Other gerrit review links: horizon: https://review.opendev.org/c/openstack/charm-openstack-dashboard/+/886373 cinder: https://review.opendev.org/c/openstack/charm-cinder/+/886356 keystone: https://review.opendev.org/c/openstack/charm-keystone/+/886377 ncc: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/885836 Partial-Bug: 2021550 (cherry picked from commit 996f241) Signed-off-by: zhhuabj <[email protected]> * Rename wsgi-rotation to wsgi-socket-rotation Commit 996f241 added support for new config option 'wsgi-rotation' but that name should have been 'wsgi-socket-rotation' in order to have a 1:1 relation with the apache config it changes. The following patches that implement this config are currently blocked until this lands so that they can be synced before merge: * https://review.opendev.org/c/openstack/charm-ceilometer/+/887793 * https://review.opendev.org/c/openstack/charm-cinder/+/886356 * https://review.opendev.org/c/openstack/charm-glance/+/886376 * https://review.opendev.org/c/openstack/charm-keystone/+/886377 * https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/885836 * https://review.opendev.org/c/openstack/charm-openstack-dashboard/+/886373 Related-Bug: #2021550 (cherry picked from commit 1a90eb0) Signed-off-by: zhhuabj <[email protected]> --------- Signed-off-by: zhhuabj <[email protected]> Co-authored-by: Edward Hope-Morley <[email protected]>
1 parent 910c898 commit 52ea0f6

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

charmhelpers/contrib/openstack/context.py

+4
Original file line numberDiff line numberDiff line change
@@ -1665,6 +1665,9 @@ def __init__(self, name=None, script=None, admin_script=None,
16651665

16661666
def __call__(self):
16671667
total_processes = _calculate_workers()
1668+
enable_wsgi_socket_rotation = config('wsgi-socket-rotation')
1669+
if enable_wsgi_socket_rotation is None:
1670+
enable_wsgi_socket_rotation = True
16681671
ctxt = {
16691672
"service_name": self.service_name,
16701673
"user": self.user,
@@ -1678,6 +1681,7 @@ def __call__(self):
16781681
"public_processes": int(math.ceil(self.public_process_weight *
16791682
total_processes)),
16801683
"threads": 1,
1684+
"wsgi_socket_rotation": enable_wsgi_socket_rotation,
16811685
}
16821686
return ctxt
16831687

charmhelpers/contrib/openstack/templates/wsgi-openstack-api.conf

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ Listen {{ admin_port }}
1212
Listen {{ public_port }}
1313
{% endif -%}
1414

15+
{% if wsgi_socket_rotation -%}
16+
WSGISocketRotation On
17+
{% else -%}
18+
WSGISocketRotation Off
19+
{% endif -%}
20+
1521
{% if port -%}
1622
<VirtualHost *:{{ port }}>
1723
WSGIDaemonProcess {{ service_name }} processes={{ processes }} threads={{ threads }} user={{ user }} group={{ group }} \

tests/contrib/openstack/test_os_contexts.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -3288,7 +3288,9 @@ def test_loglevel_context_unset(self):
32883288
@patch.object(context, '_calculate_workers')
32893289
def test_wsgi_worker_config_context(self,
32903290
_calculate_workers):
3291-
self.config.return_value = 2 # worker-multiplier=2
3291+
self.config.side_effect = fake_config({
3292+
'worker-multiplier': 2, 'non-defined-wsgi-socket-rotation': True
3293+
})
32923294
_calculate_workers.return_value = 8
32933295
service_name = 'service-name'
32943296
script = '/usr/bin/script'
@@ -3305,13 +3307,16 @@ def test_wsgi_worker_config_context(self,
33053307
"admin_processes": 2,
33063308
"public_processes": 6,
33073309
"threads": 1,
3310+
"wsgi_socket_rotation": True,
33083311
}
33093312
self.assertEqual(expect, ctxt())
33103313

33113314
@patch.object(context, '_calculate_workers')
33123315
def test_wsgi_worker_config_context_user_and_group(self,
33133316
_calculate_workers):
3314-
self.config.return_value = 1
3317+
self.config.side_effect = fake_config({
3318+
'worker-multiplier': 1, 'wsgi-socket-rotation': False
3319+
})
33153320
_calculate_workers.return_value = 1
33163321
service_name = 'service-name'
33173322
script = '/usr/bin/script'
@@ -3332,6 +3337,7 @@ def test_wsgi_worker_config_context_user_and_group(self,
33323337
"admin_processes": 1,
33333338
"public_processes": 1,
33343339
"threads": 1,
3340+
"wsgi_socket_rotation": False,
33353341
}
33363342
self.assertEqual(expect, ctxt())
33373343

0 commit comments

Comments
 (0)