context: extend HAProxyContext for placement API

Since we will have to generate a HAProxyContext for
nova-compute-os-api, this change add new class
PlacementAPIHAProxyContext which extends HAProxyContext.

Partial-Bug: #1812672
Change-Id: I56920e3d9c5216cdd5a8ea8b83714e65b777a78b
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
This commit is contained in:
Sahid Orentino Ferdjaoui 2019-01-25 15:20:57 +01:00 committed by Corey Bryant
parent 131497868f
commit fc68571c51
2 changed files with 14 additions and 3 deletions

View File

@ -207,7 +207,15 @@ class HAProxyContext(ch_context.HAProxyContext):
ctxt['service_ports'] = port_mapping
# for nova.conf
ctxt['listen_ports'] = listen_ports
ctxt['port'] = placement_api
return ctxt
class PlacementAPIHAProxyContext(HAProxyContext):
"""Context for the nova placement api service."""
def __call__(self):
ctxt = super(PlacementAPIHAProxyContext, self).__call__()
ctxt['port'] = ctxt['listen_ports']['placement_listen_port']
return ctxt

View File

@ -284,8 +284,11 @@ def resource_map(actual_services=True):
_resource_map[WSGI_NOVA_PLACEMENT_API_CONF] = {
'contexts': [
ch_context.WSGIWorkerConfigContext(
name="nova", script=wsgi_script),
nova_cc_context.HAProxyContext()],
name="nova_placement",
user="nova",
group="nova",
script=wsgi_script),
nova_cc_context.PlacementAPIHAProxyContext()],
'services': ['apache2']
}
elif not placement_api_enabled():