From f556a42a87307071c881c272ec537446f610363b Mon Sep 17 00:00:00 2001
From: Vladislav Belogrudov <vladislav.belogrudov@oracle.com>
Date: Tue, 7 Feb 2017 16:34:58 +0300
Subject: [PATCH] Allow configuration of HAProxy default timeouts

With this fix operator can tune client/server timeouts of HAProxy
to avoid receiving '504' for lengthy requests by API clients.

Change-Id: I12611b34f99759e6b6527fea3768a971c9fbdd71
Closes-Bug: #1662506
---
 ansible/roles/haproxy/defaults/main.yml        | 3 +++
 ansible/roles/haproxy/templates/haproxy.cfg.j2 | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ansible/roles/haproxy/defaults/main.yml b/ansible/roles/haproxy/defaults/main.yml
index 1b8c327ada..afce84ed2d 100644
--- a/ansible/roles/haproxy/defaults/main.yml
+++ b/ansible/roles/haproxy/defaults/main.yml
@@ -12,3 +12,6 @@ keepalived_image_full: "{{ keepalived_image }}:{{ keepalived_tag }}"
 haproxy_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-haproxy"
 haproxy_tag: "{{ openstack_release }}"
 haproxy_image_full: "{{ haproxy_image }}:{{ haproxy_tag }}"
+
+haproxy_client_timeout: "1m"
+haproxy_server_timeout: "1m"
diff --git a/ansible/roles/haproxy/templates/haproxy.cfg.j2 b/ansible/roles/haproxy/templates/haproxy.cfg.j2
index 7cd9d6294e..6fa01f8ae5 100644
--- a/ansible/roles/haproxy/templates/haproxy.cfg.j2
+++ b/ansible/roles/haproxy/templates/haproxy.cfg.j2
@@ -25,8 +25,8 @@ defaults
   timeout http-request 10s
   timeout queue 1m
   timeout connect 10s
-  timeout client 1m
-  timeout server 1m
+  timeout client {{ haproxy_client_timeout }}
+  timeout server {{ haproxy_server_timeout }}
   timeout check 10s
 
 listen stats