From 1ef7c19d768e29173bd5323df58b5bbef3b5aef6 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 14 May 2014 19:16:39 -0400 Subject: [PATCH] HAproxy: change Spice options - Add "option" parameter to binding function - Use this new parameter for adding options to Spice binding configuration: - Use "leastconn" mode instead of "roundrobin" - Use a 2 hours timeout to avoid Spice disconnection after some idle activity both on client & server sides. Closes-bug #463 Signed-off-by: Emilien Macchi --- manifests/loadbalancer.pp | 11 ++++++++--- manifests/loadbalancer/binding.pp | 4 +++- spec/classes/cloud_loadbalancer_spec.rb | 10 +++++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/manifests/loadbalancer.pp b/manifests/loadbalancer.pp index c236a890..735ccee1 100644 --- a/manifests/loadbalancer.pp +++ b/manifests/loadbalancer.pp @@ -309,9 +309,14 @@ class cloud::loadbalancer( port => $ks_metadata_public_port; } cloud::loadbalancer::binding { 'spice_cluster': - ip => $spice, - port => $spice_port, - httpchk => 'httpchk GET /'; + ip => $spice, + port => $spice_port, + options => { + 'balance' => 'leastconn', + 'timeout server' => '120m', + 'timeout client' => '120m', + }, + httpchk => 'httpchk GET /'; } cloud::loadbalancer::binding { 'glance_api_cluster': ip => $glance_api, diff --git a/manifests/loadbalancer/binding.pp b/manifests/loadbalancer/binding.pp index f3f5bb32..c83739a6 100644 --- a/manifests/loadbalancer/binding.pp +++ b/manifests/loadbalancer/binding.pp @@ -17,7 +17,8 @@ define cloud::loadbalancer::binding ( $ip, $port, - $httpchk = undef + $httpchk = undef, + $options = undef ){ include cloud::loadbalancer @@ -56,6 +57,7 @@ define cloud::loadbalancer::binding ( cloud::loadbalancer::listen_http { $name : ports => $port, httpchk => $httpchk, + options => $options, listen_ip => $listen_ip_real; } } diff --git a/spec/classes/cloud_loadbalancer_spec.rb b/spec/classes/cloud_loadbalancer_spec.rb index 7b78fd4e..7b60d445 100644 --- a/spec/classes/cloud_loadbalancer_spec.rb +++ b/spec/classes/cloud_loadbalancer_spec.rb @@ -182,7 +182,15 @@ describe 'cloud::loadbalancer' do context 'configure OpenStack binding on public network only' do it { should contain_haproxy__listen('spice_cluster').with( :ipaddress => [params[:vip_public_ip]], - :ports => '6082' + :ports => '6082', + :options => { + 'mode' => 'http', + 'option' => ['tcpka','tcplog','httpchk GET /'], + 'http-check' => 'expect ! rstatus ^5', + 'balance' => 'leastconn', + 'timeout server' => '120m', + 'timeout client' => '120m' + } )} end