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: Ieca45a470e7f827194780b2fee9f8c6049b94da3
This commit is contained in:
parent
2e2fff4253
commit
8b366fbf6b
|
@ -1748,9 +1748,9 @@ class WSGIWorkerConfigContext(WorkerConfigContext):
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
total_processes = _calculate_workers()
|
total_processes = _calculate_workers()
|
||||||
enable_wsgi_rotation = config('wsgi-rotation')
|
enable_wsgi_socket_rotation = config('wsgi-socket-rotation')
|
||||||
if enable_wsgi_rotation is None:
|
if enable_wsgi_socket_rotation is None:
|
||||||
enable_wsgi_rotation = True
|
enable_wsgi_socket_rotation = True
|
||||||
ctxt = {
|
ctxt = {
|
||||||
"service_name": self.service_name,
|
"service_name": self.service_name,
|
||||||
"user": self.user,
|
"user": self.user,
|
||||||
|
@ -1764,7 +1764,7 @@ class WSGIWorkerConfigContext(WorkerConfigContext):
|
||||||
"public_processes": int(math.ceil(self.public_process_weight *
|
"public_processes": int(math.ceil(self.public_process_weight *
|
||||||
total_processes)),
|
total_processes)),
|
||||||
"threads": 1,
|
"threads": 1,
|
||||||
"wsgi_rotation": enable_wsgi_rotation,
|
"wsgi_socket_rotation": enable_wsgi_socket_rotation,
|
||||||
}
|
}
|
||||||
return ctxt
|
return ctxt
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ Listen {{ admin_port }}
|
||||||
Listen {{ public_port }}
|
Listen {{ public_port }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
{% if wsgi_rotation -%}
|
{% if wsgi_socket_rotation -%}
|
||||||
WSGISocketRotation On
|
WSGISocketRotation On
|
||||||
{% else -%}
|
{% else -%}
|
||||||
WSGISocketRotation Off
|
WSGISocketRotation Off
|
||||||
|
|
|
@ -12,7 +12,7 @@ Listen {{ admin_port }}
|
||||||
Listen {{ public_port }}
|
Listen {{ public_port }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
{% if wsgi_rotation -%}
|
{% if wsgi_socket_rotation -%}
|
||||||
WSGISocketRotation On
|
WSGISocketRotation On
|
||||||
{% else -%}
|
{% else -%}
|
||||||
WSGISocketRotation Off
|
WSGISocketRotation Off
|
||||||
|
|
|
@ -158,15 +158,19 @@ def get_osd_settings(relation_name):
|
||||||
return _order_dict_by_key(osd_settings)
|
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.
|
"""Send the application name down the relation.
|
||||||
|
|
||||||
:param relid: Relation id to set application name in.
|
:param relid: Relation id to set application name in.
|
||||||
:type relid: str
|
: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_set(
|
||||||
relation_id=relid,
|
relation_id=relid,
|
||||||
relation_settings={'application-name': application_name()})
|
relation_settings={'application-name': app_name})
|
||||||
|
|
||||||
|
|
||||||
def send_osd_settings():
|
def send_osd_settings():
|
||||||
|
|
|
@ -529,7 +529,8 @@ def kv():
|
||||||
|
|
||||||
env_var = os.environ.get("CHARM_HELPERS_TESTMODE", "auto").lower()
|
env_var = os.environ.get("CHARM_HELPERS_TESTMODE", "auto").lower()
|
||||||
if env_var not in ["auto", "no", "yes"]:
|
if env_var not in ["auto", "no", "yes"]:
|
||||||
logging.warning(f"Unknown value for CHARM_HELPERS_TESTMODE '{env_var}', assuming 'no'")
|
logging.warning("Unknown value for CHARM_HELPERS_TESTMODE '%s'"
|
||||||
|
", assuming 'no'", env_var)
|
||||||
env_var = "no"
|
env_var = "no"
|
||||||
|
|
||||||
if env_var == "no":
|
if env_var == "no":
|
||||||
|
|
|
@ -52,7 +52,7 @@ def _snap_exec(commands):
|
||||||
:param commands: List commands
|
:param commands: List commands
|
||||||
:return: Integer exit code
|
:return: Integer exit code
|
||||||
"""
|
"""
|
||||||
assert type(commands) == list
|
assert isinstance(commands, list)
|
||||||
|
|
||||||
retry_count = 0
|
retry_count = 0
|
||||||
return_code = None
|
return_code = None
|
||||||
|
|
|
@ -415,3 +415,11 @@ options:
|
||||||
List of comma-separated filter class names to use for filtering hosts
|
List of comma-separated filter class names to use for filtering hosts
|
||||||
when not specified in the request.
|
when not specified in the request.
|
||||||
The default filters varies based on OpenStack release.
|
The default filters varies based on OpenStack release.
|
||||||
|
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.
|
||||||
|
|
Loading…
Reference in New Issue