Support disabling apache wsgi socket rotation

Bug LP 1863232 introduced a new Apache configuration option called
WSGISocketRotation which allows users to disable wsgi socket
rotation. This patch makes this configurable with a new
wsgi-socket-rotation config option that defaults to the Apache
default and can optionally be set to False.

Closes-Bug: #2021550
Change-Id: Ia5852c3ebe84bd0355670f262cbe5e1cd433a08d
This commit is contained in:
zhhuabj 2023-09-04 18:33:51 +08:00
parent b65d861ae3
commit b4ee292bb6
5 changed files with 20 additions and 8 deletions

View File

@ -1748,9 +1748,9 @@ class WSGIWorkerConfigContext(WorkerConfigContext):
def __call__(self):
total_processes = _calculate_workers()
enable_wsgi_rotation = config('wsgi-rotation')
if enable_wsgi_rotation is None:
enable_wsgi_rotation = True
enable_wsgi_socket_rotation = config('wsgi-socket-rotation')
if enable_wsgi_socket_rotation is None:
enable_wsgi_socket_rotation = True
ctxt = {
"service_name": self.service_name,
"user": self.user,
@ -1764,7 +1764,7 @@ class WSGIWorkerConfigContext(WorkerConfigContext):
"public_processes": int(math.ceil(self.public_process_weight *
total_processes)),
"threads": 1,
"wsgi_rotation": enable_wsgi_rotation,
"wsgi_socket_rotation": enable_wsgi_socket_rotation,
}
return ctxt

View File

@ -12,7 +12,7 @@ Listen {{ admin_port }}
Listen {{ public_port }}
{% endif -%}
{% if wsgi_rotation -%}
{% if wsgi_socket_rotation -%}
WSGISocketRotation On
{% else -%}
WSGISocketRotation Off

View File

@ -12,7 +12,7 @@ Listen {{ admin_port }}
Listen {{ public_port }}
{% endif -%}
{% if wsgi_rotation -%}
{% if wsgi_socket_rotation -%}
WSGISocketRotation On
{% else -%}
WSGISocketRotation Off

View File

@ -158,15 +158,19 @@ def get_osd_settings(relation_name):
return _order_dict_by_key(osd_settings)
def send_application_name(relid=None):
def send_application_name(relid=None, app_name=None):
"""Send the application name down the relation.
:param relid: Relation id to set application name in.
:type relid: str
:param app_name: Application name to send in the relation.
:type app_name: str
"""
if app_name is None:
app_name = application_name()
relation_set(
relation_id=relid,
relation_settings={'application-name': application_name()})
relation_settings={'application-name': app_name})
def send_osd_settings():

View File

@ -459,3 +459,11 @@ options:
The config item specifies the auth_ttl otion in [credentials]. This is
the length of time in minutes for which a signed EC2 or S3 token request
is valid from the timestamp contained in the token request.
wsgi-socket-rotation:
type: boolean
default: True
description: |
Allow users to disable Apache wsgi socket rotation. If not configured,
this option sets True as the default value, which is consistent with the
default value 'WSGISocketRotation On' in Apache. This option should be
used with caution. Please read the Apache doc page for more information.